s3: Use dbwrap_parse_record in fetch_share_mode_unlocked
[kai/samba.git] / source3 / modules / vfs_notify_fam.c
index 652e785e0286b0598fd1433629afa25b379286e9..dcc843f6d8d0a484480be217bb59878bc3895efb 100644 (file)
@@ -19,6 +19,8 @@
  */
 
 #include "includes.h"
+#include "smbd/smbd.h"
+#include "librpc/gen_ndr/notify.h"
 
 #include <fam.h>
 
@@ -85,7 +87,7 @@ static NTSTATUS fam_open_connection(FAMConnection *fam_conn,
        setenv("GAM_CLIENT_ID","SAMBA",0);
 #endif
 
-       if (asprintf(&name, "smbd (%lu)", (unsigned long)sys_getpid()) == -1) {
+       if (asprintf(&name, "smbd (%lu)", (unsigned long)getpid()) == -1) {
                DEBUG(0, ("No memory\n"));
                return NT_STATUS_NO_MEMORY;
        }
@@ -219,7 +221,9 @@ static int fam_watch_context_destructor(struct fam_watch_context *ctx)
 */
 static NTSTATUS fam_watch(vfs_handle_struct *vfs_handle,
                          struct sys_notify_context *ctx,
-                         struct notify_entry *e,
+                         const char *path,
+                         uint32_t *filter,
+                         uint32_t *subdir_filter,
                          void (*callback)(struct sys_notify_context *ctx, 
                                           void *private_data,
                                           struct notify_event *ev),
@@ -231,8 +235,8 @@ static NTSTATUS fam_watch(vfs_handle_struct *vfs_handle,
        struct fam_watch_context *watch;
        void **handle = (void **)handle_p;
 
-       if ((e->filter & fam_mask) == 0) {
-               DEBUG(10, ("filter = %u, ignoring in FAM\n", e->filter));
+       if ((*filter & fam_mask) == 0) {
+               DEBUG(10, ("filter = %u, ignoring in FAM\n", *filter));
                return NT_STATUS_OK;
        }
 
@@ -247,7 +251,7 @@ static NTSTATUS fam_watch(vfs_handle_struct *vfs_handle,
                fam_connection_initialized = True;
        }
 
-       if (!(watch = TALLOC_P(ctx, struct fam_watch_context))) {
+       if (!(watch = talloc(ctx, struct fam_watch_context))) {
                return NT_STATUS_NO_MEMORY;
        }
 
@@ -257,7 +261,8 @@ static NTSTATUS fam_watch(vfs_handle_struct *vfs_handle,
        watch->private_data = private_data;
        watch->sys_ctx = ctx;
 
-       if (!(watch->path = talloc_strdup(watch, e->path))) {
+       watch->path = talloc_strdup(watch, path);
+       if (watch->path == NULL) {
                DEBUG(0, ("talloc_asprintf failed\n"));
                TALLOC_FREE(watch);
                return NT_STATUS_NO_MEMORY;
@@ -270,7 +275,7 @@ static NTSTATUS fam_watch(vfs_handle_struct *vfs_handle,
         */
 
        watch->filter = fam_mask;
-       e->filter &= ~fam_mask;
+       *filter &= ~fam_mask;
 
        DLIST_ADD(fam_notify_list, watch);
        talloc_set_destructor(watch, fam_watch_context_destructor);
@@ -299,7 +304,7 @@ static NTSTATUS fam_watch(vfs_handle_struct *vfs_handle,
 /* VFS operations structure */
 
 static struct vfs_fn_pointers notify_fam_fns = {
-       .notify_watch = fam_watch,
+       .notify_watch_fn = fam_watch,
 };