diff options
author | Volker Lendecke <vl@samba.org> | 2014-11-05 12:18:31 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-12-09 04:12:09 +0100 |
commit | a5a5326152a090e737201612f5e29a7ecc457c85 (patch) | |
tree | 9486a80df63c58bab19c0ec2d63a83d58e532f74 | |
parent | de4a1c90a70b31f99e987fa109683862bd0823d1 (diff) | |
download | samba-a5a5326152a090e737201612f5e29a7ecc457c85.tar.gz samba-a5a5326152a090e737201612f5e29a7ecc457c85.tar.xz samba-a5a5326152a090e737201612f5e29a7ecc457c85.zip |
notify_inotify: inotify_watch now takes a mem_ctx
This will make it easier to integrate into proper memory hierarchies.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/modules/vfs_default.c | 9 | ||||
-rw-r--r-- | source3/smbd/notify_inotify.c | 5 | ||||
-rw-r--r-- | source3/smbd/proto.h | 3 |
3 files changed, 13 insertions, 4 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index eaa1c2be4f..5634cc0fe9 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2123,7 +2123,14 @@ static NTSTATUS vfswrap_notify_watch(vfs_handle_struct *vfs_handle, if (!lp_parm_bool(-1, "notify", "inotify", True)) { return NT_STATUS_INVALID_SYSTEM_SERVICE; } - ret = inotify_watch(ctx, path, filter, subdir_filter, + /* + * "ctx->private_data" is not obvious as a talloc context + * here. Without modifying the VFS we don't have a mem_ctx + * available here, and ctx->private_data was used by + * inotify_watch before it got a real talloc parent. + */ + ret = inotify_watch(ctx->private_data, ctx, + path, filter, subdir_filter, callback, private_data, handle); if (ret != 0) { return map_nt_error_from_unix(ret); diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c index a3c30f1431..fedf9b522f 100644 --- a/source3/smbd/notify_inotify.c +++ b/source3/smbd/notify_inotify.c @@ -348,7 +348,8 @@ static int watch_destructor(struct inotify_watch_context *w) add a watch. The watch is removed when the caller calls talloc_free() on *handle */ -int inotify_watch(struct sys_notify_context *ctx, +int inotify_watch(TALLOC_CTX *mem_ctx, + struct sys_notify_context *ctx, const char *path, uint32_t *filter, uint32_t *subdir_filter, @@ -385,7 +386,7 @@ int inotify_watch(struct sys_notify_context *ctx, watch descriptor for multiple watches on the same path */ mask |= (IN_MASK_ADD | IN_ONLYDIR); - w = talloc(in, struct inotify_watch_context); + w = talloc(mem_ctx, struct inotify_watch_context); if (w == NULL) { *filter = orig_filter; return ENOMEM; diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 0e43aaf0df..44ea6f0c75 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -531,7 +531,8 @@ struct sys_notify_context *sys_notify_context_create(TALLOC_CTX *mem_ctx, /* The following definitions come from smbd/notify_inotify.c */ -int inotify_watch(struct sys_notify_context *ctx, +int inotify_watch(TALLOC_CTX *mem_ctx, + struct sys_notify_context *ctx, const char *path, uint32_t *filter, uint32_t *subdir_filter, |