#include "includes.h"
#include "system/filesys.h"
#include "ntvfs/sysdep/sys_notify.h"
-#include "lib/events/events.h"
-#include "lib/util/dlinklist.h"
+#include <tevent.h>
+#include "../lib/util/dlinklist.h"
#include "param/param.h"
+#include "lib/util/samba_modules.h"
/* list of registered backends */
static struct sys_notify_backend *backends;
*/
_PUBLIC_ struct sys_notify_context *sys_notify_context_create(struct share_config *scfg,
TALLOC_CTX *mem_ctx,
- struct event_context *ev)
+ struct tevent_context *ev)
{
struct sys_notify_context *ctx;
const char *bname;
}
if (ev == NULL) {
- ev = event_context_find(mem_ctx);
+ return NULL;
}
ctx = talloc_zero(mem_ctx, struct sys_notify_context);
ctx->ev = ev;
- bname = share_string_option(scfg, NOTIFY_BACKEND, NULL);
+ bname = share_string_option(ctx, scfg, NOTIFY_BACKEND, NULL);
if (!bname) {
if (num_backends) {
bname = backends[0].name;
}
for (i=0;i<num_backends;i++) {
+ char *enable_opt_name;
+ bool enabled;
+
+ enable_opt_name = talloc_asprintf(mem_ctx, "notify:%s",
+ backends[i].name);
+ enabled = share_bool_option(scfg, enable_opt_name, true);
+ talloc_free(enable_opt_name);
+
+ if (!enabled)
+ continue;
+
if (strcasecmp(backends[i].name, bname) == 0) {
bname = backends[i].name;
break;
_PUBLIC_ NTSTATUS sys_notify_init(void)
{
static bool initialized = false;
- extern NTSTATUS sys_notify_inotify_init(void);
-
+#define _MODULE_PROTO(init) extern NTSTATUS init(TALLOC_CTX *);
+ STATIC_sys_notify_MODULES_PROTO;
init_module_fn static_init[] = { STATIC_sys_notify_MODULES };
if (initialized) return NT_STATUS_OK;
initialized = true;
- run_init_functions(static_init);
+ run_init_functions(NULL, static_init);
return NT_STATUS_OK;
}