summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-03-30 02:06:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:59:19 -0500
commit8a95fa446e1eca4c9ff332202f23183411b44c04 (patch)
tree3748a12271b1948ea6a9528aa5b4872470d145f2 /source4
parent33f663b25206c6cc4b2c33dfca3983d9dfee73dc (diff)
downloadsamba-8a95fa446e1eca4c9ff332202f23183411b44c04.tar.gz
samba-8a95fa446e1eca4c9ff332202f23183411b44c04.tar.bz2
samba-8a95fa446e1eca4c9ff332202f23183411b44c04.zip
r14793: the RAW-NOTIFY test now passes. Next I need to make it efficient, and
add the hooks in all the other places (This used to be commit d1937589029ac2a75d15f006685769c44a274a65)
Diffstat (limited to 'source4')
-rw-r--r--source4/ntvfs/posix/pvfs_notify.c46
-rw-r--r--source4/ntvfs/posix/pvfs_open.c2
2 files changed, 28 insertions, 20 deletions
diff --git a/source4/ntvfs/posix/pvfs_notify.c b/source4/ntvfs/posix/pvfs_notify.c
index 55a9767863..01a88f25a7 100644
--- a/source4/ntvfs/posix/pvfs_notify.c
+++ b/source4/ntvfs/posix/pvfs_notify.c
@@ -41,20 +41,9 @@ struct pvfs_notify_buffer {
};
/*
- destroy a notify buffer. Called when the handle is closed
- */
-static int pvfs_notify_destructor(void *ptr)
-{
- struct pvfs_notify_buffer *n = talloc_get_type(ptr, struct pvfs_notify_buffer);
- notify_remove(n->f->pvfs->notify_context, n);
- n->f->notify_buffer = NULL;
- return 0;
-}
-
-/*
send a reply to a pending notify request
*/
-static void pvfs_notify_send(struct pvfs_notify_buffer *notify_buffer)
+static void pvfs_notify_send(struct pvfs_notify_buffer *notify_buffer, NTSTATUS status)
{
struct ntvfs_request *req = notify_buffer->req;
struct smb_notify *info = notify_buffer->info;
@@ -70,14 +59,27 @@ static void pvfs_notify_send(struct pvfs_notify_buffer *notify_buffer)
DEBUG(0,("sending %d changes\n", info->out.num_changes));
- if (info->out.num_changes == 0) {
- req->async_states->status = NT_STATUS_CANCELLED;
- } else {
- req->async_states->status = NT_STATUS_OK;
+ if (info->out.num_changes != 0) {
+ status = NT_STATUS_OK;
}
+
+ req->async_states->status = status;
req->async_states->send_fn(req);
}
+/*
+ destroy a notify buffer. Called when the handle is closed
+ */
+static int pvfs_notify_destructor(void *ptr)
+{
+ struct pvfs_notify_buffer *n = talloc_get_type(ptr, struct pvfs_notify_buffer);
+ notify_remove(n->f->pvfs->notify_context, n);
+ n->f->notify_buffer = NULL;
+ if (n->req) {
+ pvfs_notify_send(n, NT_STATUS_OK);
+ }
+ return 0;
+}
/*
@@ -95,7 +97,7 @@ static void pvfs_notify_callback(void *private, const struct notify_event *ev)
DEBUG(0,("got notify for '%s' action=%d\n", ev->path, ev->action));
if (n->req != NULL) {
- pvfs_notify_send(n);
+ pvfs_notify_send(n, NT_STATUS_OK);
}
}
@@ -141,7 +143,11 @@ static void pvfs_notify_end(void *private, enum pvfs_wait_notice reason)
return;
}
- pvfs_notify_send(notify_buffer);
+ if (reason == PVFS_WAIT_CANCEL) {
+ pvfs_notify_send(notify_buffer, NT_STATUS_CANCELLED);
+ } else {
+ pvfs_notify_send(notify_buffer, NT_STATUS_OK);
+ }
}
/* change notify request - always async. This request blocks until the
@@ -184,7 +190,7 @@ NTSTATUS pvfs_notify(struct ntvfs_module_context *ntvfs,
if (f->notify_buffer->req != NULL) {
DEBUG(0,("Notify already setup\n"));
- pvfs_notify_send(f->notify_buffer);
+ pvfs_notify_send(f->notify_buffer, NT_STATUS_CANCELLED);
}
f->notify_buffer->req = talloc_reference(f->notify_buffer, req);
@@ -200,7 +206,7 @@ NTSTATUS pvfs_notify(struct ntvfs_module_context *ntvfs,
return NT_STATUS_OK;
}
- pvfs_notify_send(f->notify_buffer);
+ pvfs_notify_send(f->notify_buffer, NT_STATUS_OK);
return NT_STATUS_OK;
}
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index 1b1c32cab5..38123c3a9e 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -730,6 +730,8 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
/* success - keep the file handle */
talloc_steal(pvfs, f);
+ notify_trigger(pvfs->notify_context, NOTIFY_ACTION_ADDED, name->full_name);
+
return NT_STATUS_OK;
cleanup_delete: