diff options
Diffstat (limited to 'source4/ntvfs/sysdep')
-rw-r--r-- | source4/ntvfs/sysdep/config.m4 | 4 | ||||
-rw-r--r-- | source4/ntvfs/sysdep/config.mk | 28 | ||||
-rw-r--r-- | source4/ntvfs/sysdep/inotify.c | 2 | ||||
-rw-r--r-- | source4/ntvfs/sysdep/sys_notify.c | 27 | ||||
-rw-r--r-- | source4/ntvfs/sysdep/sys_notify.h | 9 |
5 files changed, 47 insertions, 23 deletions
diff --git a/source4/ntvfs/sysdep/config.m4 b/source4/ntvfs/sysdep/config.m4 index f67a3bdace..372e6b5bd5 100644 --- a/source4/ntvfs/sysdep/config.m4 +++ b/source4/ntvfs/sysdep/config.m4 @@ -1,7 +1,7 @@ AC_CHECK_HEADERS(linux/inotify.h asm/unistd.h) AC_CHECK_FUNC(inotify_init) -SMB_ENABLE(ntvfs_inotify, NO) +SMB_ENABLE(sys_notify_inotify, NO) if test x"$ac_cv_header_linux_inotify_h" = x"yes"; then - SMB_ENABLE(ntvfs_inotify, YES) + SMB_ENABLE(sys_notify_inotify, YES) fi diff --git a/source4/ntvfs/sysdep/config.mk b/source4/ntvfs/sysdep/config.mk index 3bcebb5c0e..3b3681adef 100644 --- a/source4/ntvfs/sysdep/config.mk +++ b/source4/ntvfs/sysdep/config.mk @@ -1,20 +1,22 @@ ################################################ -# Start MODULE ntvfs_sys_notify -[MODULE::ntvfs_sys_notify] -SUBSYSTEM = ntvfs +# Start MODULE sys_notify_inotify +[MODULE::sys_notify_inotify] +SUBSYSTEM = sys_notify +INIT_FUNCTION = sys_notify_inotify_init OBJ_FILES = \ - sys_notify.o -# End MODULE ntvfs_sys_notify + inotify.o +# End MODULE sys_notify_inotify ################################################ - ################################################ -# Start MODULE ntvfs_inotify -[MODULE::ntvfs_inotify] -SUBSYSTEM = ntvfs -INIT_FUNCTION = ntvfs_inotify_init +# Start SUBSYSTEM sys_notify +[LIBRARY::sys_notify] +PUBLIC_HEADERS = sys_notify.h +VERSION = 0.0.1 +SO_VERSION = 0 +DESCRIPTION = File System Notify Abstraction Layer OBJ_FILES = \ - inotify.o -# End MODULE ntvfs_inotify + sys_notify.o +REQUIRED_SUBSYSTEMS = +# End SUBSYSTEM sys_notify ################################################ - diff --git a/source4/ntvfs/sysdep/inotify.c b/source4/ntvfs/sysdep/inotify.c index f86e3c1913..33c4ff4928 100644 --- a/source4/ntvfs/sysdep/inotify.c +++ b/source4/ntvfs/sysdep/inotify.c @@ -405,7 +405,7 @@ static struct sys_notify_backend inotify = { /* initialialise the inotify module */ -NTSTATUS ntvfs_inotify_init(void) +NTSTATUS sys_notify_inotify_init(void) { /* register ourselves as a system inotify module */ return sys_notify_register(&inotify); diff --git a/source4/ntvfs/sysdep/sys_notify.c b/source4/ntvfs/sysdep/sys_notify.c index 13c8f4359a..a74312f32b 100644 --- a/source4/ntvfs/sysdep/sys_notify.c +++ b/source4/ntvfs/sysdep/sys_notify.c @@ -28,6 +28,7 @@ #include "ntvfs/sysdep/sys_notify.h" #include "lib/events/events.h" #include "dlinklist.h" +#include "build.h" /* list of registered backends */ static struct sys_notify_backend *backends; @@ -36,9 +37,9 @@ static uint32_t num_backends; /* initialise a system change notify backend */ -struct sys_notify_context *sys_notify_init(int snum, - TALLOC_CTX *mem_ctx, - struct event_context *ev) +struct sys_notify_context *sys_notify_context_create(int snum, + TALLOC_CTX *mem_ctx, + struct event_context *ev) { struct sys_notify_context *ctx; const char *bname; @@ -115,3 +116,23 @@ NTSTATUS sys_notify_register(struct sys_notify_backend *backend) num_backends++; return NT_STATUS_OK; } + +NTSTATUS sys_notify_init(void) +{ + static BOOL initialized = False; + + init_module_fn static_init[] = STATIC_sys_notify_MODULES; + init_module_fn *shared_init; + + if (initialized) return NT_STATUS_OK; + initialized = True; + + shared_init = load_samba_modules(NULL, "sys_notify"); + + run_init_functions(static_init); + run_init_functions(shared_init); + + talloc_free(shared_init); + + return NT_STATUS_OK; +} diff --git a/source4/ntvfs/sysdep/sys_notify.h b/source4/ntvfs/sysdep/sys_notify.h index 9cb01a1db4..6f8e91efec 100644 --- a/source4/ntvfs/sysdep/sys_notify.h +++ b/source4/ntvfs/sysdep/sys_notify.h @@ -26,7 +26,7 @@ typedef void (*sys_notify_callback_t)(struct sys_notify_context *, void *, struct notify_event *ev); typedef NTSTATUS (*notify_watch_t)(struct sys_notify_context *ctx, - struct notify_event *e, + struct notify_entry *e, sys_notify_callback_t callback, void *private, void **handle); @@ -43,9 +43,10 @@ struct sys_notify_backend { }; NTSTATUS sys_notify_register(struct sys_notify_backend *backend); -struct sys_notify_context *sys_notify_init(int snum, - TALLOC_CTX *mem_ctx, - struct event_context *ev); +struct sys_notify_context *sys_notify_context_create(int snum, + TALLOC_CTX *mem_ctx, + struct event_context *ev); NTSTATUS sys_notify_watch(struct sys_notify_context *ctx, struct notify_entry *e, sys_notify_callback_t callback, void *private, void **handle); +NTSTATUS sys_notify_init(void); |