2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Tridgell 2006
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 abstract the various kernel interfaces to change notify into a
23 single Samba friendly interface
27 #include "system/filesys.h"
28 #include "ntvfs/sysdep/sys_notify.h"
29 #include "lib/events/events.h"
30 #include "dlinklist.h"
32 /* list of registered backends */
33 static struct sys_notify_backend *backends;
37 initialise a system change notify backend
39 struct sys_notify_context *sys_notify_init(int snum,
41 struct event_context *ev)
43 struct sys_notify_context *ctx;
45 struct sys_notify_backend *b;
47 if (backends == NULL) {
52 ev = event_context_find(mem_ctx);
55 ctx = talloc_zero(mem_ctx, struct sys_notify_context);
62 bname = lp_parm_string(snum, "notify", "backend");
64 bname = backends->name;
67 for (b=backends;b;b=b->next) {
68 if (strcasecmp(b->name, bname) == 0) break;
73 ctx->notify_watch = b->notify_watch;
82 NTSTATUS sys_notify_watch(struct sys_notify_context *ctx, const char *dirpath,
83 uint32_t filter, sys_notify_callback_t callback,
84 void *private, void **handle)
86 return ctx->notify_watch(ctx, dirpath, filter, callback, private, handle);
90 register a notify backend
92 NTSTATUS sys_notify_register(struct sys_notify_backend *backend)
94 DLIST_ADD(backends, backend);