mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s3: Pass "path" through vfs_notify_watch
This commit is contained in:
parent
06db3bfa37
commit
4319076cca
@ -357,12 +357,16 @@ static char *skel_realpath(vfs_handle_struct *handle, const char *path)
|
|||||||
return SMB_VFS_NEXT_REALPATH(handle, path);
|
return SMB_VFS_NEXT_REALPATH(handle, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS skel_notify_watch(struct vfs_handle_struct *handle,
|
static NTSTATUS skel_notify_watch(
|
||||||
struct sys_notify_context *ctx, struct notify_entry *e,
|
struct vfs_handle_struct *handle,
|
||||||
void (*callback)(struct sys_notify_context *ctx, void *private_data, struct notify_event *ev),
|
struct sys_notify_context *ctx,
|
||||||
void *private_data, void *handle_p)
|
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, callback,
|
return SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, path, callback,
|
||||||
private_data, handle_p);
|
private_data, handle_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,6 +285,7 @@ struct vfs_fn_pointers {
|
|||||||
NTSTATUS (*notify_watch_fn)(struct vfs_handle_struct *handle,
|
NTSTATUS (*notify_watch_fn)(struct vfs_handle_struct *handle,
|
||||||
struct sys_notify_context *ctx,
|
struct sys_notify_context *ctx,
|
||||||
struct notify_entry *e,
|
struct notify_entry *e,
|
||||||
|
const char *path,
|
||||||
void (*callback)(struct sys_notify_context *ctx,
|
void (*callback)(struct sys_notify_context *ctx,
|
||||||
void *private_data,
|
void *private_data,
|
||||||
struct notify_event *ev),
|
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,
|
NTSTATUS smb_vfs_call_notify_watch(struct vfs_handle_struct *handle,
|
||||||
struct sys_notify_context *ctx,
|
struct sys_notify_context *ctx,
|
||||||
struct notify_entry *e,
|
struct notify_entry *e,
|
||||||
|
const char *name,
|
||||||
void (*callback)(struct sys_notify_context *ctx,
|
void (*callback)(struct sys_notify_context *ctx,
|
||||||
void *private_data,
|
void *private_data,
|
||||||
struct notify_event *ev),
|
struct notify_event *ev),
|
||||||
|
@ -313,10 +313,10 @@
|
|||||||
#define SMB_VFS_NEXT_REALPATH(handle, path) \
|
#define SMB_VFS_NEXT_REALPATH(handle, path) \
|
||||||
smb_vfs_call_realpath((handle)->next, (path))
|
smb_vfs_call_realpath((handle)->next, (path))
|
||||||
|
|
||||||
#define SMB_VFS_NOTIFY_WATCH(conn, 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), (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, 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), (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) \
|
#define SMB_VFS_CHFLAGS(conn, path, flags) \
|
||||||
smb_vfs_call_chflags((conn)->vfs_handles, (path), (flags))
|
smb_vfs_call_chflags((conn)->vfs_handles, (path), (flags))
|
||||||
|
@ -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,
|
static NTSTATUS vfswrap_notify_watch(vfs_handle_struct *vfs_handle,
|
||||||
struct sys_notify_context *ctx,
|
struct sys_notify_context *ctx,
|
||||||
struct notify_entry *e,
|
struct notify_entry *e,
|
||||||
|
const char *path,
|
||||||
void (*callback)(struct sys_notify_context *ctx,
|
void (*callback)(struct sys_notify_context *ctx,
|
||||||
void *private_data,
|
void *private_data,
|
||||||
struct notify_event *ev),
|
struct notify_event *ev),
|
||||||
@ -1648,7 +1649,8 @@ static NTSTATUS vfswrap_notify_watch(vfs_handle_struct *vfs_handle,
|
|||||||
*/
|
*/
|
||||||
#ifdef HAVE_INOTIFY
|
#ifdef HAVE_INOTIFY
|
||||||
if (lp_kernel_change_notify(ctx->conn->params)) {
|
if (lp_kernel_change_notify(ctx->conn->params)) {
|
||||||
return inotify_watch(ctx, e, callback, private_data, handle);
|
return inotify_watch(ctx, e, path, callback, private_data,
|
||||||
|
handle);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
|
@ -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,
|
static NTSTATUS smb_full_audit_notify_watch(struct vfs_handle_struct *handle,
|
||||||
struct sys_notify_context *ctx,
|
struct sys_notify_context *ctx,
|
||||||
struct notify_entry *e,
|
struct notify_entry *e,
|
||||||
|
const char *path,
|
||||||
void (*callback)(struct sys_notify_context *ctx,
|
void (*callback)(struct sys_notify_context *ctx,
|
||||||
void *private_data,
|
void *private_data,
|
||||||
struct notify_event *ev),
|
struct notify_event *ev),
|
||||||
@ -1387,7 +1388,8 @@ static NTSTATUS smb_full_audit_notify_watch(struct vfs_handle_struct *handle,
|
|||||||
{
|
{
|
||||||
NTSTATUS result;
|
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, "");
|
do_log(SMB_VFS_OP_NOTIFY_WATCH, NT_STATUS_IS_OK(result), handle, "");
|
||||||
|
|
||||||
|
@ -222,6 +222,7 @@ static int fam_watch_context_destructor(struct fam_watch_context *ctx)
|
|||||||
static NTSTATUS fam_watch(vfs_handle_struct *vfs_handle,
|
static NTSTATUS fam_watch(vfs_handle_struct *vfs_handle,
|
||||||
struct sys_notify_context *ctx,
|
struct sys_notify_context *ctx,
|
||||||
struct notify_entry *e,
|
struct notify_entry *e,
|
||||||
|
const char *path,
|
||||||
void (*callback)(struct sys_notify_context *ctx,
|
void (*callback)(struct sys_notify_context *ctx,
|
||||||
void *private_data,
|
void *private_data,
|
||||||
struct notify_event *ev),
|
struct notify_event *ev),
|
||||||
@ -259,7 +260,8 @@ static NTSTATUS fam_watch(vfs_handle_struct *vfs_handle,
|
|||||||
watch->private_data = private_data;
|
watch->private_data = private_data;
|
||||||
watch->sys_ctx = ctx;
|
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"));
|
DEBUG(0, ("talloc_asprintf failed\n"));
|
||||||
TALLOC_FREE(watch);
|
TALLOC_FREE(watch);
|
||||||
return NT_STATUS_NO_MEMORY;
|
return NT_STATUS_NO_MEMORY;
|
||||||
|
@ -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,
|
static NTSTATUS smb_time_audit_notify_watch(struct vfs_handle_struct *handle,
|
||||||
struct sys_notify_context *ctx,
|
struct sys_notify_context *ctx,
|
||||||
struct notify_entry *e,
|
struct notify_entry *e,
|
||||||
|
const char *path,
|
||||||
void (*callback)(struct sys_notify_context *ctx,
|
void (*callback)(struct sys_notify_context *ctx,
|
||||||
void *private_data,
|
void *private_data,
|
||||||
struct notify_event *ev),
|
struct notify_event *ev),
|
||||||
@ -1141,7 +1142,7 @@ static NTSTATUS smb_time_audit_notify_watch(struct vfs_handle_struct *handle,
|
|||||||
double timediff;
|
double timediff;
|
||||||
|
|
||||||
clock_gettime_mono(&ts1);
|
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);
|
private_data, handle_p);
|
||||||
clock_gettime_mono(&ts2);
|
clock_gettime_mono(&ts2);
|
||||||
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
|
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
|
||||||
|
@ -548,12 +548,13 @@ struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
|
|||||||
|
|
||||||
NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
|
NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
|
||||||
struct notify_entry *e,
|
struct notify_entry *e,
|
||||||
|
const char *path,
|
||||||
void (*callback)(struct sys_notify_context *ctx,
|
void (*callback)(struct sys_notify_context *ctx,
|
||||||
void *private_data,
|
void *private_data,
|
||||||
struct notify_event *ev),
|
struct notify_event *ev),
|
||||||
void *private_data, void *handle)
|
void *private_data, void *handle)
|
||||||
{
|
{
|
||||||
return SMB_VFS_NOTIFY_WATCH(ctx->conn, ctx, e, callback, private_data,
|
return SMB_VFS_NOTIFY_WATCH(ctx->conn, ctx, e, path, callback,
|
||||||
handle);
|
private_data, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,6 +372,7 @@ static int watch_destructor(struct inotify_watch_context *w)
|
|||||||
*/
|
*/
|
||||||
NTSTATUS inotify_watch(struct sys_notify_context *ctx,
|
NTSTATUS inotify_watch(struct sys_notify_context *ctx,
|
||||||
struct notify_entry *e,
|
struct notify_entry *e,
|
||||||
|
const char *path,
|
||||||
void (*callback)(struct sys_notify_context *ctx,
|
void (*callback)(struct sys_notify_context *ctx,
|
||||||
void *private_data,
|
void *private_data,
|
||||||
struct notify_event *ev),
|
struct notify_event *ev),
|
||||||
@ -405,7 +406,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
|
|||||||
mask |= (IN_MASK_ADD | IN_ONLYDIR);
|
mask |= (IN_MASK_ADD | IN_ONLYDIR);
|
||||||
|
|
||||||
/* get a new watch descriptor for this path */
|
/* 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) {
|
if (wd == -1) {
|
||||||
e->filter = filter;
|
e->filter = filter;
|
||||||
DEBUG(1, ("inotify_add_watch returned %s\n", strerror(errno)));
|
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->private_data = private_data;
|
||||||
w->mask = mask;
|
w->mask = mask;
|
||||||
w->filter = filter;
|
w->filter = filter;
|
||||||
w->path = talloc_strdup(w, e->path);
|
w->path = talloc_strdup(w, path);
|
||||||
if (w->path == NULL) {
|
if (w->path == NULL) {
|
||||||
inotify_rm_watch(in->fd, wd);
|
inotify_rm_watch(in->fd, wd);
|
||||||
e->filter = filter;
|
e->filter = filter;
|
||||||
|
@ -538,7 +538,7 @@ NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
|
|||||||
this call will modify e.filter and e.subdir_filter
|
this call will modify e.filter and e.subdir_filter
|
||||||
to remove bits handled by the backend
|
to remove bits handled by the backend
|
||||||
*/
|
*/
|
||||||
status = sys_notify_watch(notify->sys_notify_ctx, &e,
|
status = sys_notify_watch(notify->sys_notify_ctx, &e, e.path,
|
||||||
sys_notify_callback, listel,
|
sys_notify_callback, listel,
|
||||||
&listel->sys_notify_handle);
|
&listel->sys_notify_handle);
|
||||||
if (NT_STATUS_IS_OK(status)) {
|
if (NT_STATUS_IS_OK(status)) {
|
||||||
|
@ -524,6 +524,7 @@ struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
|
|||||||
struct event_context *ev);
|
struct event_context *ev);
|
||||||
NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
|
NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
|
||||||
struct notify_entry *e,
|
struct notify_entry *e,
|
||||||
|
const char *path,
|
||||||
void (*callback)(struct sys_notify_context *ctx,
|
void (*callback)(struct sys_notify_context *ctx,
|
||||||
void *private_data,
|
void *private_data,
|
||||||
struct notify_event *ev),
|
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,
|
NTSTATUS inotify_watch(struct sys_notify_context *ctx,
|
||||||
struct notify_entry *e,
|
struct notify_entry *e,
|
||||||
|
const char *path,
|
||||||
void (*callback)(struct sys_notify_context *ctx,
|
void (*callback)(struct sys_notify_context *ctx,
|
||||||
void *private_data,
|
void *private_data,
|
||||||
struct notify_event *ev),
|
struct notify_event *ev),
|
||||||
|
@ -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,
|
NTSTATUS smb_vfs_call_notify_watch(struct vfs_handle_struct *handle,
|
||||||
struct sys_notify_context *ctx,
|
struct sys_notify_context *ctx,
|
||||||
struct notify_entry *e,
|
struct notify_entry *e,
|
||||||
|
const char *path,
|
||||||
void (*callback)(struct sys_notify_context *ctx,
|
void (*callback)(struct sys_notify_context *ctx,
|
||||||
void *private_data,
|
void *private_data,
|
||||||
struct notify_event *ev),
|
struct notify_event *ev),
|
||||||
void *private_data, void *handle_p)
|
void *private_data, void *handle_p)
|
||||||
{
|
{
|
||||||
VFS_FIND(notify_watch);
|
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);
|
private_data, handle_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user