s3: OneFS bulk directory enumeration support
[ira/wip.git] / source3 / include / vfs.h
index ca176aabb2b2f257d19ae384b970f09078db36d3..f944c899c643c7f5b2fa6bc21d02481c65b80300 100644 (file)
 /* Leave at 22 - not yet released. Remove parameter fromfd from recvfile. - obnox */
 /* Leave at 22 - not yet released. Additional change: add operations for offline files -- ab */
 /* Leave at 22 - not yet released. Add the streaminfo call. -- jpeach, vl */
+/* Leave at 22 - not yet released. Remove parameter fd from close_fn. - obnox */
+/* Changed to version 23 - remove set_nt_acl call. This can only be done via an
+   open handle. JRA. */
+/* Changed to version 24 - make security descriptor const in fset_nt_acl. JRA. */
+/* Changed to version 25 - Jelmer's change from SMB_BIG_UINT to uint64_t. */
+/* Leave at 25 - not yet released. Add create_file call. -- tprouty. */
+/* Leave at 25 - not yet released. Add create time to ntimes. -- tstecher. */
+/* Leave at 25 - not yet released. Add get_alloc_size call. -- tprouty. */
+/* Leave at 25 - not yet released. Add SMB_STRUCT_STAT to readdir. - sdann */
+/* Leave at 25 - not yet released. Add init_search_op call. - sdann */
 
-#define SMB_VFS_INTERFACE_VERSION 22
+#define SMB_VFS_INTERFACE_VERSION 25
 
 
 /* to bug old modules which are trying to compile with the old functions */
@@ -129,17 +139,20 @@ struct connection_struct;
 struct files_struct;
 struct security_descriptor;
 struct vfs_statvfs_struct;
