From a5c51ae7f6f3cc48bc16111101c3a981a1e4050e Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Thu, 14 Jul 2016 15:44:46 -0700 Subject: [PATCH] smbd: Allow passing notify filter from inotify and fam This only adds a parameter to the callback without any functional change. Signed-off-by: Christof Schmitt Reviewed-by: Volker Lendecke --- source3/smbd/notify_fam.c | 8 +++++--- source3/smbd/notify_inotify.c | 11 +++++++---- source3/smbd/notifyd/notifyd.c | 11 +++++++---- source3/smbd/notifyd/notifyd.h | 3 ++- source3/smbd/proto.h | 6 ++++-- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/source3/smbd/notify_fam.c b/source3/smbd/notify_fam.c index d8d6946bfdf..2cf1e357c80 100644 --- a/source3/smbd/notify_fam.c +++ b/source3/smbd/notify_fam.c @@ -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) { diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c index 78fb654cf8d..88a54eca995 100644 --- a/source3/smbd/notify_inotify.c +++ b/source3/smbd/notify_inotify.c @@ -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) { diff --git a/source3/smbd/notifyd/notifyd.c b/source3/smbd/notifyd/notifyd.c index 45b029bb17a..519109f934c 100644 --- a/source3/smbd/notifyd/notifyd.c +++ b/source3/smbd/notifyd/notifyd.c @@ -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; diff --git a/source3/smbd/notifyd/notifyd.h b/source3/smbd/notifyd/notifyd.h index 672ffba202d..82fdd6e987f 100644 --- a/source3/smbd/notifyd/notifyd.h +++ b/source3/smbd/notifyd/notifyd.h @@ -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); diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 81bdc87b50c..f330b4ce09a 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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); -- 2.11.4.GIT