summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-03-19 21:57:50 +0100
committerVolker Lendecke <vl@samba.org>2012-03-21 12:52:09 +0100
commit4319076ccaf3e6264207a88b88dea0fa63b31879 (patch)
tree70e46f17397cf9c3d5bd85e8506a188efd5cc238
parent06db3bfa374026c05dc21bf0454234dbdbedb26b (diff)
downloadsamba-4319076ccaf3e6264207a88b88dea0fa63b31879.tar.gz
samba-4319076ccaf3e6264207a88b88dea0fa63b31879.tar.bz2
samba-4319076ccaf3e6264207a88b88dea0fa63b31879.zip
s3: Pass "path" through vfs_notify_watch
-rw-r--r--examples/VFS/skel_transparent.c16
-rw-r--r--source3/include/vfs.h2
-rw-r--r--source3/include/vfs_macros.h8
-rw-r--r--source3/modules/vfs_default.c4
-rw-r--r--source3/modules/vfs_full_audit.c4
-rw-r--r--source3/modules/vfs_notify_fam.c4
-rw-r--r--source3/modules/vfs_time_audit.c3
-rw-r--r--source3/smbd/notify.c5
-rw-r--r--source3/smbd/notify_inotify.c5
-rw-r--r--source3/smbd/notify_internal.c2
-rw-r--r--source3/smbd/proto.h2
-rw-r--r--source3/smbd/vfs.c3
12 files changed, 38 insertions, 20 deletions
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index b38479003b..964ba6dc9c 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -357,12 +357,16 @@ static char *skel_realpath(vfs_handle_struct *handle, const char *path)
return SMB_VFS_NEXT_REALPATH(handle, path);
}
-static NTSTATUS skel_notify_watch(struct vfs_handle_struct *handle,
- struct sys_notify_context *ctx, struct notify_entry *e,
- void (*callback)(struct sys_notify_context *ctx, void *private_data, struct notify_event *ev),
- void *private_data, void *handle_p)
-{
- return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, callback,
+static NTSTATUS skel_notify_watch(
+ struct vfs_handle_struct *handle,
+ struct sys_notify_context *ctx,
+ struct notify_entry *e,
+ const char *path,
+ void (*callback)(struct sys_notify_context *ctx, void *private_data,
+ struct notify_event *ev),
+ void *private_data, void *handle_p)
+{
+ return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, path, callback,
private_data, handle_p);
}
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 62f9d10129..c038c56f46 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -285,6 +285,7 @@ struct vfs_fn_pointers {
NTSTATUS (*notify_watch_fn)(struct vfs_handle_struct *handle,
struct sys_notify_context *ctx,
struct notify_entry *e,
+ const char *path,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
@@ -676,6 +677,7 @@ 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 *name,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 3bfda9fecb..5e184e3009 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -313,10 +313,10 @@
#define SMB_VFS_NEXT_REALPATH(handle, path) \
smb_vfs_call_realpath((handle)->next, (path))
-#define SMB_VFS_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) \
- smb_vfs_call_notify_watch((conn)->vfs_handles, (ctx), (e), (callback), (private_data), (handle_p))
-#define SMB_VFS_NEXT_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) \
- smb_vfs_call_notify_watch((conn)->next, (ctx), (e), (callback), (private_data), (handle_p))
+#define SMB_VFS_NOTIFY_WATCH(conn, ctx, e, path, callback, private_data, handle_p) \
+ smb_vfs_call_notify_watch((conn)->vfs_handles, (ctx), (e), (path), (callback), (private_data), (handle_p))
+#define SMB_VFS_NEXT_NOTIFY_WATCH(conn, ctx, e, path, callback, private_data, handle_p) \
+ smb_vfs_call_notify_watch((conn)->next, (ctx), (e), (path), (callback), (private_data), (handle_p))
#define SMB_VFS_CHFLAGS(conn, path, flags) \
smb_vfs_call_chflags((conn)->vfs_handles, (path), (flags))
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 1dbd308368..37ec7e884d 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1633,6 +1633,7 @@ static char *vfswrap_realpath(vfs_handle_struct *handle, const char *path)
static NTSTATUS vfswrap_notify_watch(vfs_handle_struct *vfs_handle,
struct sys_notify_context *ctx,
struct notify_entry *e,
+ const char *path,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
@@ -1648,7 +1649,8 @@ static NTSTATUS vfswrap_notify_watch(vfs_handle_struct *vfs_handle,
*/
#ifdef HAVE_INOTIFY
if (lp_kernel_change_notify(ctx->conn->params)) {
- return inotify_watch(ctx, e, callback, private_data, handle);
+ return inotify_watch(ctx, e, path, callback, private_data,
+ handle);
}
#endif
/*
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 3efa848d22..24c2f8e323 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -1380,6 +1380,7 @@ static char *smb_full_audit_realpath(vfs_handle_struct *handle,
static NTSTATUS smb_full_audit_notify_watch(struct vfs_handle_struct *handle,
struct sys_notify_context *ctx,
struct notify_entry *e,
+ const char *path,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
@@ -1387,7 +1388,8 @@ static NTSTATUS smb_full_audit_notify_watch(struct vfs_handle_struct *handle,
{
NTSTATUS result;
- result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, callback, private_data, handle_p);
+ result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, path, callback,
+ private_data, handle_p);
do_log(SMB_VFS_OP_NOTIFY_WATCH, NT_STATUS_IS_OK(result), handle, "");
diff --git a/source3/modules/vfs_notify_fam.c b/source3/modules/vfs_notify_fam.c
index 343149423e..8a3487b9d3 100644
--- a/source3/modules/vfs_notify_fam.c
+++ b/source3/modules/vfs_notify_fam.c
@@ -222,6 +222,7 @@ 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,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
@@ -259,7 +260,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;
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index 734625e4e9..8ec434b541 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -1131,6 +1131,7 @@ static char *smb_time_audit_realpath(vfs_handle_struct *handle,
static NTSTATUS smb_time_audit_notify_watch(struct vfs_handle_struct *handle,
struct sys_notify_context *ctx,
struct notify_entry *e,
+ const char *path,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
@@ -1141,7 +1142,7 @@ static NTSTATUS smb_time_audit_notify_watch(struct vfs_handle_struct *handle,
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, callback,
+ result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, path, callback,
private_data, handle_p);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c
index 534ed8477b..5a78a726b7 100644
--- a/source3/smbd/notify.c
+++ b/source3/smbd/notify.c
@@ -548,12 +548,13 @@ struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
struct notify_entry *e,
+ const char *path,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
void *private_data, void *handle)
{
- return SMB_VFS_NOTIFY_WATCH(ctx->conn, ctx, e, callback, private_data,
- handle);
+ return SMB_VFS_NOTIFY_WATCH(ctx->conn, ctx, e, path, callback,
+ private_data, handle);
}
diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c
index bccd093be4..a074d019d9 100644
--- a/source3/smbd/notify_inotify.c
+++ b/source3/smbd/notify_inotify.c
@@ -372,6 +372,7 @@ static int watch_destructor(struct inotify_watch_context *w)
*/
NTSTATUS inotify_watch(struct sys_notify_context *ctx,
struct notify_entry *e,
+ const char *path,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
@@ -405,7 +406,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
mask |= (IN_MASK_ADD | IN_ONLYDIR);
/* get a new watch descriptor for this path */
- wd = inotify_add_watch(in->fd, e->path, mask);
+ wd = inotify_add_watch(in->fd, path, mask);
if (wd == -1) {
e->filter = filter;
DEBUG(1, ("inotify_add_watch returned %s\n", strerror(errno)));
@@ -428,7 +429,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
w->private_data = private_data;
w->mask = mask;
w->filter = filter;
- w->path = talloc_strdup(w, e->path);
+ w->path = talloc_strdup(w, path);
if (w->path == NULL) {
inotify_rm_watch(in->fd, wd);
e->filter = filter;
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index 906f7674de..b12459c9d3 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -538,7 +538,7 @@ NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
this call will modify e.filter and e.subdir_filter
to remove bits handled by the backend
*/
- status = sys_notify_watch(notify->sys_notify_ctx, &e,
+ status = sys_notify_watch(notify->sys_notify_ctx, &e, e.path,
sys_notify_callback, listel,
&listel->sys_notify_handle);
if (NT_STATUS_IS_OK(status)) {
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 0fbf9a0fcb..69655e7df6 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -524,6 +524,7 @@ struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
struct event_context *ev);
NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
struct notify_entry *e,
+ const char *path,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
@@ -533,6 +534,7 @@ NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
NTSTATUS inotify_watch(struct sys_notify_context *ctx,
struct notify_entry *e,
+ const char *path,
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 7da3881828..6b7b8691aa 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1834,13 +1834,14 @@ 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,
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, callback,
+ return handle->fns->notify_watch_fn(handle, ctx, e, path, callback,
private_data, handle_p);
}