summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-09-01 20:11:54 +0000
committerJeremy Allison <jra@samba.org>1998-09-01 20:11:54 +0000
commit18556274139cc5a00593471bd745354d98a35303 (patch)
treeb10b897359416e4c67bcaff75a5f21eefe20c996 /source3/lib
parent6f53e2097d60d4b67f0859065cfa0fe01d63e28f (diff)
downloadsamba-18556274139cc5a00593471bd745354d98a35303.tar.gz
samba-18556274139cc5a00593471bd745354d98a35303.tar.bz2
samba-18556274139cc5a00593471bd745354d98a35303.zip
More abstraction of file system data types, to move to a 64
bit file interface for the NT SMB's. Created a new define, SMB_STRUCT_STAT that currently is defined to be struct stat - this wil change to a user defined type containing 64 bit info when the correct wrappers are written for 64 bit stat(), fstat() and lstat() calls. Also changed all sys_xxxx() calls that were previously just wrappers to the same call prefixed by a dos_to_unix() call into dos_xxxx() calls. This makes it explicit when a pathname translation is being done, and when it is not. Now, all sys_xxx() calls are meant to be wrappers to mask OS differences, and not silently converting filenames on the fly. Jeremy. (This used to be commit 28aa182dbffaa4ffd86047e608400de4b26e80eb)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/charset.c2
-rw-r--r--source3/lib/debug.c2
-rw-r--r--source3/lib/genrand.c6
-rw-r--r--source3/lib/netatalk.c2
-rw-r--r--source3/lib/smbrun.c2
-rw-r--r--source3/lib/system.c44
-rw-r--r--source3/lib/time.c2
-rw-r--r--source3/lib/util.c26
8 files changed, 43 insertions, 43 deletions
diff --git a/source3/lib/charset.c b/source3/lib/charset.c
index abfa6fe787..55b76f2667 100644
--- a/source3/lib/charset.c
+++ b/source3/lib/charset.c
@@ -191,7 +191,7 @@ static codepage_p load_client_codepage( int client_codepage )
FILE *fp = NULL;
unsigned int size;
codepage_p cp_p = NULL;
- struct stat st;
+ SMB_STRUCT_STAT st;
DEBUG(5, ("load_client_codepage: loading codepage %d.\n", client_codepage));
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index c20229fcde..f5a0eadb96 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -249,7 +249,7 @@ void force_check_log_size( void )
static void check_log_size( void )
{
int maxlog;
- struct stat st;
+ SMB_STRUCT_STAT st;
if( debug_count++ < 100 || getuid() != 0 )
return;
diff --git a/source3/lib/genrand.c b/source3/lib/genrand.c
index 5e87275ce8..c36cdd4b8c 100644
--- a/source3/lib/genrand.c
+++ b/source3/lib/genrand.c
@@ -56,7 +56,7 @@ static void do_filehash(char *fname, unsigned char *hash)
static void do_dirrand(char *name, unsigned char *buf, int buf_len)
{
- void *dp = sys_opendir(name);
+ void *dp = dos_opendir(name);
pstring fullname;
int len_left;
int fullname_len;
@@ -81,12 +81,12 @@ static void do_dirrand(char *name, unsigned char *buf, int buf_len)
char *p;
while ((p = readdirname(dp))) {
- struct stat st;
+ SMB_STRUCT_STAT st;
if(strlen(p) <= len_left)
pstrcpy(pos, p);
- if(sys_stat(fullname,&st) == 0) {
+ if(dos_stat(fullname,&st) == 0) {
SIVAL(buf, ((counter * 4)%(buf_len-4)),
IVAL(buf,((counter * 4)%(buf_len-4))) ^ st.st_atime);
counter++;
diff --git a/source3/lib/netatalk.c b/source3/lib/netatalk.c
index a11676b1e6..421d74f3c5 100644
--- a/source3/lib/netatalk.c
+++ b/source3/lib/netatalk.c
@@ -82,7 +82,7 @@ int ntalk_mkresdir(const char *fname)
char fdir[255];
int i;
int lastslash;
- struct stat dirstats;
+ SMB_STRUCT_STAT dirstats;
char appledouble[] = APPLEDOUBLE;
/* find directory containing fname */
diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c
index fcb14378a0..56fcd68ec1 100644
--- a/source3/lib/smbrun.c
+++ b/source3/lib/smbrun.c
@@ -33,7 +33,7 @@ the child as it may leave the caller in a privilaged state.
static BOOL setup_stdout_file(char *outfile,BOOL shared)
{
int fd;
- struct stat st;
+ SMB_STRUCT_STAT st;
mode_t mode = S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH;
int flags = O_RDWR|O_CREAT|O_TRUNC|O_EXCL;
diff --git a/source3/lib/system.c b/source3/lib/system.c
index d569b80a74..d3612f8b25 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -141,36 +141,36 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
/*******************************************************************
-just a unlink wrapper
+just a unlink wrapper that calls dos_to_unix.
********************************************************************/
-int sys_unlink(char *fname)
+int dos_unlink(char *fname)
{
return(unlink(dos_to_unix(fname,False)));
}
/*******************************************************************
-a simple open() wrapper
+a simple open() wrapper that calls dos_to_unix.
********************************************************************/
-int sys_open(char *fname,int flags,int mode)
+int dos_open(char *fname,int flags,int mode)
{
return(open(dos_to_unix(fname,False),flags,mode));
}
/*******************************************************************
-a simple opendir() wrapper
+a simple opendir() wrapper that calls dos_to_unix
********************************************************************/
-DIR *sys_opendir(char *dname)
+DIR *dos_opendir(char *dname)
{
return(opendir(dos_to_unix(dname,False)));
}
/*******************************************************************
-and a stat() wrapper
+and a stat() wrapper that calls dos_to_unix.
********************************************************************/
-int sys_stat(char *fname,struct stat *sbuf)
+int dos_stat(char *fname,SMB_STRUCT_STAT *sbuf)
{
return(stat(dos_to_unix(fname,False),sbuf));
}
@@ -188,45 +188,45 @@ int sys_waitpid(pid_t pid,int *status,int options)
}
/*******************************************************************
-don't forget lstat()
+don't forget lstat() that calls dos_to_unix.
********************************************************************/
-int sys_lstat(char *fname,struct stat *sbuf)
+int dos_lstat(char *fname,struct stat *sbuf)
{
return(lstat(dos_to_unix(fname,False),sbuf));
}
/*******************************************************************
-mkdir() gets a wrapper
+mkdir() gets a wrapper that calls dos_to_unix.
********************************************************************/
-int sys_mkdir(char *dname,int mode)
+int dos_mkdir(char *dname,int mode)
{
return(mkdir(dos_to_unix(dname,False),mode));
}
/*******************************************************************
-do does rmdir()
+do does rmdir() - call dos_to_unix
********************************************************************/
-int sys_rmdir(char *dname)
+int dos_rmdir(char *dname)
{
return(rmdir(dos_to_unix(dname,False)));
}
/*******************************************************************
-I almost forgot chdir()
+I almost forgot chdir() - call dos_to_unix.
********************************************************************/
-int sys_chdir(char *dname)
+int dos_chdir(char *dname)
{
return(chdir(dos_to_unix(dname,False)));
}
/*******************************************************************
-now for utime()
+now for utime() - call dos_to_unix.
********************************************************************/
-int sys_utime(char *fname,struct utimbuf *times)
+int dos_utime(char *fname,struct utimbuf *times)
{
/* if the modtime is 0 or -1 then ignore the call and
return success */
@@ -344,9 +344,9 @@ static int copy_reg(char *source, const char *dest)
}
/*******************************************************************
-for rename()
+for rename() - call dos_to_unix.
********************************************************************/
-int sys_rename(char *from, char *to)
+int dos_rename(char *from, char *to)
{
int rcode;
pstring zfrom, zto;
@@ -364,9 +364,9 @@ int sys_rename(char *from, char *to)
}
/*******************************************************************
-for chmod
+for chmod - call dos_to_unix.
********************************************************************/
-int sys_chmod(char *fname,int mode)
+int dos_chmod(char *fname,int mode)
{
return(chmod(dos_to_unix(fname,False),mode));
}
diff --git a/source3/lib/time.c b/source3/lib/time.c
index 6eacf2a5ed..7b7ca51204 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -513,7 +513,7 @@ char *timestring(void )
structure.
****************************************************************************/
-time_t get_create_time(struct stat *st,BOOL fake_dirs)
+time_t get_create_time(SMB_STRUCT_STAT *st,BOOL fake_dirs)
{
time_t ret, ret1;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 619d474d6d..4187787489 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -520,12 +520,12 @@ int name_mangle( char *In, char *Out, char name_type )
/*******************************************************************
check if a file exists
********************************************************************/
-BOOL file_exist(char *fname,struct stat *sbuf)
+BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf)
{
- struct stat st;
+ SMB_STRUCT_STAT st;
if (!sbuf) sbuf = &st;
- if (sys_stat(fname,sbuf) != 0)
+ if (dos_stat(fname,sbuf) != 0)
return(False);
return(S_ISREG(sbuf->st_mode));
@@ -536,9 +536,9 @@ check a files mod time
********************************************************************/
time_t file_modtime(char *fname)
{
- struct stat st;
+ SMB_STRUCT_STAT st;
- if (sys_stat(fname,&st) != 0)
+ if (dos_stat(fname,&st) != 0)
return(0);
return(st.st_mtime);
@@ -547,14 +547,14 @@ time_t file_modtime(char *fname)
/*******************************************************************
check if a directory exists
********************************************************************/
-BOOL directory_exist(char *dname,struct stat *st)
+BOOL directory_exist(char *dname,SMB_STRUCT_STAT *st)
{
- struct stat st2;
+ SMB_STRUCT_STAT st2;
BOOL ret;
if (!st) st = &st2;
- if (sys_stat(dname,st) != 0)
+ if (dos_stat(dname,st) != 0)
return(False);
ret = S_ISDIR(st->st_mode);
@@ -568,9 +568,9 @@ returns the size in bytes of the named file
********************************************************************/
uint32 file_size(char *file_name)
{
- struct stat buf;
+ SMB_STRUCT_STAT buf;
buf.st_size = 0;
- sys_stat(file_name,&buf);
+ dos_stat(file_name,&buf);
return(buf.st_size);
}
@@ -1205,7 +1205,7 @@ int ChDir(char *path)
if (*path == '/' && strcsequal(LastDir,path)) return(0);
DEBUG(3,("chdir to %s\n",path));
- res = sys_chdir(path);
+ res = dos_chdir(path);
if (!res)
pstrcpy(LastDir,path);
return(res);
@@ -1233,7 +1233,7 @@ char *GetWd(char *str)
{
pstring s;
static BOOL getwd_cache_init = False;
- struct stat st, st2;
+ SMB_STRUCT_STAT st, st2;
int i;
*s = 0;
@@ -3270,7 +3270,7 @@ int set_filelen(int fd, long len)
#ifdef HAVE_FTRUNCATE_EXTEND
return ftruncate(fd, len);
#else
- struct stat st;
+ SMB_STRUCT_STAT st;
char c = 0;
long currpos = lseek(fd, 0L, SEEK_CUR);