smbd: Allow passing notify filter from inotify and fam
authorChristof Schmitt <cs@samba.org>
Thu, 14 Jul 2016 22:44:46 +0000 (15:44 -0700)
committerVolker Lendecke <vl@samba.org>
Mon, 18 Jul 2016 13:14:11 +0000 (15:14 +0200)
This only adds a parameter to the callback without any functional
change.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/notify_fam.c
source3/smbd/notify_inotify.c
source3/smbd/notifyd/notifyd.c
source3/smbd/notifyd/notifyd.h
source3/smbd/proto.h

index d8d6946bfdffae1294347bb20b651358f6ee2658..2cf1e357c800da9cbb67ea95f09f8cae7472fe3a 100644 (file)
@@ -52,7 +52,8 @@ struct fam_watch_context {
        struct sys_notify_context *sys_ctx;
        void (*callback)(struct sys_notify_context *ctx,
                         void *private_data,
-                        struct notify_event *ev);
+                        struct notify_event *ev,
+                        uint32_t filter);
        void *private_data;
        uint32_t mask; /* the inotify mask */
        uint32_t filter; /* the windows completion filter */
@@ -205,7 +206,7 @@ static void fam_handler(struct tevent_context *event_ctx,
        }
        ne.dir = ctx->path;
 
-       ctx->callback(ctx->sys_ctx, ctx->private_data, &ne);
+       ctx->callback(ctx->sys_ctx, ctx->private_data, &ne, UINT32_MAX);
 }
 
 static int fam_watch_context_destructor(struct fam_watch_context *ctx)
@@ -228,7 +229,8 @@ int fam_watch(TALLOC_CTX *mem_ctx,
              uint32_t *subdir_filter,
              void (*callback)(struct sys_notify_context *ctx,
                               void *private_data,
-                              struct notify_event *ev),
+                              struct notify_event *ev,
+                              uint32_t filter),
              void *private_data,
              void *handle_p)
 {
index 78fb654cf8d3fadb2bf2b16ff5379645da232510..88a54eca99532656488bde47afa37870c199d757 100644 (file)
@@ -48,7 +48,8 @@ struct inotify_watch_context {
        int wd;
        void (*callback)(struct sys_notify_context *ctx, 
                         void *private_data,
-                        struct notify_event *ev);
+                        struct notify_event *ev,
+                        uint32_t filter);
        void *private_data;
        uint32_t mask; /* the inotify mask */
        uint32_t filter; /* the windows completion filter */
@@ -164,7 +165,7 @@ static void inotify_dispatch(struct inotify_private *in,
                next = w->next;
                if (w->wd == e->wd && filter_match(w, e)) {
                        ne.dir = w->path;
-                       w->callback(in->ctx, w->private_data, &ne);
+                       w->callback(in->ctx, w->private_data, &ne, UINT32_MAX);
                }
        }
 
@@ -185,7 +186,8 @@ static void inotify_dispatch(struct inotify_private *in,
                        if (w->wd == e->wd && filter_match(w, e) &&
                            !(w->filter & FILE_NOTIFY_CHANGE_CREATION)) {
                                ne.dir = w->path;
-                               w->callback(in->ctx, w->private_data, &ne);
+                               w->callback(in->ctx, w->private_data, &ne,
+                                           UINT32_MAX);
                        }
                }
        }
@@ -355,7 +357,8 @@ int inotify_watch(TALLOC_CTX *mem_ctx,
                  uint32_t *subdir_filter,
                  void (*callback)(struct sys_notify_context *ctx,
                                   void *private_data,
-                                  struct notify_event *ev),
+                                  struct notify_event *ev,
+                                  uint32_t filter),
                  void *private_data,
                  void *handle_p)
 {
index 45b029bb17adb82af2701ce0d478829e8e369f23..519109f934cc20ce1df2bd230e5ca89affc9dde3 100644 (file)
@@ -140,7 +140,8 @@ static void notifyd_broadcast_reclog(struct ctdbd_connection *ctdbd_conn,
                                     struct messaging_reclog *log);
 #endif
 static void notifyd_sys_callback(struct sys_notify_context *ctx,
-                                void *private_data, struct notify_event *ev);
+                                void *private_data, struct notify_event *ev,
+                                uint32_t filter);
 
 #ifdef CLUSTER_SUPPORT
 static struct tevent_req *notifyd_broadcast_reclog_send(
@@ -163,7 +164,8 @@ static int sys_notify_watch_dummy(
        uint32_t *subdir_filter,
        void (*callback)(struct sys_notify_context *ctx,
                         void *private_data,
-                        struct notify_event *ev),
+                        struct notify_event *ev,
+                        uint32_t filter),
        void *private_data,
        void *handle_p)
 {
@@ -513,7 +515,8 @@ fail:
 }
 
 static void notifyd_sys_callback(struct sys_notify_context *ctx,
-                                void *private_data, struct notify_event *ev)
+                                void *private_data, struct notify_event *ev,
+                                uint32_t filter)
 {
        struct messaging_context *msg_ctx = talloc_get_type_abort(
                private_data, struct messaging_context);
@@ -524,7 +527,7 @@ static void notifyd_sys_callback(struct sys_notify_context *ctx,
        msg = (struct notify_trigger_msg) {
                .when = timespec_current(),
                .action = ev->action,
-               .filter = UINT32_MAX
+               .filter = filter,
        };
 
        iov[0].iov_base = &msg;
index 672ffba202d56b35c1461bbc5d0b6b89f6f7921a..82fdd6e987fe18633fa91ddbe73f20f811c64c6f 100644 (file)
@@ -129,7 +129,8 @@ typedef int (*sys_notify_watch_fn)(TALLOC_CTX *mem_ctx,
                                   uint32_t *subdir_filter,
                                   void (*callback)(struct sys_notify_context *ctx,
                                                    void *private_data,
-                                                   struct notify_event *ev),
+                                                   struct notify_event *ev,
+                                                   uint32_t filter),
                                   void *private_data,
                                   void *handle_p);
 
index 81bdc87b50cd63772805beb4a63fd19ff44b703d..f330b4ce09a0cb7636eb9703de477adf19439eb6 100644 (file)
@@ -560,7 +560,8 @@ int inotify_watch(TALLOC_CTX *mem_ctx,
                  uint32_t *subdir_filter,
                  void (*callback)(struct sys_notify_context *ctx,
                                   void *private_data,
-                                  struct notify_event *ev),
+                                  struct notify_event *ev,
+                                  uint32_t filter),
                  void *private_data,
                  void *handle_p);
 
@@ -571,7 +572,8 @@ int fam_watch(TALLOC_CTX *mem_ctx,
              uint32_t *subdir_filter,
              void (*callback)(struct sys_notify_context *ctx,
                               void *private_data,
-                              struct notify_event *ev),
+                              struct notify_event *ev,
+                              uint32_t filter),
              void *private_data,
              void *handle_p);