[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Mon Mar 26 09:46:03 MDT 2012
The branch, master has been updated
via fa6f61e s3: Pass filters explicitly through vfs notify watch
via c3a506b s3: Fix a typo
via 58c8857 s3: Rename a variable in inotify_watch for clarity
via 6355d2e s3: Pass "filter" instead of "notify_entry" to inotify_map
via 6804e46 s3-docs: Prepend '/' to filename argument (Bug #8826)
from 7290a62 s4-dsdb: use constant-time search for descriptor -> get_last_structural_class()
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit fa6f61e83565f49fb4e75248cffaa1ef31567d20
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 26 12:46:11 2012 +0200
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 at samba.org>
Autobuild-Date: Mon Mar 26 17:45:44 CEST 2012 on sn-devel-104
commit c3a506b64e248152212ab647048a47bd63039452
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 26 13:11:02 2012 +0200
s3: Fix a typo
commit 58c8857b72fc76fb4ef5787daa823e26b58e5f12
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 26 13:09:33 2012 +0200
s3: Rename a variable in inotify_watch for clarity
commit 6355d2e68a5d959f38fcab12af46e61013abd72a
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 26 13:00:53 2012 +0200
s3: Pass "filter" instead of "notify_entry" to inotify_map
This makes the potential modification a bit more obvious
commit 6804e46811dd13cfd405f7c48a3dc2bc6501d75c
Author: SATOH Fumiyasu <fumiyas at osstech.co.jp>
Date: Mon Mar 26 19:13:12 2012 +0900
s3-docs: Prepend '/' to filename argument (Bug #8826)
-----------------------------------------------------------------------
Summary of changes:
docs-xml/manpages-3/smbcacls.1.xml | 2 +-
examples/VFS/skel_opaque.c | 5 ++++-
examples/VFS/skel_transparent.c | 6 ++++--
source3/include/vfs.h | 6 ++++--
source3/include/vfs_macros.h | 8 ++++----
source3/modules/vfs_default.c | 7 ++++---
source3/modules/vfs_full_audit.c | 6 ++++--
source3/modules/vfs_notify_fam.c | 9 +++++----
source3/modules/vfs_time_audit.c | 6 ++++--
source3/smbd/notify.c | 4 ++--
source3/smbd/notify_inotify.c | 25 +++++++++++++------------
source3/smbd/proto.h | 3 ++-
source3/smbd/vfs.c | 6 ++++--
13 files changed, 55 insertions(+), 38 deletions(-)
Changeset truncated at 500 lines:
diff --git a/docs-xml/manpages-3/smbcacls.1.xml b/docs-xml/manpages-3/smbcacls.1.xml
index 756000a..8674ecf 100644
--- a/docs-xml/manpages-3/smbcacls.1.xml
+++ b/docs-xml/manpages-3/smbcacls.1.xml
@@ -20,7 +20,7 @@
<cmdsynopsis>
<command>smbcacls</command>
<arg choice="req">//server/share</arg>
- <arg choice="req">filename</arg>
+ <arg choice="req">/filename</arg>
<arg choice="opt">-D|--delete acls</arg>
<arg choice="opt">-M|--modify acls</arg>
<arg choice="opt">-a|--add acls</arg>
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 7b67e56..5c97e23 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -383,7 +383,10 @@ static char *skel_realpath(vfs_handle_struct *handle, const char *path)
}
static NTSTATUS skel_notify_watch(struct vfs_handle_struct *handle,
- struct sys_notify_context *ctx, struct notify_entry *e,
+ struct sys_notify_context *ctx,
+ 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)
{
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 964ba6d..c57545c 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -360,13 +360,15 @@ static char *skel_realpath(vfs_handle_struct *handle, const char *path)
static NTSTATUS skel_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)
{
- return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, path, callback,
+ return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, path,
+ filter, subdir_filter, callback,
private_data, handle_p);
}
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index c038c56..212da7e 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -284,8 +284,9 @@ struct vfs_fn_pointers {
char *(*realpath_fn)(struct vfs_handle_struct *handle, const char *path);
NTSTATUS (*notify_watch_fn)(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),
@@ -676,8 +677,9 @@ int smb_vfs_call_mknod(struct vfs_handle_struct *handle, const char *path,
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,
+ 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/include/vfs_macros.h b/source3/include/vfs_macros.h
index 5e184e3..68165fe 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, 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_NOTIFY_WATCH(conn, ctx, path, filter, subdir_filter, callback, private_data, handle_p) \
+ smb_vfs_call_notify_watch((conn)->vfs_handles, (ctx), (path), (filter), (subdir_filter), (callback), (private_data), (handle_p))
+#define SMB_VFS_NEXT_NOTIFY_WATCH(conn, ctx, path, filter, subdir_filter, callback, private_data, handle_p) \
+ smb_vfs_call_notify_watch((conn)->next, (ctx), (path), (filter), (subdir_filter), (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 7b80df8..568f346 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1632,8 +1632,9 @@ 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,
+ uint32_t *filter,
+ uint32_t *subdir_filter,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
@@ -1649,8 +1650,8 @@ static NTSTATUS vfswrap_notify_watch(vfs_handle_struct *vfs_handle,
*/
#ifdef HAVE_INOTIFY
if (lp_kernel_change_notify(vfs_handle->conn->params)) {
- return inotify_watch(ctx, e, path, callback, private_data,
- handle);
+ return inotify_watch(ctx, path, filter, subdir_filter,
+ callback, private_data, handle);
}
#endif
/*
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 24c2f8e..770d21f 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -1379,8 +1379,9 @@ 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,
+ uint32_t *filter,
+ uint32_t *subdir_filter,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
@@ -1388,7 +1389,8 @@ static NTSTATUS smb_full_audit_notify_watch(struct vfs_handle_struct *handle,
{
NTSTATUS result;
- result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, path, callback,
+ result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, path,
+ filter, subdir_filter, 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 7ac6609..dcc843f 100644
--- a/source3/modules/vfs_notify_fam.c
+++ b/source3/modules/vfs_notify_fam.c
@@ -221,8 +221,9 @@ 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,
+ uint32_t *filter,
+ uint32_t *subdir_filter,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
@@ -234,8 +235,8 @@ static NTSTATUS fam_watch(vfs_handle_struct *vfs_handle,
struct fam_watch_context *watch;
void **handle = (void **)handle_p;
- if ((e->filter & fam_mask) == 0) {
- DEBUG(10, ("filter = %u, ignoring in FAM\n", e->filter));
+ if ((*filter & fam_mask) == 0) {
+ DEBUG(10, ("filter = %u, ignoring in FAM\n", *filter));
return NT_STATUS_OK;
}
@@ -274,7 +275,7 @@ static NTSTATUS fam_watch(vfs_handle_struct *vfs_handle,
*/
watch->filter = fam_mask;
- e->filter &= ~fam_mask;
+ *filter &= ~fam_mask;
DLIST_ADD(fam_notify_list, watch);
talloc_set_destructor(watch, fam_watch_context_destructor);
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index 8ec434b..0066e07 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -1130,8 +1130,9 @@ 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,
+ uint32_t *filter,
+ uint32_t *subdir_filter,
void (*callback)(struct sys_notify_context *ctx,
void *private_data,
struct notify_event *ev),
@@ -1142,7 +1143,8 @@ 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, path, callback,
+ result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, path,
+ filter, subdir_filter, 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 53ae2d6..fd9e552 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 a074d01..20f7098 100644
--- a/source3/smbd/notify_inotify.c
+++ b/source3/smbd/notify_inotify.c
@@ -328,14 +328,14 @@ static const struct {
{FILE_NOTIFY_CHANGE_SECURITY, IN_ATTRIB}
};
-static uint32_t inotify_map(struct notify_entry *e)
+static uint32_t inotify_map(uint32_t *filter)
{
int i;
uint32_t out=0;
for (i=0;i<ARRAY_SIZE(inotify_mapping);i++) {
- if (inotify_mapping[i].notify_mask & e->filter) {
+ if (inotify_mapping[i].notify_mask & *filter) {
out |= inotify_mapping[i].inotify_mask;
- e->filter &= ~inotify_mapping[i].notify_mask;
+ *filter &= ~inotify_mapping[i].notify_mask;
}
}
return out;
@@ -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 filter = e->filter;
+ uint32_t orig_filter = *filter;
void **handle = (void **)handle_p;
/* maybe setup the inotify fd */
@@ -395,31 +396,31 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
in = talloc_get_type(ctx->private_data, struct inotify_private);
- mask = inotify_map(e);
+ mask = inotify_map(filter);
if (mask == 0) {
/* this filter can't be handled by inotify */
return NT_STATUS_INVALID_PARAMETER;
}
/* using IN_MASK_ADD allows us to cope with inotify() returning the same
- watch descriptor for muliple watches on the same path */
+ watch descriptor for multiple watches on the same path */
mask |= (IN_MASK_ADD | IN_ONLYDIR);
/* get a new watch descriptor for this path */
wd = inotify_add_watch(in->fd, path, mask);
if (wd == -1) {
- e->filter = 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 = filter;
+ *filter = orig_filter;
return NT_STATUS_NO_MEMORY;
}
@@ -428,11 +429,11 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
w->callback = callback;
w->private_data = private_data;
w->mask = mask;
- w->filter = filter;
+ w->filter = orig_filter;
w->path = talloc_strdup(w, path);
if (w->path == NULL) {
inotify_rm_watch(in->fd, wd);
- e->filter = filter;
+ *filter = orig_filter;
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 70c34ce..4bb57c0 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 6b7b869..4c5e52b 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);
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list