From d836bedb4035acc61e83f1a0dc76df2c33dfc8af Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 7 Oct 1998 07:55:14 +0000 Subject: more OSF1 changes as well as changes to allow us to use the standard includes.h in wrapped.c, thus making porting much simpler (This used to be commit 6f2239c935fdecfefa89227c113df01e3957691a) --- source3/smbwrapper/realcalls.c | 1 - source3/smbwrapper/realcalls.h | 3 ++ source3/smbwrapper/smbw.c | 2 +- source3/smbwrapper/smbw_dir.c | 6 ++- source3/smbwrapper/smbw_stat.c | 1 - source3/smbwrapper/wrapped.c | 9 +++- source3/smbwrapper/wrapper.h | 100 ----------------------------------------- 7 files changed, 16 insertions(+), 106 deletions(-) (limited to 'source3/smbwrapper') diff --git a/source3/smbwrapper/realcalls.c b/source3/smbwrapper/realcalls.c index a453aff3ea..a7a4c75020 100644 --- a/source3/smbwrapper/realcalls.c +++ b/source3/smbwrapper/realcalls.c @@ -20,7 +20,6 @@ */ #include "includes.h" -#include "wrapper.h" #ifdef REPLACE_UTIME int real_utime(const char *name, struct utimbuf *buf) diff --git a/source3/smbwrapper/realcalls.h b/source3/smbwrapper/realcalls.h index 83c7cccf20..76e233bc9b 100644 --- a/source3/smbwrapper/realcalls.h +++ b/source3/smbwrapper/realcalls.h @@ -36,7 +36,10 @@ #define real_chmod(fn, mode) (syscall(SYS_chmod,(fn), (mode))) #define real_chown(fn, owner, group) (syscall(SYS_chown,(fn),(owner),(group))) +#ifdef SYS_getdents #define real_getdents(fd, dirp, count) (syscall(SYS_getdents, (fd), (dirp), (count))) +#endif + #define real_link(fn1, fn2) (syscall(SYS_link, (fn1), (fn2))) #define real_open(fn,flags,mode) (syscall(SYS_open, (fn), (flags), (mode))) diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c index a4d2033c49..9fd6ebd317 100644 --- a/source3/smbwrapper/smbw.c +++ b/source3/smbwrapper/smbw.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "wrapper.h" +#include "realcalls.h" pstring smbw_cwd; diff --git a/source3/smbwrapper/smbw_dir.c b/source3/smbwrapper/smbw_dir.c index f6d648b91f..37926b0407 100644 --- a/source3/smbwrapper/smbw_dir.c +++ b/source3/smbwrapper/smbw_dir.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "wrapper.h" +#include "realcalls.h" extern pstring smbw_cwd; extern fstring smbw_prefix; @@ -321,15 +321,19 @@ int smbw_getdents(unsigned int fd, struct dirent *dirp, int count) } while (count>=DIRP_SIZE && (dir->offset < dir->count)) { +#if HAVE_DIRENT_D_OFF dirp->d_off = (dir->offset+1)*DIRP_SIZE; +#endif dirp->d_reclen = DIRP_SIZE; fstrcpy(&dirp->d_name[0], dir->list[dir->offset].name); dirp->d_ino = smbw_inode(dir->list[dir->offset].name); dir->offset++; count -= dirp->d_reclen; +#if HAVE_DIRENT_D_OFF if (dir->offset == dir->count) { dirp->d_off = -1; } +#endif dirp = (struct dirent *)(((char *)dirp) + DIRP_SIZE); n++; } diff --git a/source3/smbwrapper/smbw_stat.c b/source3/smbwrapper/smbw_stat.c index a6d01f66d6..ec920eb176 100644 --- a/source3/smbwrapper/smbw_stat.c +++ b/source3/smbwrapper/smbw_stat.c @@ -20,7 +20,6 @@ */ #include "includes.h" -#include "wrapper.h" extern int DEBUGLEVEL; diff --git a/source3/smbwrapper/wrapped.c b/source3/smbwrapper/wrapped.c index 291da8301f..427075f1fe 100644 --- a/source3/smbwrapper/wrapped.c +++ b/source3/smbwrapper/wrapped.c @@ -23,7 +23,12 @@ /* we don't want prototypes for this code */ #define NO_PROTO -#include "wrapper.h" +#include "includes.h" + +#ifdef LINUX +#include "kernel_stat.h" +#endif +#include "realcalls.h" int open(const char *name, int flags, mode_t mode) { @@ -203,7 +208,7 @@ -#ifdef HAVE_GETDENTS +#ifdef real_getdents int getdents(int fd, struct dirent *dirp, unsigned int count) { if (smbw_fd(fd)) { diff --git a/source3/smbwrapper/wrapper.h b/source3/smbwrapper/wrapper.h index 3e7d754c9b..e69de29bb2 100644 --- a/source3/smbwrapper/wrapper.h +++ b/source3/smbwrapper/wrapper.h @@ -1,100 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 2.0 - SMB wrapper functions - definitions - Copyright (C) Andrew Tridgell 1998 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "config.h" - -#ifdef NO_PROTO -/* get rid of prototypes */ -#define _NO_PROTO - -#ifdef HAVE_SYS_CDEFS_H -#include -#ifdef __P -#undef __P -#define __P(x) () -#endif -#endif -#endif - - -#ifdef HAVE_SYSCALL_H -#include -#elif HAVE_SYS_SYSCALL_H -#include -#endif - -#ifdef HAVE_SYS_ACL_H -#include -#endif - -#ifdef HAVE_SYS_FCNTL_H -#include -#endif - -/* yuck! */ -#define DIRP_SIZE (256 + 32) - -#include -#include -#include -#include -#include -#include -#include -#ifdef LINUX -#include "kernel_stat.h" -#endif -#include "realcalls.h" - -int smbw_dirp(DIR *dirp); -int smbw_fd(int fd); -int smbw_dir_open(const char *fname); -int smbw_dir_close(int fd); -int smbw_stat(const char *fname, struct stat *st); -off_t smbw_dir_lseek(int fd, off_t offset, int whence); -int smbw_path(const char *path); -int smbw_open(const char *fname, int flags, mode_t mode); -int smbw_chdir(const char *name); -int smbw_close(int fd); -int smbw_fchdir(unsigned int fd); -int smbw_fcntl(int fd, int cmd, long arg); -int smbw_getdents(unsigned int fd, struct dirent *dirp, int count); -off_t smbw_lseek(int fd, off_t offset, int whence); -ssize_t smbw_read(int fd, void *buf, size_t count); -ssize_t smbw_write(int fd, void *buf, size_t count); -int smbw_access(const char *name, int mode); -int smbw_chmod(const char *fname, mode_t newmode); -int smbw_chown(const char *fname, uid_t owner, gid_t group); -int smbw_closedir(DIR *d); -int smbw_fstat(int fd, struct stat *st); -char *smbw_getcwd(char *buf, size_t size); -int smbw_stat(const char *fname, struct stat *st); -int smbw_mkdir(const char *fname, mode_t mode); -void smbw_seekdir(DIR *d, off_t offset); -off_t smbw_telldir(DIR *d); -int smbw_unlink(const char *fname); -int smbw_utime(const char *fname,void *buf); -DIR *smbw_opendir(const char *fname); -struct dirent *smbw_readdir(DIR *d); -int smbw_readlink(const char *path, char *buf, size_t bufsize); -int smbw_rename(const char *oldname, const char *newname); -int smbw_rmdir(const char *fname); - -- cgit