From b43b2e4f8a4be30e3f7aca6f570f5376fd508e3d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 27 Sep 2000 19:09:59 +0000 Subject: Restructuring of the code to remove dos_ChDir/dos_GetWd and re-vector them through the VFS. All file access/directory access code in smbd should now go via the vfs. Added vfs_chown/vfs_chmod calls. Still looking at vfs_get_nt_acl() vfs_set_nt_acl() call API design. Jeremy. (This used to be commit f96625ec124adb6e110dc54632e006b3620a962b) --- source3/lib/doscalls.c | 169 +++---------------------------------------------- source3/lib/util.c | 131 -------------------------------------- 2 files changed, 8 insertions(+), 292 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/doscalls.c b/source3/lib/doscalls.c index 2bd68d3097..50c446faeb 100644 --- a/source3/lib/doscalls.c +++ b/source3/lib/doscalls.c @@ -33,6 +33,7 @@ extern int DEBUGLEVEL; +#if 0 /* Use vfs_unlink. */ /******************************************************************* Unlink wrapper that calls dos_to_unix. ********************************************************************/ @@ -41,6 +42,7 @@ int dos_unlink(char *fname) { return(unlink(dos_to_unix(fname,False))); } +#endif /******************************************************************* Open() wrapper that calls dos_to_unix. @@ -85,10 +87,12 @@ char *dos_readdirname(DIR *p) A chown() wrapper that calls dos_to_unix. ********************************************************************/ +#if 0 /* Use vfs_chown. */ int dos_chown(char *fname, uid_t uid, gid_t gid) { return(sys_chown(dos_to_unix(fname,False),uid,gid)); } +#endif /******************************************************************* A stat() wrapper that calls dos_to_unix. @@ -134,6 +138,7 @@ int dos_rmdir(char *dname) return(rmdir(dos_to_unix(dname,False))); } +#if 0 /* VFS */ /******************************************************************* chdir() - call dos_to_unix. ********************************************************************/ @@ -142,6 +147,7 @@ int dos_chdir(char *dname) { return(chdir(dos_to_unix(dname,False))); } +#endif /******************************************************************* Utime() - call dos_to_unix. @@ -282,6 +288,7 @@ int dos_chmod(char *fname,mode_t mode) return(chmod(dos_to_unix(fname,False),mode)); } +#if 0 /* VFS */ /******************************************************************* Getwd - takes a UNIX directory name and returns the name in dos format. @@ -295,6 +302,7 @@ char *dos_getwd(char *unix_path) unix_to_dos(wd, True); return wd; } +#endif /* VFS */ /******************************************************************* Check if a DOS file exists. Use vfs_file_exist function instead. @@ -333,164 +341,3 @@ SMB_OFF_T dos_file_size(char *file_name) { return get_file_size(dos_to_unix(file_name, False)); } - -/******************************************************************* - A wrapper for dos_chdir(). -********************************************************************/ - -int dos_ChDir(char *path) -{ - int res; - static pstring LastDir=""; - - if (strcsequal(path,".")) - return(0); - - if (*path == '/' && strcsequal(LastDir,path)) - return(0); - - DEBUG(3,("dos_ChDir to %s\n",path)); - - res = dos_chdir(path); - if (!res) - pstrcpy(LastDir,path); - return(res); -} - -/* number of list structures for a caching GetWd function. */ -#define MAX_GETWDCACHE (50) - -struct -{ - SMB_DEV_T dev; /* These *must* be compatible with the types returned in a stat() call. */ - SMB_INO_T inode; /* These *must* be compatible with the types returned in a stat() call. */ - char *dos_path; /* The pathname in DOS format. */ - BOOL valid; -} ino_list[MAX_GETWDCACHE]; - -BOOL use_getwd_cache=True; - -/**************************************************************************** - Prompte a ptr (to make it recently used) -****************************************************************************/ - -static void array_promote(char *array,int elsize,int element) -{ - char *p; - if (element == 0) - return; - - p = (char *)malloc(elsize); - - if (!p) - { - DEBUG(5,("Ahh! Can't malloc\n")); - return; - } - memcpy(p,array + element * elsize, elsize); - memmove(array + elsize,array,elsize*element); - memcpy(array,p,elsize); - free(p); -} - -/******************************************************************* - Return the absolute current directory path - given a UNIX pathname. - Note that this path is returned in DOS format, not UNIX - format. -********************************************************************/ - -char *dos_GetWd(char *path) -{ - pstring s; - static BOOL getwd_cache_init = False; - SMB_STRUCT_STAT st, st2; - int i; - - *s = 0; - - if (!use_getwd_cache) - return(dos_getwd(path)); - - /* init the cache */ - if (!getwd_cache_init) - { - getwd_cache_init = True; - for (i=0;i