diff options
author | Volker Lendecke <vl@samba.org> | 2012-03-26 12:46:11 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2012-03-26 17:45:43 +0200 |
commit | fa6f61e83565f49fb4e75248cffaa1ef31567d20 (patch) | |
tree | 0caed7c2a103a24db7e6d2e0578071beefbb69f2 /source3/smbd | |
parent | c3a506b64e248152212ab647048a47bd63039452 (diff) | |
download | samba-fa6f61e83565f49fb4e75248cffaa1ef31567d20.tar.gz samba-fa6f61e83565f49fb4e75248cffaa1ef31567d20.tar.bz2 samba-fa6f61e83565f49fb4e75248cffaa1ef31567d20.zip |
s3: Pass filters explicitly through vfs notify watch
This removes a dependency on "struct notify_entry" and makes the nature of the
API more explicit. We depend upon the VFS module to mask out elements from
e->filter and e->subdir_filter that it took over to handle.
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Mon Mar 26 17:45:44 CEST 2012 on sn-devel-104
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/notify.c | 4 | ||||
-rw-r--r-- | source3/smbd/notify_inotify.c | 15 | ||||
-rw-r--r-- | source3/smbd/proto.h | 3 | ||||
-rw-r--r-- | source3/smbd/vfs.c | 6 |
4 files changed, 16 insertions, 12 deletions
diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index 53ae2d68e7..fd9e5524a7 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -235,8 +235,8 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter, status = SMB_VFS_NOTIFY_WATCH( fsp->conn, fsp->conn->sconn->sys_notify_ctx, - &e, e.path, sys_notify_callback, fsp, - &sys_notify_handle); + e.path, &e.filter, &e.subdir_filter, + sys_notify_callback, fsp, &sys_notify_handle); if (NT_STATUS_IS_OK(status)) { talloc_steal(fsp->notify, sys_notify_handle); diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c index 967c223ada..20f709831a 100644 --- a/source3/smbd/notify_inotify.c +++ b/source3/smbd/notify_inotify.c @@ -371,8 +371,9 @@ static int watch_destructor(struct inotify_watch_context *w) talloc_free() on *handle */ NTSTATUS inotify_watch(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), @@ -383,7 +384,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx, int wd; uint32_t mask; struct inotify_watch_context *w; - uint32_t orig_filter = e->filter; + uint32_t orig_filter = *filter; void **handle = (void **)handle_p; /* maybe setup the inotify fd */ @@ -395,7 +396,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx, in = talloc_get_type(ctx->private_data, struct inotify_private); - mask = inotify_map(&e->filter); + mask = inotify_map(filter); if (mask == 0) { /* this filter can't be handled by inotify */ return NT_STATUS_INVALID_PARAMETER; @@ -408,18 +409,18 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx, /* get a new watch descriptor for this path */ wd = inotify_add_watch(in->fd, path, mask); if (wd == -1) { - e->filter = orig_filter; + *filter = orig_filter; DEBUG(1, ("inotify_add_watch returned %s\n", strerror(errno))); return map_nt_error_from_unix(errno); } DEBUG(10, ("inotify_add_watch for %s mask %x returned wd %d\n", - e->path, mask, wd)); + path, mask, wd)); w = talloc(in, struct inotify_watch_context); if (w == NULL) { inotify_rm_watch(in->fd, wd); - e->filter = orig_filter; + *filter = orig_filter; return NT_STATUS_NO_MEMORY; } @@ -432,7 +433,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx, w->path = talloc_strdup(w, path); if (w->path == NULL) { inotify_rm_watch(in->fd, wd); - e->filter = orig_filter; + *filter = orig_filter; return NT_STATUS_NO_MEMORY; } diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 70c34ce35a..4bb57c0d5c 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -526,8 +526,9 @@ struct sys_notify_context *sys_notify_context_create(TALLOC_CTX *mem_ctx, /* The following definitions come from smbd/notify_inotify.c */ NTSTATUS inotify_watch(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), diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 6b7b8691aa..4c5e52be1b 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -1833,15 +1833,17 @@ char *smb_vfs_call_realpath(struct vfs_handle_struct *handle, const char *path) NTSTATUS smb_vfs_call_notify_watch(struct vfs_handle_struct *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), void *private_data, void *handle_p) { VFS_FIND(notify_watch); - return handle->fns->notify_watch_fn(handle, ctx, e, path, callback, + return handle->fns->notify_watch_fn(handle, ctx, path, + filter, subdir_filter, callback, private_data, handle_p); } |