Merge tag 'upstream/4.0.5+dfsg1' into samba_4.0_ivo
[abartlet/samba-debian.git] / source3 / modules / vfs_notify_fam.c
index a4e7fd1e2ba5349ed00058124c2a99a75eae5fb0..dcc843f6d8d0a484480be217bb59878bc3895efb 100644 (file)
@@ -87,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;
        }
@@ -221,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),
@@ -233,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;
        }
 
@@ -249,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;
        }
 
@@ -259,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;
@@ -272,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);
@@ -301,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,
 };