include/vfs.h

説明を見る。
00001 /* 
00002    Unix SMB/CIFS implementation.
00003    VFS structures and parameters
00004    Copyright (C) Jeremy Allison                         1999-2005
00005    Copyright (C) Tim Potter                             1999
00006    Copyright (C) Alexander Bokovoy                      2002-2005
00007    Copyright (C) Stefan (metze) Metzmacher              2003
00008    
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; either version 2 of the License, or
00012    (at your option) any later version.
00013    
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.
00018    
00019    You should have received a copy of the GNU General Public License
00020    along with this program; if not, write to the Free Software
00021    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00022 
00023    This work was sponsored by Optifacio Software Services, Inc.
00024 */
00025 
00026 #ifndef _VFS_H
00027 #define _VFS_H
00028 
00029 /* Avoid conflict with an AIX include file */
00030 
00031 #ifdef vfs_ops
00032 #undef vfs_ops
00033 #endif
00034 
00035 /*
00036  * As we're now (thanks Andrew ! :-) using file_structs and connection
00037  * structs in the vfs - then anyone writing a vfs must include includes.h...
00038  */
00039 
00040 /*
00041  * This next constant specifies the version number of the VFS interface
00042  * this smbd will load. Increment this if *ANY* changes are made to the
00043  * vfs_ops below. JRA.
00044  *
00045  * If you change anything here, please also update modules/vfs_full_audit.c.
00046  * VL.
00047  */
00048 
00049 /* Changed to version 2 for CIFS UNIX extensions (mknod and link added). JRA. */
00050 /* Changed to version 3 for POSIX acl extensions. JRA. */
00051 /* Changed to version 4 for cascaded VFS interface. Alexander Bokovoy. */
00052 /* Changed to version 5 for sendfile addition. JRA. */
00053 /* Changed to version 6 for the new module system, fixed cascading and quota functions. --metze */
00054 /* Changed to version 7 to include the get_nt_acl info parameter. JRA. */
00055 /* Changed to version 8 includes EA calls. JRA. */
00056 /* Changed to version 9 to include the get_shadow_data call. --metze */
00057 /* Changed to version 10 to include pread/pwrite calls. */
00058 /* Changed to version 11 to include seekdir/telldir/rewinddir calls. JRA */
00059 /* Changed to version 12 to add mask and attributes to opendir(). JRA 
00060    Also include aio calls. JRA. */
00061 /* Changed to version 13 as the internal structure of files_struct has changed. JRA */
00062 /* Changed to version 14 as we had to change DIR to SMB_STRUCT_DIR. JRA */
00063 /* Changed to version 15 as we added the statvfs call. JRA */
00064 /* Changed to version 16 as we added the getlock call. JRA */
00065 /* Changed to version 17 as we removed redundant connection_struct parameters. --jpeach */
00066 /* Changed to version 18 to add fsp parameter to the open call -- jpeach 
00067    Also include kernel_flock call - jmcd */
00068 /* Changed to version 19, kernel change notify has been merged 
00069    Also included linux setlease call - jmcd */
00070 /* Changed to version 20, use ntimes call instead of utime (greater
00071  * timestamp resolition. JRA. */
00072 /* Changed to version21 to add chflags operation -- jpeach */
00073 #define SMB_VFS_INTERFACE_VERSION 21
00074 
00075 
00076 /* to bug old modules which are trying to compile with the old functions */
00077 #define vfs_init __ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_8_donot_use_vfs_init_anymore(void) { __ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_8_donot_use_vfs_init_anymore };
00078 #define lp_parm_string __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string { \
00079   __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string };
00080 #define lp_vfs_options __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead { \
00081   __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead };
00082 
00083 /*
00084     All intercepted VFS operations must be declared as static functions inside module source
00085     in order to keep smbd namespace unpolluted. See source of audit, extd_audit, fake_perms and recycle
00086     example VFS modules for more details.
00087 */
00088 
00089 /* VFS operations structure */
00090 
00091 struct vfs_handle_struct;
00092 struct connection_struct;
00093 struct files_struct;
00094 struct security_descriptor_info;
00095 struct vfs_statvfs_struct;
00096 
00097 /*
00098     Available VFS operations. These values must be in sync with vfs_ops struct
00099     (struct vfs_fn_pointers and struct vfs_handle_pointers inside of struct vfs_ops). 
00100     In particular, if new operations are added to vfs_ops, appropriate constants
00101     should be added to vfs_op_type so that order of them kept same as in vfs_ops.
00102 */
00103 
00104 typedef enum _vfs_op_type {
00105         SMB_VFS_OP_NOOP = -1,
00106         
00107         /* Disk operations */
00108 
00109         SMB_VFS_OP_CONNECT = 0,
00110         SMB_VFS_OP_DISCONNECT,
00111         SMB_VFS_OP_DISK_FREE,
00112         SMB_VFS_OP_GET_QUOTA,
00113         SMB_VFS_OP_SET_QUOTA,
00114         SMB_VFS_OP_GET_SHADOW_COPY_DATA,
00115         SMB_VFS_OP_STATVFS,
00116 
00117         /* Directory operations */
00118 
00119         SMB_VFS_OP_OPENDIR,
00120         SMB_VFS_OP_READDIR,
00121         SMB_VFS_OP_SEEKDIR,
00122         SMB_VFS_OP_TELLDIR,
00123         SMB_VFS_OP_REWINDDIR,
00124         SMB_VFS_OP_MKDIR,
00125         SMB_VFS_OP_RMDIR,
00126         SMB_VFS_OP_CLOSEDIR,
00127 
00128         /* File operations */
00129 
00130         SMB_VFS_OP_OPEN,
00131         SMB_VFS_OP_CLOSE,
00132         SMB_VFS_OP_READ,
00133         SMB_VFS_OP_PREAD,
00134         SMB_VFS_OP_WRITE,
00135         SMB_VFS_OP_PWRITE,
00136         SMB_VFS_OP_LSEEK,
00137         SMB_VFS_OP_SENDFILE,
00138         SMB_VFS_OP_RENAME,
00139         SMB_VFS_OP_FSYNC,
00140         SMB_VFS_OP_STAT,
00141         SMB_VFS_OP_FSTAT,
00142         SMB_VFS_OP_LSTAT,
00143         SMB_VFS_OP_UNLINK,
00144         SMB_VFS_OP_CHMOD,
00145         SMB_VFS_OP_FCHMOD,
00146         SMB_VFS_OP_CHOWN,
00147         SMB_VFS_OP_FCHOWN,
00148         SMB_VFS_OP_CHDIR,
00149         SMB_VFS_OP_GETWD,
00150         SMB_VFS_OP_NTIMES,
00151         SMB_VFS_OP_FTRUNCATE,
00152         SMB_VFS_OP_LOCK,
00153         SMB_VFS_OP_KERNEL_FLOCK,
00154         SMB_VFS_OP_LINUX_SETLEASE,
00155         SMB_VFS_OP_GETLOCK,
00156         SMB_VFS_OP_SYMLINK,
00157         SMB_VFS_OP_READLINK,
00158         SMB_VFS_OP_LINK,
00159         SMB_VFS_OP_MKNOD,
00160         SMB_VFS_OP_REALPATH,
00161         SMB_VFS_OP_NOTIFY_WATCH,
00162         SMB_VFS_OP_CHFLAGS,
00163 
00164         /* NT ACL operations. */
00165 
00166         SMB_VFS_OP_FGET_NT_ACL,
00167         SMB_VFS_OP_GET_NT_ACL,
00168         SMB_VFS_OP_FSET_NT_ACL,
00169         SMB_VFS_OP_SET_NT_ACL,
00170 
00171         /* POSIX ACL operations. */
00172 
00173         SMB_VFS_OP_CHMOD_ACL,
00174         SMB_VFS_OP_FCHMOD_ACL,
00175 
00176         SMB_VFS_OP_SYS_ACL_GET_ENTRY,
00177         SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE,
00178         SMB_VFS_OP_SYS_ACL_GET_PERMSET,
00179         SMB_VFS_OP_SYS_ACL_GET_QUALIFIER,
00180         SMB_VFS_OP_SYS_ACL_GET_FILE,
00181         SMB_VFS_OP_SYS_ACL_GET_FD,
00182         SMB_VFS_OP_SYS_ACL_CLEAR_PERMS,
00183         SMB_VFS_OP_SYS_ACL_ADD_PERM,
00184         SMB_VFS_OP_SYS_ACL_TO_TEXT,
00185         SMB_VFS_OP_SYS_ACL_INIT,
00186         SMB_VFS_OP_SYS_ACL_CREATE_ENTRY,
00187         SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE,
00188         SMB_VFS_OP_SYS_ACL_SET_QUALIFIER,
00189         SMB_VFS_OP_SYS_ACL_SET_PERMSET,
00190         SMB_VFS_OP_SYS_ACL_VALID,
00191         SMB_VFS_OP_SYS_ACL_SET_FILE,
00192         SMB_VFS_OP_SYS_ACL_SET_FD,
00193         SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
00194         SMB_VFS_OP_SYS_ACL_GET_PERM,
00195         SMB_VFS_OP_SYS_ACL_FREE_TEXT,
00196         SMB_VFS_OP_SYS_ACL_FREE_ACL,
00197         SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER,
00198         
00199         /* EA operations. */
00200         SMB_VFS_OP_GETXATTR,
00201         SMB_VFS_OP_LGETXATTR,
00202         SMB_VFS_OP_FGETXATTR,
00203         SMB_VFS_OP_LISTXATTR,
00204         SMB_VFS_OP_LLISTXATTR,
00205         SMB_VFS_OP_FLISTXATTR,
00206         SMB_VFS_OP_REMOVEXATTR,
00207         SMB_VFS_OP_LREMOVEXATTR,
00208         SMB_VFS_OP_FREMOVEXATTR,
00209         SMB_VFS_OP_SETXATTR,
00210         SMB_VFS_OP_LSETXATTR,
00211         SMB_VFS_OP_FSETXATTR,
00212 
00213         /* aio operations */
00214         SMB_VFS_OP_AIO_READ,
00215         SMB_VFS_OP_AIO_WRITE,
00216         SMB_VFS_OP_AIO_RETURN,
00217         SMB_VFS_OP_AIO_CANCEL,
00218         SMB_VFS_OP_AIO_ERROR,
00219         SMB_VFS_OP_AIO_FSYNC,
00220         SMB_VFS_OP_AIO_SUSPEND,
00221 
00222         /* This should always be last enum value */
00223         
00224         SMB_VFS_OP_LAST
00225 } vfs_op_type;
00226 
00227 /*
00228     Please keep vfs_op_type, struct vfs_fn_pointers and struct vfs_handles_pointers in sync.
00229 */
00230 struct vfs_ops {
00231         struct vfs_fn_pointers {
00232                 /* Disk operations */
00233                 
00234                 int (*connect_fn)(struct vfs_handle_struct *handle, const char *service, const char *user);
00235                 void (*disconnect)(struct vfs_handle_struct *handle);
00236                 SMB_BIG_UINT (*disk_free)(struct vfs_handle_struct *handle, const char *path, BOOL small_query, SMB_BIG_UINT *bsize,
00237                         SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
00238                 int (*get_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
00239                 int (*set_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
00240                 int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels);
00241                 int (*statvfs)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf);
00242                 
00243                 /* Directory operations */
00244                 
00245                 SMB_STRUCT_DIR *(*opendir)(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attributes);
00246                 SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
00247                 void (*seekdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset);
00248                 long (*telldir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
00249                 void (*rewind_dir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
00250                 int (*mkdir)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
00251                 int (*rmdir)(struct vfs_handle_struct *handle, const char *path);
00252                 int (*closedir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dir);
00253                 
00254                 /* File operations */
00255                 
00256                 int (*open)(struct vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode);
00257                 int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
00258                 ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n);
00259                 ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset);
00260                 ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n);
00261                 ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset);
00262                 SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset, int whence);
00263                 ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fsp, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
00264                 int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname);
00265                 int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
00266                 int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf);
00267                 int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf);
00268                 int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
00269                 int (*unlink)(struct vfs_handle_struct *handle, const char *path);
00270                 int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
00271                 int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode);
00272                 int (*chown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
00273                 int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uid_t uid, gid_t gid);
00274                 int (*chdir)(struct vfs_handle_struct *handle, const char *path);
00275                 char *(*getwd)(struct vfs_handle_struct *handle, char *buf);
00276                 int (*ntimes)(struct vfs_handle_struct *handle, const char *path, const struct timespec ts[2]);
00277                 int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset);
00278                 BOOL (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
00279                 int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 share_mode);
00280                 int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int leasetype);
00281                 BOOL (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
00282                 int (*symlink)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
00283                 int (*readlink)(struct vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz);
00284                 int (*link)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
00285                 int (*mknod)(struct vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev);
00286                 char *(*realpath)(struct vfs_handle_struct *handle, const char *path, char *resolved_path);
00287                 NTSTATUS (*notify_watch)(struct vfs_handle_struct *handle,
00288                                          struct sys_notify_context *ctx,
00289                                          struct notify_entry *e,
00290                                          void (*callback)(struct sys_notify_context *ctx, 
00291                                                           void *private_data,
00292                                                           struct notify_event *ev),
00293                                          void *private_data, void *handle_p);
00294                 int (*chflags)(struct vfs_handle_struct *handle, const char *path, uint flags);
00295                 
00296                 /* NT ACL operations. */
00297                 
00298                 size_t (*fget_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd,  uint32 security_info, struct security_descriptor_info **ppdesc);
00299                 size_t (*get_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name,  uint32 security_info, struct security_descriptor_info **ppdesc);
00300                 BOOL (*fset_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd);
00301                 BOOL (*set_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd);
00302                 
00303                 /* POSIX ACL operations. */
00304                 
00305                 int (*chmod_acl)(struct vfs_handle_struct *handle, const char *name, mode_t mode);
00306                 int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode);
00307                 
00308                 int (*sys_acl_get_entry)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
00309                 int (*sys_acl_get_tag_type)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
00310                 int (*sys_acl_get_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
00311                 void * (*sys_acl_get_qualifier)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d);
00312                 SMB_ACL_T (*sys_acl_get_file)(struct vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type);
00313                 SMB_ACL_T (*sys_acl_get_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
00314                 int (*sys_acl_clear_perms)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset);
00315                 int (*sys_acl_add_perm)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
00316                 char * (*sys_acl_to_text)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen);
00317                 SMB_ACL_T (*sys_acl_init)(struct vfs_handle_struct *handle, int count);
00318                 int (*sys_acl_create_entry)(struct vfs_handle_struct *handle, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
00319                 int (*sys_acl_set_tag_type)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype);
00320                 int (*sys_acl_set_qualifier)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, void *qual);
00321                 int (*sys_acl_set_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
00322                 int (*sys_acl_valid)(struct vfs_handle_struct *handle, SMB_ACL_T theacl );
00323                 int (*sys_acl_set_file)(struct vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
00324                 int (*sys_acl_set_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_ACL_T theacl);
00325                 int (*sys_acl_delete_def_file)(struct vfs_handle_struct *handle, const char *path);
00326                 int (*sys_acl_get_perm)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
00327                 int (*sys_acl_free_text)(struct vfs_handle_struct *handle, char *text);
00328                 int (*sys_acl_free_acl)(struct vfs_handle_struct *handle, SMB_ACL_T posix_acl);
00329                 int (*sys_acl_free_qualifier)(struct vfs_handle_struct *handle, void *qualifier, SMB_ACL_TAG_T tagtype);
00330 
00331                 /* EA operations. */
00332                 ssize_t (*getxattr)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size);
00333                 ssize_t (*lgetxattr)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size);
00334                 ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, const char *name, void *value, size_t size);
00335                 ssize_t (*listxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
00336                 ssize_t (*llistxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
00337                 ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int fd, char *list, size_t size);
00338                 int (*removexattr)(struct vfs_handle_struct *handle, const char *path, const char *name);
00339                 int (*lremovexattr)(struct vfs_handle_struct *handle, const char *path, const char *name);
00340                 int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name);
00341                 int (*setxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags);
00342                 int (*lsetxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags);
00343                 int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name, const void *value, size_t size, int flags);
00344 
00345                 /* aio operations */
00346                 int (*aio_read)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
00347                 int (*aio_write)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
00348                 ssize_t (*aio_return_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
00349                 int (*aio_cancel)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb);
00350                 int (*aio_error_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
00351                 int (*aio_fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb);
00352                 int (*aio_suspend)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *timeout);
00353 
00354         } ops;
00355 
00356         struct vfs_handles_pointers {
00357                 /* Disk operations */
00358 
00359                 struct vfs_handle_struct *connect_hnd;
00360                 struct vfs_handle_struct *disconnect;
00361                 struct vfs_handle_struct *disk_free;
00362                 struct vfs_handle_struct *get_quota;
00363                 struct vfs_handle_struct *set_quota;
00364                 struct vfs_handle_struct *get_shadow_copy_data;
00365                 struct vfs_handle_struct *statvfs;
00366 
00367                 /* Directory operations */
00368 
00369                 struct vfs_handle_struct *opendir;
00370                 struct vfs_handle_struct *readdir;
00371                 struct vfs_handle_struct *seekdir;
00372                 struct vfs_handle_struct *telldir;
00373                 struct vfs_handle_struct *rewind_dir;
00374                 struct vfs_handle_struct *mkdir;
00375                 struct vfs_handle_struct *rmdir;
00376                 struct vfs_handle_struct *closedir;
00377 
00378                 /* File operations */
00379 
00380                 struct vfs_handle_struct *open;
00381                 struct vfs_handle_struct *close_hnd;
00382                 struct vfs_handle_struct *read;
00383                 struct vfs_handle_struct *pread;
00384                 struct vfs_handle_struct *write;
00385                 struct vfs_handle_struct *pwrite;
00386                 struct vfs_handle_struct *lseek;
00387                 struct vfs_handle_struct *sendfile;
00388                 struct vfs_handle_struct *rename;
00389                 struct vfs_handle_struct *fsync;
00390                 struct vfs_handle_struct *stat;
00391                 struct vfs_handle_struct *fstat;
00392                 struct vfs_handle_struct *lstat;
00393                 struct vfs_handle_struct *unlink;
00394                 struct vfs_handle_struct *chmod;
00395                 struct vfs_handle_struct *fchmod;
00396                 struct vfs_handle_struct *chown;
00397                 struct vfs_handle_struct *fchown;
00398                 struct vfs_handle_struct *chdir;
00399                 struct vfs_handle_struct *getwd;
00400                 struct vfs_handle_struct *ntimes;
00401                 struct vfs_handle_struct *ftruncate;
00402                 struct vfs_handle_struct *lock;
00403                 struct vfs_handle_struct *kernel_flock;
00404                 struct vfs_handle_struct *linux_setlease;
00405                 struct vfs_handle_struct *getlock;
00406                 struct vfs_handle_struct *symlink;
00407                 struct vfs_handle_struct *readlink;
00408                 struct vfs_handle_struct *link;
00409                 struct vfs_handle_struct *mknod;
00410                 struct vfs_handle_struct *realpath;
00411                 struct vfs_handle_struct *notify_watch;
00412                 struct vfs_handle_struct *chflags;
00413 
00414                 /* NT ACL operations. */
00415 
00416                 struct vfs_handle_struct *fget_nt_acl;
00417                 struct vfs_handle_struct *get_nt_acl;
00418                 struct vfs_handle_struct *fset_nt_acl;
00419                 struct vfs_handle_struct *set_nt_acl;
00420 
00421                 /* POSIX ACL operations. */
00422 
00423                 struct vfs_handle_struct *chmod_acl;
00424                 struct vfs_handle_struct *fchmod_acl;
00425 
00426                 struct vfs_handle_struct *sys_acl_get_entry;
00427                 struct vfs_handle_struct *sys_acl_get_tag_type;
00428                 struct vfs_handle_struct *sys_acl_get_permset;
00429                 struct vfs_handle_struct *sys_acl_get_qualifier;
00430                 struct vfs_handle_struct *sys_acl_get_file;
00431                 struct vfs_handle_struct *sys_acl_get_fd;
00432                 struct vfs_handle_struct *sys_acl_clear_perms;
00433                 struct vfs_handle_struct *sys_acl_add_perm;
00434                 struct vfs_handle_struct *sys_acl_to_text;
00435                 struct vfs_handle_struct *sys_acl_init;
00436                 struct vfs_handle_struct *sys_acl_create_entry;
00437                 struct vfs_handle_struct *sys_acl_set_tag_type;
00438                 struct vfs_handle_struct *sys_acl_set_qualifier;
00439                 struct vfs_handle_struct *sys_acl_set_permset;
00440                 struct vfs_handle_struct *sys_acl_valid;
00441                 struct vfs_handle_struct *sys_acl_set_file;
00442                 struct vfs_handle_struct *sys_acl_set_fd;
00443                 struct vfs_handle_struct *sys_acl_delete_def_file;
00444                 struct vfs_handle_struct *sys_acl_get_perm;
00445                 struct vfs_handle_struct *sys_acl_free_text;
00446                 struct vfs_handle_struct *sys_acl_free_acl;
00447                 struct vfs_handle_struct *sys_acl_free_qualifier;
00448 
00449                 /* EA operations. */
00450                 struct vfs_handle_struct *getxattr;
00451                 struct vfs_handle_struct *lgetxattr;
00452                 struct vfs_handle_struct *fgetxattr;
00453                 struct vfs_handle_struct *listxattr;
00454                 struct vfs_handle_struct *llistxattr;
00455                 struct vfs_handle_struct *flistxattr;
00456                 struct vfs_handle_struct *removexattr;
00457                 struct vfs_handle_struct *lremovexattr;
00458                 struct vfs_handle_struct *fremovexattr;
00459                 struct vfs_handle_struct *setxattr;
00460                 struct vfs_handle_struct *lsetxattr;
00461                 struct vfs_handle_struct *fsetxattr;
00462 
00463                 /* aio operations */
00464                 struct vfs_handle_struct *aio_read;
00465                 struct vfs_handle_struct *aio_write;
00466                 struct vfs_handle_struct *aio_return;
00467                 struct vfs_handle_struct *aio_cancel;
00468                 struct vfs_handle_struct *aio_error;
00469                 struct vfs_handle_struct *aio_fsync;
00470                 struct vfs_handle_struct *aio_suspend;
00471         } handles;
00472 };
00473 
00474 /*
00475     Possible VFS operation layers (per-operation)
00476     
00477     These values are used by VFS subsystem when building vfs_ops for connection
00478     from multiple VFS modules. Internally, Samba differentiates only opaque and
00479     transparent layers at this process. Other types are used for providing better
00480     diagnosing facilities.
00481     
00482     Most modules will provide transparent layers. Opaque layer is for modules
00483     which implement actual file system calls (like DB-based VFS). For example,
00484     default POSIX VFS which is built in into Samba is an opaque VFS module.
00485     
00486     Other layer types (audit, splitter, scanner) were designed to provide different 
00487     degree of transparency and for diagnosing VFS module behaviour.
00488     
00489     Each module can implement several layers at the same time provided that only
00490     one layer is used per each operation.
00491     
00492 */
00493 
00494 typedef enum _vfs_op_layer {
00495         SMB_VFS_LAYER_NOOP = -1,        /* - For using in VFS module to indicate end of array */
00496                                         /*   of operations description */
00497         SMB_VFS_LAYER_OPAQUE = 0,       /* - Final level, does not call anything beyond itself */
00498         SMB_VFS_LAYER_TRANSPARENT,      /* - Normal operation, calls underlying layer after */
00499                                         /*   possibly changing passed data */
00500         SMB_VFS_LAYER_LOGGER,           /* - Logs data, calls underlying layer, logging may not */
00501                                         /*   use Samba VFS */
00502         SMB_VFS_LAYER_SPLITTER,         /* - Splits operation, calls underlying layer _and_ own facility, */
00503                                         /*   then combines result */
00504         SMB_VFS_LAYER_SCANNER           /* - Checks data and possibly initiates additional */
00505                                         /*   file activity like logging to files _inside_ samba VFS */
00506 } vfs_op_layer;
00507 
00508 /*
00509     VFS operation description. Each VFS module registers an array of vfs_op_tuple to VFS subsystem,
00510     which describes all operations this module is willing to intercept. 
00511     VFS subsystem initializes then the conn->vfs_ops and conn->vfs_opaque_ops structs
00512     using this information.
00513 */
00514 
00515 typedef struct vfs_op_tuple {
00516         void* op;
00517         vfs_op_type type;
00518         vfs_op_layer layer;
00519 } vfs_op_tuple;
00520 
00521 
00522 typedef struct vfs_handle_struct {
00523         struct vfs_handle_struct  *next, *prev;
00524         const char *param;
00525         struct vfs_ops vfs_next;
00526         struct connection_struct *conn;
00527         void *data;
00528         void (*free_data)(void **data);
00529 } vfs_handle_struct;
00530 
00531 
00532 typedef struct vfs_statvfs_struct {
00533         /* For undefined recommended transfer size return -1 in that field */
00534         uint32 OptimalTransferSize;  /* bsize on some os, iosize on other os */
00535         uint32 BlockSize; 
00536 
00537         /*
00538          The next three fields are in terms of the block size.
00539          (above). If block size is unknown, 4096 would be a
00540          reasonable block size for a server to report. 
00541          Note that returning the blocks/blocksavail removes need
00542          to make a second call (to QFSInfo level 0x103 to get this info.
00543          UserBlockAvail is typically less than or equal to BlocksAvail,
00544          if no distinction is made return the same value in each.
00545         */
00546 
00547         SMB_BIG_UINT TotalBlocks;
00548         SMB_BIG_UINT BlocksAvail;       /* bfree */
00549         SMB_BIG_UINT UserBlocksAvail;   /* bavail */
00550 
00551         /* For undefined Node fields or FSID return -1 */
00552         SMB_BIG_UINT TotalFileNodes;
00553         SMB_BIG_UINT FreeFileNodes;
00554         SMB_BIG_UINT FsIdentifier;   /* fsid */
00555         /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
00556         /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call   */
00557 } vfs_statvfs_struct;
00558 
00559 #define VFS_ADD_FSP_EXTENSION(handle, fsp, type) \
00560     vfs_add_fsp_extension_notype(handle, (fsp), sizeof(type))
00561 
00562 #define VFS_FETCH_FSP_EXTENSION(handle, fsp) \
00563     vfs_fetch_fsp_extension(handle, (fsp))
00564 
00565 #define VFS_REMOVE_FSP_EXTENSION(handle, fsp) \
00566     vfs_remove_fsp_extension((handle), (fsp))
00567 
00568 #define SMB_VFS_HANDLE_GET_DATA(handle, datap, type, ret) { \
00569         if (!(handle)||((datap=(type *)(handle)->data)==NULL)) { \
00570                 DEBUG(0,("%s() failed to get vfs_handle->data!\n",FUNCTION_MACRO)); \
00571                 ret; \
00572         } \
00573 }
00574 
00575 #define SMB_VFS_HANDLE_SET_DATA(handle, datap, free_fn, type, ret) { \
00576         if (!(handle)) { \
00577                 DEBUG(0,("%s() failed to set handle->data!\n",FUNCTION_MACRO)); \
00578                 ret; \
00579         } else { \
00580                 if ((handle)->free_data) { \
00581                         (handle)->free_data(&(handle)->data); \
00582                 } \
00583                 (handle)->data = (void *)datap; \
00584                 (handle)->free_data = free_fn; \
00585         } \
00586 }
00587 
00588 #define SMB_VFS_HANDLE_FREE_DATA(handle) { \
00589         if ((handle) && (handle)->free_data) { \
00590                 (handle)->free_data(&(handle)->data); \
00591         } \
00592 }
00593 
00594 /* Check whether module-specific data handle was already allocated or not */
00595 #define SMB_VFS_HANDLE_TEST_DATA(handle)  ( !(handle) || !(handle)->data ? False : True )
00596 
00597 #define SMB_VFS_OP(x) ((void *) x)
00598 
00599 #define DEFAULT_VFS_MODULE_NAME "/[Default VFS]/"
00600 
00601 #include "vfs_macros.h"
00602 
00603 #endif /* _VFS_H */

Sambaに対してSat Aug 29 21:22:58 2009に生成されました。  doxygen 1.4.7