Update vfs version as I've added a const to the security_descriptor paramter in fset_...
[jra/samba/.git] / source3 / include / vfs.h
index 2174042d7c07d223de5e1b156aa4aa185e06592e..a3d38f6a25d2becaa3686d814b7400a73fe4c42f 100644 (file)
 /* Leave at 22 - not yet released. Remove parameter fd from fgetxattr. - obnox */
 /* Leave at 22 - not yet released. Remove parameter fd from flistxattr. - obnox */
 /* Leave at 22 - not yet released. Remove parameter fd from fremovexattr. - obnox */
-
-
-
-#define SMB_VFS_INTERFACE_VERSION 22
+/* Leave at 22 - not yet released. Remove parameter fd from fsetxattr. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from aio_cancel. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from read. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from write. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fromfd from sendfile. - obnox */
+/* 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. */
+
+#define SMB_VFS_INTERFACE_VERSION 24
 
 
 /* to bug old modules which are trying to compile with the old functions */
@@ -143,6 +153,7 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_SET_QUOTA,
        SMB_VFS_OP_GET_SHADOW_COPY_DATA,
        SMB_VFS_OP_STATVFS,
+       SMB_VFS_OP_FS_CAPABILITIES,
 
        /* Directory operations */
 
@@ -193,13 +204,13 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_NOTIFY_WATCH,
        SMB_VFS_OP_CHFLAGS,
        SMB_VFS_OP_FILE_ID_CREATE,
+       SMB_VFS_OP_STREAMINFO,
 
        /* 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. */
 
@@ -251,9 +262,14 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_AIO_ERROR,
        SMB_VFS_OP_AIO_FSYNC,
        SMB_VFS_OP_AIO_SUSPEND,
+        SMB_VFS_OP_AIO_FORCE,
+
+       /* offline operations */
+       SMB_VFS_OP_IS_OFFLINE,
+       SMB_VFS_OP_SET_OFFLINE,
 
        /* This should always be last enum value */
-       
+
        SMB_VFS_OP_LAST
 } vfs_op_type;
 
