diff options
Diffstat (limited to 'source3/include')
-rw-r--r-- | source3/include/includes.h | 3 | ||||
-rw-r--r-- | source3/include/profile.h | 290 | ||||
-rw-r--r-- | source3/include/proto.h | 55 | ||||
-rw-r--r-- | source3/include/smb.h | 3 | ||||
-rw-r--r-- | source3/include/vfs.h | 259 |
5 files changed, 360 insertions, 250 deletions
diff --git a/source3/include/includes.h b/source3/include/includes.h index da16ae1632..ad2771665a 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -637,6 +637,9 @@ extern int errno; #ifdef WITH_PROFILE #include "profile.h" +#else +#define START_PROFILE(x) +#define END_PROFILE(x) #endif #ifndef MAXCODEPAGELINES diff --git a/source3/include/profile.h b/source3/include/profile.h index 0924dc2937..9b6ec462df 100644 --- a/source3/include/profile.h +++ b/source3/include/profile.h @@ -1,3 +1,5 @@ +#ifndef _PROFILE_H_ +#define _PROFILE_H_ /* Unix SMB/Netbios implementation. Version 1.9. @@ -25,14 +27,300 @@ #define PROF_SHMEM_KEY ((key_t)0x07021999) #define PROF_SHM_MAGIC 0x6349985 -#define PROF_SHM_VERSION 1 +#define PROF_SHM_VERSION 2 + +/* time values in the following structure are in milliseconds */ struct profile_struct { int prof_shm_magic; int prof_shm_version; +/* general counters */ unsigned smb_count; /* how many SMB packets we have processed */ unsigned uid_changes; /* how many times we change our effective uid */ +/* system call counters */ + unsigned syscall_opendir_count; + unsigned syscall_opendir_time; + unsigned syscall_readdir_count; + unsigned syscall_readdir_time; + unsigned syscall_mkdir_count; + unsigned syscall_mkdir_time; + unsigned syscall_rmdir_count; + unsigned syscall_rmdir_time; + unsigned syscall_closedir_count; + unsigned syscall_closedir_time; + unsigned syscall_open_count; + unsigned syscall_open_time; + unsigned syscall_close_count; + unsigned syscall_close_time; + unsigned syscall_read_count; + unsigned syscall_read_time; + unsigned syscall_read_bytes; /* bytes read with read syscall */ + unsigned syscall_write_count; + unsigned syscall_write_time; + unsigned syscall_write_bytes; /* bytes written with write syscall */ + unsigned syscall_lseek_count; + unsigned syscall_lseek_time; + unsigned syscall_rename_count; + unsigned syscall_rename_time; + unsigned syscall_fsync_count; + unsigned syscall_fsync_time; + unsigned syscall_stat_count; + unsigned syscall_stat_time; + unsigned syscall_fstat_count; + unsigned syscall_fstat_time; + unsigned syscall_lstat_count; + unsigned syscall_lstat_time; + unsigned syscall_unlink_count; + unsigned syscall_unlink_time; + unsigned syscall_chmod_count; + unsigned syscall_chmod_time; + unsigned syscall_chown_count; + unsigned syscall_chown_time; + unsigned syscall_chdir_count; + unsigned syscall_chdir_time; + unsigned syscall_getwd_count; + unsigned syscall_getwd_time; + unsigned syscall_utime_count; + unsigned syscall_utime_time; + unsigned syscall_ftruncate_count; + unsigned syscall_ftruncate_time; + unsigned syscall_fcntl_lock_count; + unsigned syscall_fcntl_lock_time; +/* stat cache counters */ + unsigned statcache_lookups; + unsigned statcache_misses; + unsigned statcache_hits; +/* write cache counters */ + unsigned writecache_read_hits; + unsigned writecache_abutted_writes; + unsigned writecache_total_writes; + unsigned writecache_non_oplock_writes; + unsigned writecache_direct_writes; + unsigned writecache_init_writes; + unsigned writecache_flushed_writes[NUM_FLUSH_REASONS]; + unsigned writecache_num_perfect_writes; + unsigned writecache_num_write_caches; + unsigned writecache_allocated_write_caches; +/* counters for individual SMB types */ + unsigned SMBmkdir_count; /* create directory */ + unsigned SMBmkdir_time; + unsigned SMBrmdir_count; /* delete directory */ + unsigned SMBrmdir_time; + unsigned SMBopen_count; /* open file */ + unsigned SMBopen_time; + unsigned SMBcreate_count; /* create file */ + unsigned SMBcreate_time; + unsigned SMBclose_count; /* close file */ + unsigned SMBclose_time; + unsigned SMBflush_count; /* flush file */ + unsigned SMBflush_time; + unsigned SMBunlink_count; /* delete file */ + unsigned SMBunlink_time; + unsigned SMBmv_count; /* rename file */ + unsigned SMBmv_time; + unsigned SMBgetatr_count; /* get file attributes */ + unsigned SMBgetatr_time; + unsigned SMBsetatr_count; /* set file attributes */ + unsigned SMBsetatr_time; + unsigned SMBread_count; /* read from file */ + unsigned SMBread_time; + unsigned SMBwrite_count; /* write to file */ + unsigned SMBwrite_time; + unsigned SMBlock_count; /* lock byte range */ + unsigned SMBlock_time; + unsigned SMBunlock_count; /* unlock byte range */ + unsigned SMBunlock_time; + unsigned SMBctemp_count; /* create temporary file */ + unsigned SMBctemp_time; + /* SMBmknew stats are currently combined with SMBcreate */ + unsigned SMBmknew_count; /* make new file */ + unsigned SMBmknew_time; + unsigned SMBchkpth_count; /* check directory path */ + unsigned SMBchkpth_time; + unsigned SMBexit_count; /* process exit */ + unsigned SMBexit_time; + unsigned SMBlseek_count; /* seek */ + unsigned SMBlseek_time; + unsigned SMBlockread_count; /* Lock a range and read */ + unsigned SMBlockread_time; + unsigned SMBwriteunlock_count; /* Unlock a range then write */ + unsigned SMBwriteunlock_time; + unsigned SMBreadbraw_count; /* read a block of data with no smb header */ + unsigned SMBreadbraw_time; + unsigned SMBreadBmpx_count; /* read block multiplexed */ + unsigned SMBreadBmpx_time; + unsigned SMBreadBs_count; /* read block (secondary response) */ + unsigned SMBreadBs_time; + unsigned SMBwritebraw_count; /* write a block of data with no smb header */ + unsigned SMBwritebraw_time; + unsigned SMBwriteBmpx_count; /* write block multiplexed */ + unsigned SMBwriteBmpx_time; + unsigned SMBwriteBs_count; /* write block (secondary request) */ + unsigned SMBwriteBs_time; + unsigned SMBwritec_count; /* secondary write request */ + unsigned SMBwritec_time; + unsigned SMBsetattrE_count; /* set file attributes expanded */ + unsigned SMBsetattrE_time; + unsigned SMBgetattrE_count; /* get file attributes expanded */ + unsigned SMBgetattrE_time; + unsigned SMBlockingX_count; /* lock/unlock byte ranges and X */ + unsigned SMBlockingX_time; + unsigned SMBtrans_count; /* transaction - name, bytes in/out */ + unsigned SMBtrans_time; + unsigned SMBtranss_count; /* transaction (secondary request/response) */ + unsigned SMBtranss_time; + unsigned SMBioctl_count; /* IOCTL */ + unsigned SMBioctl_time; + unsigned SMBioctls_count; /* IOCTL (secondary request/response) */ + unsigned SMBioctls_time; + unsigned SMBcopy_count; /* copy */ + unsigned SMBcopy_time; + unsigned SMBmove_count; /* move */ + unsigned SMBmove_time; + unsigned SMBecho_count; /* echo */ + unsigned SMBecho_time; + unsigned SMBwriteclose_count; /* write a file then close it */ + unsigned SMBwriteclose_time; + unsigned SMBopenX_count; /* open and X */ + unsigned SMBopenX_time; + unsigned SMBreadX_count; /* read and X */ + unsigned SMBreadX_time; + unsigned SMBwriteX_count; /* write and X */ + unsigned SMBwriteX_time; + unsigned SMBtrans2_count; /* TRANS2 protocol set */ + unsigned SMBtrans2_time; + unsigned SMBtranss2_count; /* TRANS2 protocol set, secondary command */ + unsigned SMBtranss2_time; + unsigned SMBfindclose_count; /* Terminate a TRANSACT2_FINDFIRST */ + unsigned SMBfindclose_time; + unsigned SMBfindnclose_count; /* Terminate a TRANSACT2_FINDNOTIFYFIRST */ + unsigned SMBfindnclose_time; + unsigned SMBtcon_count; /* tree connect */ + unsigned SMBtcon_time; + unsigned SMBtdis_count; /* tree disconnect */ + unsigned SMBtdis_time; + unsigned SMBnegprot_count; /* negotiate protocol */ + unsigned SMBnegprot_time; + unsigned SMBsesssetupX_count; /* Session Set Up & X (including User Logon) */ + unsigned SMBsesssetupX_time; + unsigned SMBulogoffX_count; /* user logoff */ + unsigned SMBulogoffX_time; + unsigned SMBtconX_count; /* tree connect and X*/ + unsigned SMBtconX_time; + unsigned SMBdskattr_count; /* get disk attributes */ + unsigned SMBdskattr_time; + unsigned SMBsearch_count; /* search directory */ + unsigned SMBsearch_time; + /* SBMffirst stats combined with SMBsearch */ + unsigned SMBffirst_count; /* find first */ + unsigned SMBffirst_time; + /* SBMfunique stats combined with SMBsearch */ + unsigned SMBfunique_count; /* find unique */ + unsigned SMBfunique_time; + unsigned SMBfclose_count; /* find close */ + unsigned SMBfclose_time; + unsigned SMBnttrans_count; /* NT transact */ + unsigned SMBnttrans_time; + unsigned SMBnttranss_count; /* NT transact secondary */ + unsigned SMBnttranss_time; + unsigned SMBntcreateX_count; /* NT create and X */ + unsigned SMBntcreateX_time; + unsigned SMBntcancel_count; /* NT cancel */ + unsigned SMBntcancel_time; + unsigned SMBsplopen_count; /* open print spool file */ + unsigned SMBsplopen_time; + unsigned SMBsplwr_count; /* write to print spool file */ + unsigned SMBsplwr_time; + unsigned SMBsplclose_count; /* close print spool file */ + unsigned SMBsplclose_time; + unsigned SMBsplretq_count; /* return print queue */ + unsigned SMBsplretq_time; + unsigned SMBsends_count; /* send single block message */ + unsigned SMBsends_time; + unsigned SMBsendb_count; /* send broadcast message */ + unsigned SMBsendb_time; + unsigned SMBfwdname_count; /* forward user name */ + unsigned SMBfwdname_time; + unsigned SMBcancelf_count; /* cancel forward */ + unsigned SMBcancelf_time; + unsigned SMBgetmac_count; /* get machine name */ + unsigned SMBgetmac_time; + unsigned SMBsendstrt_count; /* send start of multi-block message */ + unsigned SMBsendstrt_time; + unsigned SMBsendend_count; /* send end of multi-block message */ + unsigned SMBsendend_time; + unsigned SMBsendtxt_count; /* send text of multi-block message */ + unsigned SMBsendtxt_time; + unsigned SMBinvalid_count; /* invalid command */ + unsigned SMBinvalid_time; +/* Pathworks setdir command */ + unsigned pathworks_setdir_count; + unsigned pathworks_setdir_time; +/* These are the TRANS2 sub commands */ + unsigned Trans2_open_count; + unsigned Trans2_open_time; + unsigned Trans2_findfirst_count; + unsigned Trans2_findfirst_time; + unsigned Trans2_findnext_count; + unsigned Trans2_findnext_time; + unsigned Trans2_qfsinfo_count; + unsigned Trans2_qfsinfo_time; + unsigned Trans2_setfsinfo_count; + unsigned Trans2_setfsinfo_time; + unsigned Trans2_qpathinfo_count; + unsigned Trans2_qpathinfo_time; + unsigned Trans2_setpathinfo_count; + unsigned Trans2_setpathinfo_time; + unsigned Trans2_qfileinfo_count; + unsigned Trans2_qfileinfo_time; + unsigned Trans2_setfileinfo_count; + unsigned Trans2_setfileinfo_time; + unsigned Trans2_fsctl_count; + unsigned Trans2_fsctl_time; + unsigned Trans2_ioctl_count; + unsigned Trans2_ioctl_time; + unsigned Trans2_findnotifyfirst_count; + unsigned Trans2_findnotifyfirst_time; + unsigned Trans2_findnotifynext_count; + unsigned Trans2_findnotifynext_time; + unsigned Trans2_mkdir_count; + unsigned Trans2_mkdir_time; + unsigned Trans2_session_setup_count; + unsigned Trans2_session_setup_time; + unsigned Trans2_get_dfs_referral_count; + unsigned Trans2_get_dfs_referral_time; + unsigned Trans2_report_dfs_inconsistancy_count; + unsigned Trans2_report_dfs_inconsistancy_time; +/* These are the NT transact sub commands. */ + unsigned NT_transact_create_count; + unsigned NT_transact_create_time; + unsigned NT_transact_ioctl_count; + unsigned NT_transact_ioctl_time; + unsigned NT_transact_set_security_desc_count; + unsigned NT_transact_set_security_desc_time; + unsigned NT_transact_notify_change_count; + unsigned NT_transact_notify_change_time; + unsigned NT_transact_rename_count; + unsigned NT_transact_rename_time; + unsigned NT_transact_query_security_desc_count; + unsigned NT_transact_query_security_desc_time; }; extern struct profile_struct *profile_p; + +#define INC_PROFILE_COUNT(x) if (profile_p) profile_p->x++ +#define DEC_PROFILE_COUNT(x) if (profile_p) profile_p->x-- +#define ADD_PROFILE_COUNT(x,y) if (profile_p) profile_p->x += (y) + +#define START_PROFILE(x) \ + struct timeval starttime; \ + struct timeval endtime; \ + GetTimeOfDay(&starttime); \ + INC_PROFILE_COUNT(x##_count) + +#define END_PROFILE(y) \ + GetTimeOfDay(&endtime); \ + ADD_PROFILE_COUNT((y##_time),TvalDiff(&starttime,&endtime)) + +#endif diff --git a/source3/include/proto.h b/source3/include/proto.h index 8d061f2522..bb990a99a4 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -3833,44 +3833,43 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd); /*The following definitions come from smbd/vfs-wrap.c */ -int vfswrap_dummy_connect(struct vfs_connection_struct *conn, char *service, - char *user); +int vfswrap_dummy_connect(connection_struct *conn, char *service, char *user); void vfswrap_dummy_disconnect(void); -SMB_BIG_UINT vfswrap_disk_free(char *path, BOOL small_query, SMB_BIG_UINT *bsize, +SMB_BIG_UINT vfswrap_disk_free(connection_struct *conn, char *path, BOOL small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); -DIR *vfswrap_opendir(char *fname); -struct dirent *vfswrap_readdir(DIR *dirp); -int vfswrap_mkdir(char *path, mode_t mode); -int vfswrap_rmdir(char *path); -int vfswrap_closedir(DIR *dirp); -int vfswrap_open(char *fname, int flags, mode_t mode); -int vfswrap_close(int fd); -ssize_t vfswrap_read(int fd, char *data, size_t n); -ssize_t vfswrap_write(int fd, char *data, size_t n); -SMB_OFF_T vfswrap_lseek(int filedes, SMB_OFF_T offset, int whence); -int vfswrap_rename(char *old, char *new); -int vfswrap_fsync(int fd); -int vfswrap_stat(char *fname, SMB_STRUCT_STAT *sbuf); -int vfswrap_fstat(int fd, SMB_STRUCT_STAT *sbuf); -int vfswrap_lstat(char *path, - SMB_STRUCT_STAT *sbuf); -int vfswrap_unlink(char *path); -int vfswrap_chmod(char *path, mode_t mode); -int vfswrap_chown(char *path, uid_t uid, gid_t gid); -int vfswrap_chdir(char *path); -char *vfswrap_getwd(char *path); -int vfswrap_utime(char *path, struct utimbuf *times); -int vfswrap_ftruncate(int fd, SMB_OFF_T offset); -BOOL vfswrap_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); +DIR *vfswrap_opendir(connection_struct *conn, char *fname); +struct dirent *vfswrap_readdir(connection_struct *conn, DIR *dirp); +int vfswrap_mkdir(connection_struct *conn, char *path, mode_t mode); +int vfswrap_rmdir(connection_struct *conn, char *path); +int vfswrap_closedir(connection_struct *conn, DIR *dirp); +int vfswrap_open(connection_struct *conn, char *fname, int flags, mode_t mode); +int vfswrap_close(files_struct *fsp, int fd); +ssize_t vfswrap_read(files_struct *fsp, int fd, char *data, size_t n); +ssize_t vfswrap_write(files_struct *fsp, int fd, char *data, size_t n); +SMB_OFF_T vfswrap_lseek(files_struct *fsp, int filedes, SMB_OFF_T offset, int whence); +int vfswrap_rename(connection_struct *conn, char *old, char *new); +int vfswrap_fsync(files_struct *fsp, int fd); +int vfswrap_stat(connection_struct *conn, char *fname, SMB_STRUCT_STAT *sbuf); +int vfswrap_fstat(files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf); +int vfswrap_lstat(connection_struct *conn, char *path, SMB_STRUCT_STAT *sbuf); +int vfswrap_unlink(connection_struct *conn, char *path); +int vfswrap_chmod(connection_struct *conn, char *path, mode_t mode); +int vfswrap_chown(connection_struct *conn, char *path, uid_t uid, gid_t gid); +int vfswrap_chdir(connection_struct *conn, char *path); +char *vfswrap_getwd(connection_struct *conn, char *path); +int vfswrap_utime(connection_struct *conn, char *path, struct utimbuf *times); +int vfswrap_ftruncate(files_struct *fsp, int fd, SMB_OFF_T offset); +BOOL vfswrap_lock(files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); /*The following definitions come from smbd/vfs.c */ int vfs_init_default(connection_struct *conn); BOOL vfs_init_custom(connection_struct *conn); int vfs_stat(connection_struct *conn, char *fname, SMB_STRUCT_STAT *st); -int vfs_fstat(connection_struct *conn, int fd, SMB_STRUCT_STAT *st); +int vfs_fstat(files_struct *fsp, int fd, SMB_STRUCT_STAT *st); BOOL vfs_directory_exist(connection_struct *conn, char *dname, SMB_STRUCT_STAT *st); int vfs_mkdir(connection_struct *conn, char *fname, mode_t mode); +int vfs_rmdir(connection_struct *conn, char *fname); int vfs_unlink(connection_struct *conn, char *fname); int vfs_chmod(connection_struct *conn, char *fname,mode_t mode); int vfs_chown(connection_struct *conn, char *fname, uid_t uid, gid_t gid); diff --git a/source3/include/smb.h b/source3/include/smb.h index 02ef940085..24211b0d50 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -580,7 +580,8 @@ typedef struct connection_struct char *origpath; struct vfs_ops vfs_ops; /* Filesystem operations */ - struct vfs_connection_struct *vfs_conn; /* VFS specific connection stuff */ + /* Handle on dlopen() call */ + void *dl_handle; char *user; /* name of user who *opened* this connection */ uid_t uid; /* uid of user who *opened* this connection */ diff --git a/source3/include/vfs.h b/source3/include/vfs.h index bb2239bf28..fb089c86cc 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -22,246 +22,65 @@ #ifndef _VFS_H #define _VFS_H -/* Types used in the definition of VFS operations. These are included - here so the vfs.h file can be included by VFS modules without - having to pull in unnecessary amounts of other stuff. Note to VFS - writers: you must include config.h before including this file. - The following type definitions reference the HAVE_* symbols which - are defined in config.h */ - -#ifndef SMB_OFF_T -# ifdef HAVE_OFF64_T -# define SMB_OFF_T off64_t -# else -# define SMB_OFF_T off_t -# endif -#endif - -#ifndef SMB_STRUCT_STAT -# if defined(HAVE_STAT64) && defined(HAVE_OFF64_T) -# define SMB_STRUCT_STAT struct stat64 -# else -# define SMB_STRUCT_STAT struct stat -# endif -#endif - -#ifndef _BOOL -typedef int BOOL; -#endif - -#ifndef _PSTRING -#define PSTRING_LEN 1024 -#define FSTRING_LEN 128 - -typedef char pstring[PSTRING_LEN]; -typedef char fstring[FSTRING_LEN]; -#define _PSTRING -#endif - -#if defined(HAVE_LONGLONG) -#define SMB_BIG_UINT unsigned long long -#else -#define SMB_BIG_UINT unsigned long -#endif - -#ifndef MAXSUBAUTHS -#define MAXSUBAUTHS 15 /* max sub authorities in a SID */ -#endif - -#ifndef uint8 -#define uint8 unsigned char -#endif - -#if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H) -#if (SIZEOF_INT == 4) -#define uint32 unsigned int -#elif (SIZEOF_LONG == 4) -#define uint32 unsigned long -#elif (SIZEOF_SHORT == 4) -#define uint32 unsigned short -#endif -#endif - -#ifndef _DOM_SID -/* DOM_SID - security id */ -typedef struct sid_info -{ - uint8 sid_rev_num; /* SID revision number */ - uint8 num_auths; /* number of sub-authorities */ - uint8 id_auth[6]; /* Identifier Authority */ - /* - * Note that the values in these uint32's are in *native* byteorder, - * not neccessarily little-endian...... JRA. - */ - uint32 sub_auths[MAXSUBAUTHS]; /* pointer to sub-authorities. */ - -} DOM_SID; -#define _DOM_SID -#endif - -#ifndef _SEC_ACCESS -/* SEC_ACCESS */ -typedef struct security_info_info -{ - uint32 mask; - -} SEC_ACCESS; -#define _SEC_ACCESS -#endif - -#ifndef _SEC_ACE -/* SEC_ACE */ -typedef struct security_ace_info -{ - uint8 type; /* xxxx_xxxx_ACE_TYPE - e.g allowed / denied etc */ - uint8 flags; /* xxxx_INHERIT_xxxx - e.g OBJECT_INHERIT_ACE */ - uint16 size; - - SEC_ACCESS info; - DOM_SID sid; - -} SEC_ACE; -#define _SEC_ACE -#endif - -#ifndef ACL_REVISION -#define ACL_REVISION 0x3 -#endif - -#ifndef _SEC_ACL -/* SEC_ACL */ -typedef struct security_acl_info -{ - uint16 revision; /* 0x0003 */ - uint16 size; /* size in bytes of the entire ACL structure */ - uint32 num_aces; /* number of Access Control Entries */ - - SEC_ACE *ace; - -} SEC_ACL; -#define _SEC_ACL -#endif - -#ifndef SEC_DESC_REVISION -#define SEC_DESC_REVISION 0x1 -#endif - -#ifndef _SEC_DESC -/* SEC_DESC */ -typedef struct security_descriptor_info -{ - uint16 revision; /* 0x0001 */ - uint16 type; /* SEC_DESC_xxxx flags */ - - uint32 off_owner_sid; /* offset to owner sid */ - uint32 off_grp_sid ; /* offset to group sid */ - uint32 off_sacl ; /* offset to system list of permissions */ - uint32 off_dacl ; /* offset to list of permissions */ - - SEC_ACL *dacl; /* user ACL */ - SEC_ACL *sacl; /* system ACL */ - DOM_SID *owner_sid; - DOM_SID *grp_sid; - -} SEC_DESC; -#define _SEC_DESC -#endif - -/* - * The complete list of SIDS belonging to this user. - * Created when a vuid is registered. - */ - -#ifndef _NT_USER_TOKEN -typedef struct _nt_user_token { - size_t num_sids; - DOM_SID *user_sids; -} NT_USER_TOKEN; -#define _NT_USER_TOKEN -#endif - /* Avoid conflict with an AIX include file */ #ifdef vfs_ops #undef vfs_ops #endif -/* Information from the connection_struct passed to the vfs layer */ - -struct vfs_connection_struct { - - /* Connection information */ - - BOOL printer; - BOOL ipc; - BOOL read_only; - BOOL admin_user; - - /* Handle on dlopen() call */ - - void *dl_handle; - - /* Paths */ - - pstring dirpath; - pstring connectpath; - pstring origpath; - pstring service; - - /* Information on user who *opened* this connection */ - - pstring user; - uid_t uid; - gid_t gid; - int ngroups; - gid_t *groups; - NT_USER_TOKEN *nt_user_token; -}; +/* + * As we're now (thanks Andrew ! :-) using file_structs and connection + * structs in the vfs - then anyone writing a vfs must include includes.h... + */ /* VFS operations structure */ +struct connection_struct; +struct files_struct; +struct security_descriptor_info; + struct vfs_ops { /* Disk operations */ - int (*connect)(struct vfs_connection_struct *conn, char *service, char *user); - void (*disconnect)(void); - SMB_BIG_UINT (*disk_free)(char *path, BOOL small_query, SMB_BIG_UINT *bsize, + int (*connect)(struct connection_struct *conn, char *service, char *user); + void (*disconnect)(struct connection_struct *conn); + SMB_BIG_UINT (*disk_free)(struct connection_struct *conn, char *path, BOOL small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); /* Directory operations */ - DIR *(*opendir)(char *fname); - struct dirent *(*readdir)(DIR *dirp); - int (*mkdir)(char *path, mode_t mode); - int (*rmdir)(char *path); - int (*closedir)(DIR *dir); + DIR *(*opendir)(struct connection_struct *conn, char *fname); + struct dirent *(*readdir)(struct connection_struct *conn, DIR *dirp); + int (*mkdir)(struct connection_struct *conn, char *path, mode_t mode); + int (*rmdir)(struct connection_struct *conn, char *path); + int (*closedir)(struct connection_struct *conn, DIR *dir); /* File operations */ - int (*open)(char *fname, int flags, mode_t mode); - int (*close)(int fd); - ssize_t (*read)(int fd, char *data, size_t n); - ssize_t (*write)(int fd, char *data, size_t n); - SMB_OFF_T (*lseek)(int filedes, SMB_OFF_T offset, int whence); - int (*rename)(char *old, char *new); - int (*fsync)(int fd); - int (*stat)(char *fname, SMB_STRUCT_STAT *sbuf); - int (*fstat)(int fd, SMB_STRUCT_STAT *sbuf); - int (*lstat)(char *path, SMB_STRUCT_STAT *sbuf); - int (*unlink)(char *path); - int (*chmod)(char *path, mode_t mode); - int (*chown)(char *path, uid_t uid, gid_t gid); - int (*chdir)(char *path); - char *(*getwd)(char *buf); - int (*utime)(char *path, struct utimbuf *times); - int (*ftruncate)(int fd, SMB_OFF_T offset); - BOOL (*lock)(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); - - size_t (*fget_nt_acl)(int fd, SEC_DESC **ppdesc); - size_t (*get_nt_acl)(char *name, SEC_DESC **ppdesc); - BOOL (*fset_nt_acl)(int fd, uint32 security_info_sent, SEC_DESC *psd); - BOOL (*set_nt_acl)(char *name, uint32 security_info_sent, SEC_DESC *psd); + int (*open)(struct connection_struct *conn, char *fname, int flags, mode_t mode); + int (*close)(struct files_struct *fsp, int fd); + ssize_t (*read)(struct files_struct *fsp, int fd, char *data, size_t n); + ssize_t (*write)(struct files_struct *fsp, int fd, char *data, size_t n); + SMB_OFF_T (*lseek)(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence); + int (*rename)(struct connection_struct *conn, char *old, char *new); + int (*fsync)(struct files_struct *fsp, int fd); + int (*stat)(struct connection_struct *conn, char *fname, SMB_STRUCT_STAT *sbuf); + int (*fstat)(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf); + int (*lstat)(struct connection_struct *conn, char *path, SMB_STRUCT_STAT *sbuf); + int (*unlink)(struct connection_struct *conn, char *path); + int (*chmod)(struct connection_struct *conn, char *path, mode_t mode); + int (*chown)(struct connection_struct *conn, char *path, uid_t uid, gid_t gid); + int (*chdir)(struct connection_struct *conn, char *path); + char *(*getwd)(struct connection_struct *conn, char *buf); + int (*utime)(struct connection_struct *conn, char *path, struct utimbuf *times); + int (*ftruncate)(struct files_struct *fsp, int fd, SMB_OFF_T offset); + BOOL (*lock)(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); + + size_t (*fget_nt_acl)(struct files_struct *fsp, int fd, struct security_descriptor_info **ppdesc); + size_t (*get_nt_acl)(struct connection_struct *conn, char *name, struct security_descriptor_info **ppdesc); + BOOL (*fset_nt_acl)(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd); + BOOL (*set_nt_acl)(struct connection_struct *conn, char *name, uint32 security_info_sent, struct security_descriptor_info *psd); }; struct vfs_options { |