+struct smb_request;
+struct ea_list;
+struct smb_file_time;
 
 /*
     Available VFS operations. These values must be in sync with vfs_ops struct
-    (struct vfs_fn_pointers and struct vfs_handle_pointers inside of struct vfs_ops). 
+    (struct vfs_fn_pointers and struct vfs_handle_pointers inside of struct vfs_ops).
     In particular, if new operations are added to vfs_ops, appropriate constants
     should be added to vfs_op_type so that order of them kept same as in vfs_ops.
 */
 
 typedef enum _vfs_op_type {
        SMB_VFS_OP_NOOP = -1,
-       
+
        /* Disk operations */
 
        SMB_VFS_OP_CONNECT = 0,
@@ -161,10 +174,12 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_MKDIR,
        SMB_VFS_OP_RMDIR,
        SMB_VFS_OP_CLOSEDIR,
+       SMB_VFS_OP_INIT_SEARCH_OP,
 
        /* File operations */
 
        SMB_VFS_OP_OPEN,
+       SMB_VFS_OP_CREATE_FILE,
        SMB_VFS_OP_CLOSE,
        SMB_VFS_OP_READ,
        SMB_VFS_OP_PREAD,
@@ -178,6 +193,7 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_STAT,
        SMB_VFS_OP_FSTAT,
        SMB_VFS_OP_LSTAT,
+       SMB_VFS_OP_GET_ALLOC_SIZE,
        SMB_VFS_OP_UNLINK,
        SMB_VFS_OP_CHMOD,
        SMB_VFS_OP_FCHMOD,
@@ -201,13 +217,13 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_CHFLAGS,
        SMB_VFS_OP_FILE_ID_CREATE,
        SMB_VFS_OP_STREAMINFO,
+       SMB_VFS_OP_GET_REAL_FILENAME,
 
        /* NT ACL operations. */
 
        SMB_VFS_OP_FGET_NT_ACL,
        SMB_VFS_OP_GET_NT_ACL,
        SMB_VFS_OP_FSET_NT_ACL,
-       SMB_VFS_OP_SET_NT_ACL,
 
        /* POSIX ACL operations. */
 
@@ -236,7 +252,7 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_SYS_ACL_FREE_TEXT,
        SMB_VFS_OP_SYS_ACL_FREE_ACL,
        SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER,
-       
+
        /* EA operations. */
        SMB_VFS_OP_GETXATTR,
        SMB_VFS_OP_LGETXATTR,
@@ -279,8 +295,8 @@ struct vfs_ops {
 
                int (*connect_fn)(struct vfs_handle_struct *handle, const char *service, const char *user);
                void (*disconnect)(struct vfs_handle_struct *handle);
-               SMB_BIG_UINT (*disk_free)(struct vfs_handle_struct *handle, const char *path, bool small_query, SMB_BIG_UINT *bsize,
-                       SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
+               uint64_t (*disk_free)(struct vfs_handle_struct *handle, const char *path, bool small_query, uint64_t *bsize,
+                       uint64_t *dfree, uint64_t *dsize);
                int (*get_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
                int (*set_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
                int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels);
@@ -290,19 +306,39 @@ struct vfs_ops {
                /* Directory operations */
 
                SMB_STRUCT_DIR *(*opendir)(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attributes);
-               SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
+               SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle,
+                                             SMB_STRUCT_DIR *dirp,
+                                             SMB_STRUCT_STAT *sbuf);
                void (*seekdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset);
                long (*telldir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
                void (*rewind_dir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
                int (*mkdir)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
                int (*rmdir)(struct vfs_handle_struct *handle, const char *path);
                int (*closedir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dir);
+               void (*init_search_op)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
 
                /* File operations */
 
                int (*open)(struct vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode);
-               int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
-               ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n);
+               NTSTATUS (*create_file)(struct vfs_handle_struct *handle,
+                                       struct smb_request *req,
+                                       uint16_t root_dir_fid,
+                                       const char *fname,
+                                       uint32_t create_file_flags,
+                                       uint32_t access_mask,
+                                       uint32_t share_access,
+                                       uint32_t create_disposition,
+                                       uint32_t create_options,
+                                       uint32_t file_attributes,
+                                       uint32_t oplock_request,
+                                       uint64_t allocation_size,
+                                       struct security_descriptor *sd,
+                                       struct ea_list *ea_list,
+                                       files_struct **result,
+                                       int *pinfo,
+                                       SMB_STRUCT_STAT *psbuf);
+               int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
+               ssize_t (*vfs_read)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n);
                ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset);
                ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n);
                ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset);
@@ -314,6 +350,7 @@ struct vfs_ops {
                int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf);
                int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
                int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
+               uint64_t (*get_alloc_size)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
                int (*unlink)(struct vfs_handle_struct *handle, const char *path);
                int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
                int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
@@ -322,14 +359,14 @@ struct vfs_ops {
                int (*lchown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
                int (*chdir)(struct vfs_handle_struct *handle, const char *path);
                char *(*getwd)(struct vfs_handle_struct *handle, char *buf);
-               int (*ntimes)(struct vfs_handle_struct *handle, const char *path, const struct timespec ts[2]);
+               int (*ntimes)(struct vfs_handle_struct *handle, const char *path, struct smb_file_time *ft);
                int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset);
                bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
                int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode);
                int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype);
                bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
                int (*symlink)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
-               int (*readlink)(struct vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz);
+               int (*vfs_readlink)(struct vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz);
                int (*link)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
                int (*mknod)(struct vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev);
                char *(*realpath)(struct vfs_handle_struct *handle, const char *path, char *resolved_path);
@@ -350,6 +387,12 @@ struct vfs_ops {
                                       unsigned int *num_streams,
                                       struct stream_struct **streams);
 