@@ -263,7 +279,7 @@ typedef enum _vfs_op_type {
 struct vfs_ops {
        struct vfs_fn_pointers {
                /* Disk operations */
-               
+
                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,
@@ -272,9 +288,10 @@ struct vfs_ops {
                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);
                int (*statvfs)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf);
-               
+               uint32_t (*fs_capabilities)(struct vfs_handle_struct *handle);
+
                /* 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);
                void (*seekdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset);
@@ -283,18 +300,18 @@ struct vfs_ops {
                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);
-               
+
                /* 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, int fd, void *data, size_t n);
+               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, int fd, const void *data, size_t n);
+               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);
                SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset, int whence);
-               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);
-               ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *fsp, int tofd, SMB_OFF_T offset, size_t count);
+               ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
+               ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t count);
                int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname);
                int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp);
                int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf);
@@ -315,7 +332,7 @@ struct vfs_ops {
                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);
@@ -329,8 +346,15 @@ struct vfs_ops {
                int (*chflags)(struct vfs_handle_struct *handle, const char *path, unsigned int flags);
                struct file_id (*file_id_create)(struct vfs_handle_struct *handle, SMB_DEV_T dev, SMB_INO_T inode);
 
+               NTSTATUS (*streaminfo)(struct vfs_handle_struct *handle,
+                                      struct files_struct *fsp,
+                                      const char *fname,
+                                      TALLOC_CTX *mem_ctx,
+                                      unsigned int *num_streams,
+                                      struct stream_struct **streams);
+
                /* NT ACL operations. */
-               
+
                NTSTATUS (*fget_nt_acl)(struct vfs_handle_struct *handle,
                                        struct files_struct *fsp,
                                        uint32 security_info,
@@ -342,18 +366,13 @@ 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. */
-               
+
                int (*chmod_acl)(struct vfs_handle_struct *handle, const char *name, mode_t mode);
                int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
-               
+
                int (*sys_acl_get_entry)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
                int (*sys_acl_get_tag_type)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
                int (*sys_acl_get_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
@@ -389,17 +408,21 @@ struct vfs_ops {
                int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name);
                int (*setxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags);
                int (*lsetxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags);
-               int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp,int filedes, const char *name, const void *value, size_t size, int flags);
+               int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags);
 
                /* aio operations */
                int (*aio_read)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
                int (*aio_write)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
                ssize_t (*aio_return_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
-               int (*aio_cancel)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_STRUCT_AIOCB *aiocb);
+               int (*aio_cancel)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
                int (*aio_error_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
                int (*aio_fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb);
                int (*aio_suspend)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *timeout);
+               bool (*aio_force)(struct vfs_handle_struct *handle, struct files_struct *fsp);
 
+               /* offline operations */
+               bool (*is_offline)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
+               int (*set_offline)(struct vfs_handle_struct *handle, const char *path);
        } ops;
 
        struct vfs_handles_pointers {
@@ -412,6 +435,7 @@ struct vfs_ops {
                struct vfs_handle_struct *set_quota;
                struct vfs_handle_struct *get_shadow_copy_data;
                struct vfs_handle_struct *statvfs;
+               struct vfs_handle_struct *fs_capabilities;
 
                /* Directory operations */
 
@@ -428,7 +452,7 @@ struct vfs_ops {
 
                struct vfs_handle_struct *open;
                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;
@@ -455,20 +479,20 @@ 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;
                struct vfs_handle_struct *notify_watch;
                struct vfs_handle_struct *chflags;
                struct vfs_handle_struct *file_id_create;
+               struct vfs_handle_struct *streaminfo;
 
                /* 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. */
 
@@ -520,27 +544,32 @@ struct vfs_ops {
                struct vfs_handle_struct *aio_error;
                struct vfs_handle_struct *aio_fsync;
                struct vfs_handle_struct *aio_suspend;
+               struct vfs_handle_struct *aio_force;
+
+               /* offline operations */
+               struct vfs_handle_struct *is_offline;
+               struct vfs_handle_struct *set_offline;
        } handles;
 };
 
 /*
     Possible VFS operation layers (per-operation)
-    
+
     These values are used by VFS subsystem when building vfs_ops for connection
     from multiple VFS modules. Internally, Samba differentiates only opaque and
     transparent layers at this process. Other types are used for providing better
     diagnosing facilities.
-    
+
     Most modules will provide transparent layers. Opaque layer is for modules
     which implement actual file system calls (like DB-based VFS). For example,
     default POSIX VFS which is built in into Samba is an opaque VFS module.
-    
+
     Other layer types (audit, splitter, scanner) were designed to provide different 
     degree of transparency and for diagnosing VFS module behaviour.
-    
+
     Each module can implement several layers at the same time provided that only
     one layer is used per each operation.
-    
+
 */
 
 typedef enum _vfs_op_layer {
@@ -559,7 +588,7 @@ typedef enum _vfs_op_layer {
 
 /*
     VFS operation description. Each VFS module registers an array of vfs_op_tuple to VFS subsystem,
-    which describes all operations this module is willing to intercept. 
+    which describes all operations this module is willing to intercept.
     VFS subsystem initializes then the conn->vfs_ops and conn->vfs_opaque_ops structs
     using this information.
 */
@@ -584,12 +613,12 @@ typedef struct vfs_handle_struct {
 typedef struct vfs_statvfs_struct {
        /* For undefined recommended transfer size return -1 in that field */
        uint32 OptimalTransferSize;  /* bsize on some os, iosize on other os */
-       uint32 BlockSize; 
+       uint32 BlockSize;
 
        /*
         The next three fields are in terms of the block size.
         (above). If block size is unknown, 4096 would be a
-        reasonable block size for a server to report. 
+        reasonable block size for a server to report.
         Note that returning the blocks/blocksavail removes need
         to make a second call (to QFSInfo level 0x103 to get this info.
         UserBlockAvail is typically less than or equal to BlocksAvail,