svn commit: samba r21090 - in branches/SAMBA_3_0/source: smbd torture

vlendec at samba.org vlendec at samba.org
Wed Jan 31 14:28:08 GMT 2007


Author: vlendec
Date: 2007-01-31 14:28:08 +0000 (Wed, 31 Jan 2007)
New Revision: 21090

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

Log:
Add some helper routines
Modified:
   branches/SAMBA_3_0/source/smbd/notify.c
   branches/SAMBA_3_0/source/smbd/server.c
   branches/SAMBA_3_0/source/torture/vfstest.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/notify.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/notify.c	2007-01-31 14:24:29 UTC (rev 21089)
+++ branches/SAMBA_3_0/source/smbd/notify.c	2007-01-31 14:28:08 UTC (rev 21090)
@@ -521,6 +521,44 @@
 	}
 }
 
+char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32 filter)
+{
+	char *result = NULL;
+
+	result = talloc_strdup(mem_ctx, "");
+
+	if (filter & FILE_NOTIFY_CHANGE_FILE_NAME)
+		result = talloc_asprintf_append(result, "FILE_NAME|");
+	if (filter & FILE_NOTIFY_CHANGE_DIR_NAME)
+		result = talloc_asprintf_append(result, "DIR_NAME|");
+	if (filter & FILE_NOTIFY_CHANGE_ATTRIBUTES)
+		result = talloc_asprintf_append(result, "ATTRIBUTES|");
+	if (filter & FILE_NOTIFY_CHANGE_SIZE)
+		result = talloc_asprintf_append(result, "SIZE|");
+	if (filter & FILE_NOTIFY_CHANGE_LAST_WRITE)
+		result = talloc_asprintf_append(result, "LAST_WRITE|");
+	if (filter & FILE_NOTIFY_CHANGE_LAST_ACCESS)
+		result = talloc_asprintf_append(result, "LAST_ACCESS|");
+	if (filter & FILE_NOTIFY_CHANGE_CREATION)
+		result = talloc_asprintf_append(result, "CREATION|");
+	if (filter & FILE_NOTIFY_CHANGE_EA)
+		result = talloc_asprintf_append(result, "EA|");
+	if (filter & FILE_NOTIFY_CHANGE_SECURITY)
+		result = talloc_asprintf_append(result, "SECURITY|");
+	if (filter & FILE_NOTIFY_CHANGE_STREAM_NAME)
+		result = talloc_asprintf_append(result, "STREAM_NAME|");
+	if (filter & FILE_NOTIFY_CHANGE_STREAM_SIZE)
+		result = talloc_asprintf_append(result, "STREAM_SIZE|");
+	if (filter & FILE_NOTIFY_CHANGE_STREAM_WRITE)
+		result = talloc_asprintf_append(result, "STREAM_WRITE|");
+
+	if (result == NULL) return NULL;
+	if (*result == '\0') return result;
+
+	result[strlen(result)-1] = '\0';
+	return result;
+}
+
 /****************************************************************************
  Initialise the change notify subsystem.
 ****************************************************************************/

Modified: branches/SAMBA_3_0/source/smbd/server.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/server.c	2007-01-31 14:24:29 UTC (rev 21089)
+++ branches/SAMBA_3_0/source/smbd/server.c	2007-01-31 14:28:08 UTC (rev 21090)
@@ -71,6 +71,17 @@
 	return ctx;
 }
 
+struct messaging_context *smbd_messaging_context(void)
+{
+	static struct messaging_context *ctx;
+
+	if (!ctx && !(ctx = messaging_init(NULL, server_id_self(),
+					   smbd_event_context()))) {
+		smb_panic("Could not init smbd messaging context\n");
+	}
+	return ctx;
+}
+
 /*******************************************************************
  What to do when smb.conf is updated.
  ********************************************************************/

Modified: branches/SAMBA_3_0/source/torture/vfstest.c
===================================================================
--- branches/SAMBA_3_0/source/torture/vfstest.c	2007-01-31 14:24:29 UTC (rev 21089)
+++ branches/SAMBA_3_0/source/torture/vfstest.c	2007-01-31 14:28:08 UTC (rev 21090)
@@ -489,6 +489,17 @@
 	return ctx;
 }
 
+struct messaging_context *smbd_messaging_context(void)
+{
+	static struct messaging_context *ctx;
+
+	if (!ctx && !(ctx = messaging_init(NULL, server_id_self(),
+					   smbd_event_context()))) {
+		smb_panic("Could not init smbd messaging context\n");
+	}
+	return ctx;
+}
+
 /* Main function */
 
 int main(int argc, char *argv[])



More information about the samba-cvs mailing list