+               int (*get_real_filename)(struct vfs_handle_struct *handle,
+                                        const char *path,
+                                        const char *name,
+                                        TALLOC_CTX *mem_ctx,
+                                        char **found_name);
+
                /* NT ACL operations. */
 
                NTSTATUS (*fget_nt_acl)(struct vfs_handle_struct *handle,
@@ -363,12 +406,7 @@ struct vfs_ops {
                NTSTATUS (*fset_nt_acl)(struct vfs_handle_struct *handle,
                                        struct files_struct *fsp,
                                        uint32 security_info_sent,
-                                       struct security_descriptor *psd);
-               NTSTATUS (*set_nt_acl)(struct vfs_handle_struct *handle,
-                                      struct files_struct *fsp,
-                                      const char *name,
-                                      uint32 security_info_sent,
-                                      struct security_descriptor *psd);
+                                       const struct security_descriptor *psd);
 
                /* POSIX ACL operations. */
 
@@ -449,12 +487,14 @@ struct vfs_ops {
                struct vfs_handle_struct *mkdir;
                struct vfs_handle_struct *rmdir;
                struct vfs_handle_struct *closedir;
+               struct vfs_handle_struct *init_search_op;
 
                /* File operations */
 
                struct vfs_handle_struct *open;
+               struct vfs_handle_struct *create_file;
                struct vfs_handle_struct *close_hnd;
-               struct vfs_handle_struct *read;
+               struct vfs_handle_struct *vfs_read;
                struct vfs_handle_struct *pread;
                struct vfs_handle_struct *write;
                struct vfs_handle_struct *pwrite;
@@ -466,6 +506,7 @@ struct vfs_ops {
                struct vfs_handle_struct *stat;
                struct vfs_handle_struct *fstat;
                struct vfs_handle_struct *lstat;
+               struct vfs_handle_struct *get_alloc_size;
                struct vfs_handle_struct *unlink;
                struct vfs_handle_struct *chmod;
                struct vfs_handle_struct *fchmod;
@@ -481,7 +522,7 @@ struct vfs_ops {
                struct vfs_handle_struct *linux_setlease;
                struct vfs_handle_struct *getlock;
                struct vfs_handle_struct *symlink;
-               struct vfs_handle_struct *readlink;
+               struct vfs_handle_struct *vfs_readlink;
                struct vfs_handle_struct *link;
                struct vfs_handle_struct *mknod;
                struct vfs_handle_struct *realpath;
@@ -489,13 +530,13 @@ struct vfs_ops {
                struct vfs_handle_struct *chflags;
                struct vfs_handle_struct *file_id_create;
                struct vfs_handle_struct *streaminfo;
+               struct vfs_handle_struct *get_real_filename;
 
                /* NT ACL operations. */
 
                struct vfs_handle_struct *fget_nt_acl;
                struct vfs_handle_struct *get_nt_acl;
                struct vfs_handle_struct *fset_nt_acl;
-               struct vfs_handle_struct *set_nt_acl;
 
                /* POSIX ACL operations. */
 
@@ -628,14 +669,14 @@ typedef struct vfs_statvfs_struct {
         if no distinction is made return the same value in each.
        */
 
-       SMB_BIG_UINT TotalBlocks;
-       SMB_BIG_UINT BlocksAvail;       /* bfree */
-       SMB_BIG_UINT UserBlocksAvail;   /* bavail */
+       uint64_t TotalBlocks;
+       uint64_t BlocksAvail;       /* bfree */
+       uint64_t UserBlocksAvail;   /* bavail */
 
        /* For undefined Node fields or FSID return -1 */
-       SMB_BIG_UINT TotalFileNodes;
-       SMB_BIG_UINT FreeFileNodes;
-       SMB_BIG_UINT FsIdentifier;   /* fsid */
+       uint64_t TotalFileNodes;
+       uint64_t FreeFileNodes;
+       uint64_t FsIdentifier;   /* fsid */
        /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
        /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call   */
 
@@ -645,8 +686,8 @@ typedef struct vfs_statvfs_struct {
 /* Add a new FSP extension of the given type. Returns a pointer to the
  * extenstion data.
  */
-#define VFS_ADD_FSP_EXTENSION(handle, fsp, type) \
-    vfs_add_fsp_extension_notype(handle, (fsp), sizeof(type))
+#define VFS_ADD_FSP_EXTENSION(handle, fsp, type, destroy_fn)           \
+    vfs_add_fsp_extension_notype(handle, (fsp), sizeof(type), (destroy_fn))
 
 /* Return a pointer to the existing FSP extension data. */
 #define VFS_FETCH_FSP_EXTENSION(handle, fsp) \