svn commit: samba r14797 - in branches/SAMBA_4_0/source/ntvfs: common posix

tridge at samba.org tridge at samba.org
Thu Mar 30 03:51:50 GMT 2006


Author: tridge
Date: 2006-03-30 03:51:49 +0000 (Thu, 30 Mar 2006)
New Revision: 14797

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

Log:

added checking of the filter in notify requests



Modified:
   branches/SAMBA_4_0/source/ntvfs/common/notify.c
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_mkdir.c
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_read.c
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_unlink.c
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_write.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/common/notify.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/common/notify.c	2006-03-30 03:14:38 UTC (rev 14796)
+++ branches/SAMBA_4_0/source/ntvfs/common/notify.c	2006-03-30 03:51:49 UTC (rev 14797)
@@ -322,12 +322,16 @@
   see if a notify event matches
 */
 static BOOL notify_match(struct notify_context *notify, struct notify_entry *e,
-			 const char *path, uint32_t action)
+			 const char *path, uint32_t filter)
 {
-	size_t len = strlen(e->path);
+	size_t len;
 
-	/* TODO: check action */
+	if (!(filter & e->filter)) {
+		return False;
+	}
 
+	len = strlen(e->path);
+
 	if (strncmp(path, e->path, len) != 0) {
 		return False;
 	}
@@ -379,7 +383,7 @@
   trigger a notify message for anyone waiting on a matching event
 */
 void notify_trigger(struct notify_context *notify,
-		    uint32_t action, const char *path)
+		    uint32_t action, uint32_t filter, const char *path)
 {
 	NTSTATUS status;
 	int i;
@@ -391,7 +395,7 @@
 
 	/* this needs to be changed to a log(n) search */
 	for (i=0;i<notify->array->num_entries;i++) {
-		if (notify_match(notify, &notify->array->entries[i], path, action)) {
+		if (notify_match(notify, &notify->array->entries[i], path, filter)) {
 			notify_send(notify, &notify->array->entries[i], 
 				    path + strlen(notify->array->entries[i].path) + 1, 
 				    action);

Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_mkdir.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_mkdir.c	2006-03-30 03:14:38 UTC (rev 14796)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_mkdir.c	2006-03-30 03:51:49 UTC (rev 14797)
@@ -83,7 +83,10 @@
 		return status;
 	}
 
-	notify_trigger(pvfs->notify_context, NOTIFY_ACTION_ADDED, name->full_name);
+	notify_trigger(pvfs->notify_context, 
+		       NOTIFY_ACTION_ADDED, 
+		       FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME,
+		       name->full_name);
 
 	return NT_STATUS_OK;
 }
@@ -137,7 +140,10 @@
 		return status;
 	}
 
-	notify_trigger(pvfs->notify_context, NOTIFY_ACTION_ADDED, name->full_name);
+	notify_trigger(pvfs->notify_context, 
+		       NOTIFY_ACTION_ADDED, 
+		       FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME,
+		       name->full_name);
 
 	return NT_STATUS_OK;
 }
@@ -176,7 +182,10 @@
 		return pvfs_map_errno(pvfs, errno);
 	}
 
-	notify_trigger(pvfs->notify_context, NOTIFY_ACTION_REMOVED, name->full_name);
+	notify_trigger(pvfs->notify_context, 
+		       NOTIFY_ACTION_REMOVED, 
+		       FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME,
+		       name->full_name);
 
 	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 03:14:38 UTC (rev 14796)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_open.c	2006-03-30 03:51:49 UTC (rev 14797)
@@ -378,6 +378,11 @@
 		f->handle->have_opendb_entry = True;
 
 		create_action = NTCREATEX_ACTION_CREATED;
+
+		notify_trigger(pvfs->notify_context, 
+			       NOTIFY_ACTION_REMOVED, 
+			       FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME,
+			       name->full_name);
 	} else {
 		create_action = NTCREATEX_ACTION_EXISTED;
 	}
@@ -461,6 +466,11 @@
 		if (unlink(path) != 0) {
 			DEBUG(0,("pvfs_close: failed to delete '%s' - %s\n", 
 				 path, strerror(errno)));
+		} else {
+			notify_trigger(h->pvfs->notify_context, 
+				       NOTIFY_ACTION_REMOVED, 
+				       FILE_NOTIFY_CHANGE_FILE_NAME,
+				       path);
 		}
 	}
 
@@ -730,7 +740,10 @@
 	/* success - keep the file handle */
 	talloc_steal(pvfs, f);
 
-	notify_trigger(pvfs->notify_context, NOTIFY_ACTION_ADDED, name->full_name);
+	notify_trigger(pvfs->notify_context, 
+		       NOTIFY_ACTION_ADDED, 
+		       FILE_NOTIFY_CHANGE_FILE_NAME,
+		       name->full_name);
 
 	return NT_STATUS_OK;
 

Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_read.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_read.c	2006-03-30 03:14:38 UTC (rev 14796)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_read.c	2006-03-30 03:51:49 UTC (rev 14797)
@@ -90,5 +90,10 @@
 	rd->readx.out.remaining = 0xFFFF;
 	rd->readx.out.compaction_mode = 0; 
 
+	notify_trigger(pvfs->notify_context, 
+		       NOTIFY_ACTION_MODIFIED, 
+		       FILE_NOTIFY_CHANGE_LAST_ACCESS,
+		       f->handle->name->full_name);
+
 	return NT_STATUS_OK;
 }

Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_unlink.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_unlink.c	2006-03-30 03:14:38 UTC (rev 14796)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_unlink.c	2006-03-30 03:51:49 UTC (rev 14797)
@@ -104,7 +104,9 @@
 	}
 
 	if (NT_STATUS_IS_OK(status)) {
-		notify_trigger(pvfs->notify_context, NOTIFY_ACTION_REMOVED, 
+		notify_trigger(pvfs->notify_context, 
+			       NOTIFY_ACTION_REMOVED, 
+			       FILE_NOTIFY_CHANGE_FILE_NAME,
 			       name->full_name);
 	}
 

Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_write.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_write.c	2006-03-30 03:14:38 UTC (rev 14796)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_write.c	2006-03-30 03:51:49 UTC (rev 14797)
@@ -84,6 +84,11 @@
 	
 	wr->writex.out.nwritten = ret;
 	wr->writex.out.remaining = 0; /* should fill this in? */
+
+	notify_trigger(pvfs->notify_context, 
+		       NOTIFY_ACTION_MODIFIED, 
+		       FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE,
+		       f->handle->name->full_name);
 	
 	return NT_STATUS_OK;
 }



More information about the samba-cvs mailing list