svn commit: samba r14793 - in branches/SAMBA_4_0/source/ntvfs/posix: .

tridge at samba.org tridge at samba.org
Thu Mar 30 02:06:08 GMT 2006


Author: tridge
Date: 2006-03-30 02:06:06 +0000 (Thu, 30 Mar 2006)
New Revision: 14793

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14793

Log:

the RAW-NOTIFY test now passes. Next I need to make it efficient, and
add the hooks in all the other places


Modified:
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_notify.c
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_notify.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_notify.c	2006-03-30 01:09:46 UTC (rev 14792)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_notify.c	2006-03-30 02:06:06 UTC (rev 14793)
@@ -41,20 +41,9 @@
 };
 
 /*
-  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 @@
 
 	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 @@
 	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 @@
 		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 @@
 	
 	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 @@
 		return NT_STATUS_OK;
 	}
 
-	pvfs_notify_send(f->notify_buffer);
+	pvfs_notify_send(f->notify_buffer, NT_STATUS_OK);
 
 	return NT_STATUS_OK;
 }

Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c	2006-03-30 01:09:46 UTC (rev 14792)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c	2006-03-30 02:06:06 UTC (rev 14793)
@@ -730,6 +730,8 @@
 	/* 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:



More information about the samba-cvs mailing list