svn commit: samba r21108 - in branches/SAMBA_3_0/source: include modules smbd

vlendec at samba.org vlendec at samba.org
Thu Feb 1 13:36:03 GMT 2007


Author: vlendec
Date: 2007-02-01 13:36:02 +0000 (Thu, 01 Feb 2007)
New Revision: 21108

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21108

Log:
Send sys_notify_watch through the VFS, FAM is next
Modified:
   branches/SAMBA_3_0/source/include/smb.h
   branches/SAMBA_3_0/source/include/vfs.h
   branches/SAMBA_3_0/source/include/vfs_macros.h
   branches/SAMBA_3_0/source/modules/vfs_default.c
   branches/SAMBA_3_0/source/smbd/notify.c
   branches/SAMBA_3_0/source/smbd/notify_internal.c
   branches/SAMBA_3_0/source/smbd/service.c


Changeset:
Modified: branches/SAMBA_3_0/source/include/smb.h
===================================================================
--- branches/SAMBA_3_0/source/include/smb.h	2007-02-01 12:36:21 UTC (rev 21107)
+++ branches/SAMBA_3_0/source/include/smb.h	2007-02-01 13:36:02 UTC (rev 21108)
@@ -446,10 +446,13 @@
 };
 
 struct notify_mid_map;
+struct notify_entry;
+struct notify_event;
 struct sys_notify_backend;
 struct sys_notify_context {
 	struct event_context *ev;
-	void *private_data;
+	struct connection_struct *conn;
+	void *private_data; 	/* For use by the system backend */
 };
 
 struct notify_change_request {

Modified: branches/SAMBA_3_0/source/include/vfs.h
===================================================================
--- branches/SAMBA_3_0/source/include/vfs.h	2007-02-01 12:36:21 UTC (rev 21107)
+++ branches/SAMBA_3_0/source/include/vfs.h	2007-02-01 13:36:02 UTC (rev 21108)
@@ -152,6 +152,7 @@
 	SMB_VFS_OP_LINK,
 	SMB_VFS_OP_MKNOD,
 	SMB_VFS_OP_REALPATH,
+	SMB_VFS_OP_NOTIFY_WATCH,
 
 	/* NT ACL operations. */
 
@@ -275,6 +276,13 @@
 		int (*link)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
 		int (*mknod)(struct vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev);
 		char *(*realpath)(struct vfs_handle_struct *handle, const char *path, char *resolved_path);
+		NTSTATUS (*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);
 		
 		/* NT ACL operations. */
 		
@@ -390,6 +398,7 @@
 		struct vfs_handle_struct *link;
 		struct vfs_handle_struct *mknod;
 		struct vfs_handle_struct *realpath;
+		struct vfs_handle_struct *notify_watch;
 
 		/* NT ACL operations. */
 

Modified: branches/SAMBA_3_0/source/include/vfs_macros.h
===================================================================
--- branches/SAMBA_3_0/source/include/vfs_macros.h	2007-02-01 12:36:21 UTC (rev 21107)
+++ branches/SAMBA_3_0/source/include/vfs_macros.h	2007-02-01 13:36:02 UTC (rev 21108)
@@ -77,6 +77,7 @@
 #define SMB_VFS_LINK(conn, oldpath, newpath) ((conn)->vfs.ops.link((conn)->vfs.handles.link, (oldpath), (newpath)))
 #define SMB_VFS_MKNOD(conn, path, mode, dev) ((conn)->vfs.ops.mknod((conn)->vfs.handles.mknod, (path), (mode), (dev)))
 #define SMB_VFS_REALPATH(conn, path, resolved_path) ((conn)->vfs.ops.realpath((conn)->vfs.handles.realpath, (path), (resolved_path)))
+#define SMB_VFS_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs.ops.notify_watch((conn)->vfs.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p)))
 
 /* NT ACL operations. */
 #define SMB_VFS_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc)))
@@ -190,6 +191,7 @@
 #define SMB_VFS_OPAQUE_LINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.link((conn)->vfs_opaque.handles.link, (oldpath), (newpath)))
 #define SMB_VFS_OPAQUE_MKNOD(conn, path, mode, dev) ((conn)->vfs_opaque.ops.mknod((conn)->vfs_opaque.handles.mknod, (path), (mode), (dev)))
 #define SMB_VFS_OPAQUE_REALPATH(conn, path, resolved_path) ((conn)->vfs_opaque.ops.realpath((conn)->vfs_opaque.handles.realpath, (path), (resolved_path)))
+#define SMB_VFS_OPAQUE_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs_opaque.ops.notify_watch((conn)->vfs_opaque.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p)))
 
 /* NT ACL operations. */
 #define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, fd, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc)))
@@ -304,6 +306,7 @@
 #define SMB_VFS_NEXT_LINK(handle, oldpath, newpath) ((handle)->vfs_next.ops.link((handle)->vfs_next.handles.link, (oldpath), (newpath)))
 #define SMB_VFS_NEXT_MKNOD(handle, path, mode, dev) ((handle)->vfs_next.ops.mknod((handle)->vfs_next.handles.mknod, (path), (mode), (dev)))
 #define SMB_VFS_NEXT_REALPATH(handle, path, resolved_path) ((handle)->vfs_next.ops.realpath((handle)->vfs_next.handles.realpath, (path), (resolved_path)))
+#define SMB_VFS_NEXT_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs_next.ops.notify_watch((conn)->vfs_next.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p)))
 
 /* NT ACL operations. */
 #define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (fd), (security_info), (ppdesc)))

Modified: branches/SAMBA_3_0/source/modules/vfs_default.c
===================================================================
--- branches/SAMBA_3_0/source/modules/vfs_default.c	2007-02-01 12:36:21 UTC (rev 21107)
+++ branches/SAMBA_3_0/source/modules/vfs_default.c	2007-02-01 13:36:02 UTC (rev 21108)
@@ -833,6 +833,21 @@
 	return result;
 }
 
+static NTSTATUS vfswrap_notify_watch(vfs_handle_struct *vfs_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)
+{
+#ifdef HAVE_INOTIFY
+	return inotify_watch(ctx, e, callback, private_data, handle);
+#else
+	return NT_STATUS_OK;
+#endif
+}
+
 static size_t vfswrap_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, uint32 security_info, SEC_DESC **ppdesc)
 {
 	size_t result;
@@ -1212,6 +1227,8 @@
 	 SMB_VFS_LAYER_OPAQUE},
 	{SMB_VFS_OP(vfswrap_realpath),	SMB_VFS_OP_REALPATH,
 	 SMB_VFS_LAYER_OPAQUE},
+	{SMB_VFS_OP(vfswrap_notify_watch),	SMB_VFS_OP_NOTIFY_WATCH,
+	 SMB_VFS_LAYER_OPAQUE},
 
 	/* NT ACL operations. */
 

Modified: branches/SAMBA_3_0/source/smbd/notify.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/notify.c	2007-02-01 12:36:21 UTC (rev 21107)
+++ branches/SAMBA_3_0/source/smbd/notify.c	2007-02-01 13:36:02 UTC (rev 21108)
@@ -400,7 +400,7 @@
 	return result;
 }
 
-struct sys_notify_context *sys_notify_context_create(struct share_params *scfg,
+struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
 						     TALLOC_CTX *mem_ctx, 
 						     struct event_context *ev)
 {
@@ -412,6 +412,7 @@
 	}
 
 	ctx->ev = ev;
+	ctx->conn = conn;
 	ctx->private_data = NULL;
 	return ctx;
 }
@@ -423,10 +424,7 @@
 					   struct notify_event *ev),
 			  void *private_data, void *handle)
 {
-#ifdef HAVE_INOTIFY
-	return inotify_watch(ctx, e, callback, private_data, handle);
-#else
-	return NT_STATUS_OK;
-#endif
+	return SMB_VFS_NOTIFY_WATCH(ctx->conn, ctx, e, callback, private_data,
+				    handle);
 }
 

Modified: branches/SAMBA_3_0/source/smbd/notify_internal.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/notify_internal.c	2007-02-01 12:36:21 UTC (rev 21107)
+++ branches/SAMBA_3_0/source/smbd/notify_internal.c	2007-02-01 13:36:02 UTC (rev 21108)
@@ -73,11 +73,12 @@
 struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, 
 				   struct messaging_context *messaging_ctx,
 				   struct event_context *ev,
-				   struct share_params *scfg)
+				   connection_struct *conn)
 {
 	struct notify_context *notify;
 
-	if (!lp_parm_bool(scfg->service, "notify", "enable", True)) {
+	if (!lp_parm_bool(conn->params->service, "notify", "enable",
+			  True)) {
 		return NULL;
 	}
 
@@ -107,7 +108,7 @@
 	messaging_register(notify->messaging_ctx, notify, 
 			   MSG_PVFS_NOTIFY, notify_handler);
 
-	notify->sys_notify_ctx = sys_notify_context_create(scfg, notify, ev);
+	notify->sys_notify_ctx = sys_notify_context_create(conn, notify, ev);
 
 	return notify;
 }

Modified: branches/SAMBA_3_0/source/smbd/service.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/service.c	2007-02-01 12:36:21 UTC (rev 21107)
+++ branches/SAMBA_3_0/source/smbd/service.c	2007-02-01 13:36:02 UTC (rev 21108)
@@ -950,7 +950,7 @@
 		conn->notify_ctx = notify_init(conn->mem_ctx, server_id_self(),
 					       smbd_messaging_context(),
 					       smbd_event_context(),
-					       conn->params);
+					       conn);
 	}
 
 /* ROOT Activities: */	



More information about the samba-cvs mailing list