[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Wed Mar 21 07:27:03 MDT 2012
The branch, master has been updated
via f3fe536 s3: Move the notify_ctx to the smbd_server_connection
via 7dcc2bf s3: Remove "conn" param from notify_init()
via 91f7725 s3: Remove "conn" param from sys_notify_context_create
via 6a2bf12 s3: Remove "conn" from sys_notify_context
via 8e256a2 s3: Pass "conn" to sys_notify_watch()
via 8044db0 s3: Pass "conn" to notify_add()
via 4319076 s3: Pass "path" through vfs_notify_watch
from 06db3bf waf: Add autoconf --target support.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit f3fe53668f5f42123ab4d91de23ac4f16bf12733
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 21 12:18:09 2012 +0100
s3: Move the notify_ctx to the smbd_server_connection
We only need one notify_ctx per smbd. The notify_array can become quite large.
It's based on absolute paths, so there's no point in having a copy of the
complete array in memory multiple times.
Autobuild-User: Volker Lendecke <vl at samba.org>
Autobuild-Date: Wed Mar 21 14:26:07 CET 2012 on sn-devel-104
commit 7dcc2bf7af10c6bf5f714b43ca81083fa1bea0b9
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 21 11:59:27 2012 +0100
s3: Remove "conn" param from notify_init()
commit 91f77253e70d8b41f21f62282a7a876a731a795b
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 21 11:55:55 2012 +0100
s3: Remove "conn" param from sys_notify_context_create
commit 6a2bf12f6a95fcff747f28ea5089c6e93b26643c
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 21 11:52:27 2012 +0100
s3: Remove "conn" from sys_notify_context
commit 8e256a2734bed8785c5fe919a442627050e70af9
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 21 11:47:50 2012 +0100
s3: Pass "conn" to sys_notify_watch()
commit 8044db0a4d625598bbd4cf676efc74525d0000c3
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 21 11:47:50 2012 +0100
s3: Pass "conn" to notify_add()
commit 4319076ccaf3e6264207a88b88dea0fa63b31879
Author: Volker Lendecke <vl at samba.org>
Date: Mon Mar 19 21:57:50 2012 +0100
s3: Pass "path" through vfs_notify_watch
-----------------------------------------------------------------------
Summary of changes:
examples/VFS/skel_transparent.c | 16 ++++++++++------
source3/include/smb.h | 2 --
source3/include/vfs.h | 2 ++
source3/include/vfs_macros.h | 8 ++++----
source3/modules/vfs_default.c | 6 ++++--
source3/modules/vfs_full_audit.c | 4 +++-
source3/modules/vfs_notify_fam.c | 4 +++-
source3/modules/vfs_time_audit.c | 3 ++-
source3/smbd/files.c | 6 ++++--
source3/smbd/globals.h | 1 +
source3/smbd/notify.c | 18 ++++++++++--------
source3/smbd/notify_inotify.c | 5 +++--
source3/smbd/notify_internal.c | 15 ++++++---------
source3/smbd/proto.h | 12 +++++++-----
source3/smbd/service.c | 11 ++++++-----
source3/smbd/vfs.c | 3 ++-
16 files changed, 67 insertions(+), 49 deletions(-)
Changeset truncated at 500 lines:
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index b384790..964ba6d 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/smb.h b/source3/include/smb.h
index 382926c..a12ca54 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -192,7 +192,6 @@ struct notify_change_request;
struct sys_notify_backend;
struct sys_notify_context {
struct event_context *ev;
- struct connection_struct *conn;
void *private_data; /* For use by the system backend */
};
@@ -428,7 +427,6 @@ typedef struct connection_struct {
name_compare_entry *aio_write_behind_list; /* Per-share list of files to use aio write behind on. */
struct dfree_cached_info *dfree_info;
struct trans_state *pending_trans;
- struct notify_context *notify_ctx;
struct rpc_pipe_client *spoolss_pipe;
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 62f9d10..c038c56 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 3bfda9f..5e184e3 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 1dbd308..7b80df8 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),
@@ -1647,8 +1648,9 @@ static NTSTATUS vfswrap_notify_watch(vfs_handle_struct *vfs_handle,
* Until that is the case, hard-code inotify here.
*/
#ifdef HAVE_INOTIFY
- if (lp_kernel_change_notify(ctx->conn->params)) {
- return inotify_watch(ctx, e, callback, private_data, handle);
+ if (lp_kernel_change_notify(vfs_handle->conn->params)) {
+ 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 3efa848..24c2f8e 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 3431494..8a3487b 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 734625e..8ec434b 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/files.c b/source3/smbd/files.c
index 10a0b81..6499a81 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -447,11 +447,13 @@ void file_free(struct smb_request *req, files_struct *fsp)
}
if (fsp->notify) {
+ struct notify_context *notify_ctx =
+ fsp->conn->sconn->notify_ctx;
if (fsp->is_directory) {
- notify_remove_onelevel(fsp->conn->notify_ctx,
+ notify_remove_onelevel(notify_ctx,
&fsp->file_id, fsp);
}
- notify_remove(fsp->conn->notify_ctx, fsp);
+ notify_remove(notify_ctx, fsp);
TALLOC_FREE(fsp->notify);
}
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index caf7357..3973855 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -449,6 +449,7 @@ struct smbd_server_connection {
const char *remote_hostname;
struct tevent_context *ev_ctx;
struct messaging_context *msg_ctx;
+ struct notify_context *notify_ctx;
struct {
bool got_session;
} nbt;
diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c
index 534ed84..8228c75 100644
--- a/source3/smbd/notify.c
+++ b/source3/smbd/notify.c
@@ -221,7 +221,8 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
e.subdir_filter = filter;
}
- status = notify_add(fsp->conn->notify_ctx, &e, notify_callback, fsp);
+ status = notify_add(fsp->conn->sconn->notify_ctx, fsp->conn, &e,
+ notify_callback, fsp);
TALLOC_FREE(fullpath);
return status;
@@ -363,6 +364,7 @@ void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
const char *path)
{
+ struct notify_context *notify_ctx = conn->sconn->notify_ctx;
char *fullpath;
char *parent;
const char *name;
@@ -377,7 +379,7 @@ void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
smb_fname_parent.base_name = parent;
if (SMB_VFS_STAT(conn, &smb_fname_parent) != -1) {
- notify_onelevel(conn->notify_ctx, action, filter,
+ notify_onelevel(notify_ctx, action, filter,
SMB_VFS_FILE_ID_CREATE(conn, &smb_fname_parent.st),
name);
}
@@ -389,7 +391,7 @@ void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
DEBUG(0, ("asprintf failed\n"));
return;
}
- notify_trigger(conn->notify_ctx, action, filter, fullpath);
+ notify_trigger(notify_ctx, action, filter, fullpath);
TALLOC_FREE(fullpath);
}
@@ -529,8 +531,7 @@ char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32 filter)
return result;
}
-struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
- TALLOC_CTX *mem_ctx,
+struct sys_notify_context *sys_notify_context_create(TALLOC_CTX *mem_ctx,
struct event_context *ev)
{
struct sys_notify_context *ctx;
@@ -541,19 +542,20 @@ struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
}
ctx->ev = ev;
- ctx->conn = conn;
ctx->private_data = NULL;
return ctx;
}
NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
+ connection_struct *conn,
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(conn, ctx, e, path, callback,
+ private_data, handle);
}
diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c
index bccd093..a074d01 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 906f767..63b7865 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -86,15 +86,10 @@ static int notify_destructor(struct notify_context *notify)
*/
struct notify_context *notify_init(TALLOC_CTX *mem_ctx,
struct messaging_context *messaging_ctx,
- struct event_context *ev,
- connection_struct *conn)
+ struct event_context *ev)
{
struct notify_context *notify;
- if (!lp_change_notify(conn->params)) {
- return NULL;
- }
-
notify = talloc(mem_ctx, struct notify_context);
if (notify == NULL) {
return NULL;
@@ -132,7 +127,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx,
messaging_register(notify->messaging_ctx, notify,
MSG_PVFS_NOTIFY, notify_handler);
- notify->sys_notify_ctx = sys_notify_context_create(conn, notify, ev);
+ notify->sys_notify_ctx = sys_notify_context_create(notify, ev);
return notify;
}
@@ -505,7 +500,8 @@ static void notify_add_onelevel(struct notify_context *notify,
add a notify watch. This is called when a notify is first setup on a open
directory handle.
*/
-NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
+NTSTATUS notify_add(struct notify_context *notify, connection_struct *conn,
+ struct notify_entry *e0,
void (*callback)(void *, const struct notify_event *),
void *private_data)
{
@@ -538,7 +534,8 @@ 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, conn,
+ &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 0fbf9a0..ee91e94 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -519,11 +519,12 @@ void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
const char *path);
char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32 filter);
-struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
- TALLOC_CTX *mem_ctx,
+struct sys_notify_context *sys_notify_context_create(TALLOC_CTX *mem_ctx,
struct event_context *ev);
NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
+ connection_struct *conn,
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),
@@ -543,10 +545,10 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
struct notify_context *notify_init(TALLOC_CTX *mem_ctx,
struct messaging_context *messaging_ctx,
- struct event_context *ev,
- connection_struct *conn);
+ struct event_context *ev);
bool notify_internal_parent_init(TALLOC_CTX *mem_ctx);
-NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
+NTSTATUS notify_add(struct notify_context *notify, connection_struct *conn,
+ struct notify_entry *e0,
void (*callback)(void *, const struct notify_event *),
void *private_data);
NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index a78fa29..d28a51a 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -697,11 +697,12 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
/* Any error exit after here needs to call the disconnect hook. */
on_err_call_dis_hook = true;
- if ((!conn->printer) && (!conn->ipc)) {
- conn->notify_ctx = notify_init(conn,
- sconn->msg_ctx,
- sconn->ev_ctx,
- conn);
+ if ((!conn->printer) && (!conn->ipc) &&
+ lp_change_notify(conn->params) &&
+ sconn->notify_ctx == NULL) {
+ sconn->notify_ctx = notify_init(sconn,
+ sconn->msg_ctx,
+ sconn->ev_ctx);
}
/*
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 7da3881..6b7b869 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);
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list