svn commit: samba r3227 - in branches/SAMBA_4_0/source: ntvfs/posix param

tridge at samba.org tridge at samba.org
Tue Oct 26 00:59:07 GMT 2004


Author: tridge
Date: 2004-10-26 00:59:06 +0000 (Tue, 26 Oct 2004)
New Revision: 3227

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source&rev=3227&nolog=1

Log:
added a per-share option "case insensitive filesystem", that tells the
backend that the underlying filesystem is case insensitive, so it can
bypass the directory search if the name is not found.

Modified:
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_shortname.c
   branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.c
   branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h
   branches/SAMBA_4_0/source/param/loadparm.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c	2004-10-25 23:39:07 UTC (rev 3226)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c	2004-10-26 00:59:06 UTC (rev 3227)
@@ -125,6 +125,18 @@
 			}
 			continue;
 		}
+
+		/* the filesystem might be case insensitive, in which
+		   case a search is pointless unless the name is
+		   mangled */
+		if ((pvfs->flags & PVFS_FLAG_CI_FILESYSTEM) &&
+		    !pvfs_is_mangled_component(pvfs, components[i])) {
+			if (i < num_components-1) {
+				return NT_STATUS_OBJECT_PATH_NOT_FOUND;
+			}
+			partial_name = test_name;
+			continue;
+		}
 		
 		dir = opendir(partial_name);
 		if (!dir) {
@@ -319,12 +331,6 @@
 		return pvfs_fill_dos_info(pvfs, *name);
 	}
 
-	/* the filesystem might be case insensitive, in which
-	   case a search is pointless */
-	if (pvfs->flags & PVFS_FLAG_CI_FILESYSTEM) {
-		return NT_STATUS_OK;
-	}
-
 	/* search for a matching filename */
 	status = pvfs_case_search(pvfs, *name);
 

Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_shortname.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_shortname.c	2004-10-25 23:39:07 UTC (rev 3226)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_shortname.c	2004-10-26 00:59:06 UTC (rev 3227)
@@ -237,7 +237,7 @@
 	}
 	
 	/* and the last part ... */
-	return is_mangled_component(ctx, s,strlen(s));
+	return is_mangled_component(ctx, s, strlen(s));
 }
 
 
@@ -301,7 +301,8 @@
 	/* the length are all OK. Now check to see if the characters themselves are OK */
 	for (i=0; name[i]; i++) {
 		/* note that we may allow wildcard petterns! */
-		if (!FLAG_CHECK(name[i], FLAG_ASCII|(allow_wildcards ? FLAG_WILDCARD : 0)) && name[i] != '.') {
+		if (!FLAG_CHECK(name[i], FLAG_ASCII|(allow_wildcards ? FLAG_WILDCARD : 0)) && 
+		    name[i] != '.') {
 			return False;
 		}
 	}
@@ -686,3 +687,13 @@
 {
 	return is_reserved_name(pvfs->mangle_ctx, name);
 }
+
+
+/*
+  see if a component of a filename could be a mangled name from our
+  mangling code
+*/
+BOOL pvfs_is_mangled_component(struct pvfs_state *pvfs, const char *name)
+{
+	return is_mangled_component(pvfs->mangle_ctx, name, strlen(name));
+}

Modified: branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.c	2004-10-25 23:39:07 UTC (rev 3226)
+++ branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.c	2004-10-26 00:59:06 UTC (rev 3227)
@@ -41,6 +41,7 @@
 	if (lp_readonly(snum))       pvfs->flags |= PVFS_FLAG_READONLY;
 	if (lp_strict_sync(snum))    pvfs->flags |= PVFS_FLAG_STRICT_SYNC;
 	if (lp_strict_locking(snum)) pvfs->flags |= PVFS_FLAG_STRICT_LOCKING;
+	if (lp_ci_filesystem(snum))  pvfs->flags |= PVFS_FLAG_CI_FILESYSTEM;
 
 	pvfs->share_name = talloc_strdup(pvfs, lp_servicename(snum));
 }

Modified: branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h	2004-10-25 23:39:07 UTC (rev 3226)
+++ branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h	2004-10-26 00:59:06 UTC (rev 3227)
@@ -94,8 +94,7 @@
 	struct pvfs_dir *dir;
 };
 
-/* open file state - this is a temporary implementation
-   to allow some tests to work */
+/* open file state */
 struct pvfs_file {
 	struct pvfs_file *next, *prev;
 	int fd;

Modified: branches/SAMBA_4_0/source/param/loadparm.c
===================================================================
--- branches/SAMBA_4_0/source/param/loadparm.c	2004-10-25 23:39:07 UTC (rev 3226)
+++ branches/SAMBA_4_0/source/param/loadparm.c	2004-10-26 00:59:06 UTC (rev 3227)
@@ -272,6 +272,7 @@
 	BOOL bMSDfsRoot;
 	BOOL bShareModes;
 	BOOL bStrictSync;
+	BOOL bCIFileSystem;
 	struct param_opt *param_opt;
 
 	char dummy[3];		/* for alignment */
@@ -330,6 +331,7 @@
 	False,			/* bMSDfsRoot */
 	True,			/* bShareModes */
 	False,			/* bStrictSync */
+	False,			/* bCIFileSystem */
 	NULL,			/* Parametric options */
 
 	""			/* dummy */
@@ -623,6 +625,7 @@
 
 	{"name cache timeout", P_INTEGER, P_GLOBAL, &Globals.name_cache_timeout, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
 	{"strict sync", P_BOOL, P_LOCAL, &sDefault.bStrictSync, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE}, 
+	{"case insensitive filesystem", P_BOOL, P_LOCAL, &sDefault.bCIFileSystem, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE}, 
 
 	{"Printing Options", P_SEP, P_SEPARATOR},
 	
@@ -1253,6 +1256,7 @@
 FN_LOCAL_BOOL(lp_strict_locking, bStrictLocking)
 FN_LOCAL_BOOL(lp_posix_locking, bPosixLocking)
 FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
+FN_LOCAL_BOOL(lp_ci_filesystem, bCIFileSystem)
 FN_LOCAL_BOOL(lp_share_modes, bShareModes)
 FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
 FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
@@ -2444,6 +2448,11 @@
 		return lp_do_parameter_parametric(-1, pszParmName, pszParmValue, FLAG_CMDLINE);
 	}
 
+	if (parmnum < 0) {
+		DEBUG(0,("Unknown option '%s'\n", pszParmName));
+		return False;
+	}
+
 	/* reset the CMDLINE flag in case this has been called before */
 	parm_table[parmnum].flags &= ~FLAG_CMDLINE;
 



More information about the samba-cvs mailing list