s3: VFS: Complete the replacement of SMB_VFS_RENAME() -> SMB_VFS_RENAMEAT().
[bbaumbach/samba-autobuild/.git] / source3 / include / vfs.h
index 67cbe758674365c3f3960cfa037be87787651c30..dc407772079f437a69d88824bd045424902838b5 100644 (file)
 /* Version 40 - Add SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV */
 /* Bump to version 41, Samba 4.11 will ship with that */
 /* Version 41 - Remove SMB_VFS_BRL_CANCEL_WINDOWS */
-
-#define SMB_VFS_INTERFACE_VERSION 41
+/* Version 41 - Remove unused st_ex_mask from struct stat_ex */
+/* Version 41 - convert struct stat_ex.st_ex_calculated_birthtime to flags */
+/* Version 41 - add st_ex_itime to struct stat_ex */
+/* Version 41 - add st_ex_file_id to struct stat_ex */
+/* Version 41 - add SMB_VFS_FS_FILE_ID */
+/* Version 41 - Remove "blocking_lock" parameter from
+                SMB_VFS_BRL_LOCK_WINDOWS */
+/* Version 41 - Remove "msg_ctx" parameter from SMB_VFS_BRL_UNLOCK_WINDOWS */
+/* Bump to version 42, Samba 4.12 will ship with that */
+/* Version 42 - Remove share_access member from struct files_struct */
+/* Version 42 - Make "lease" a const* in create_file_fn */
+/* Version 42 - Move SMB_VFS_RENAME -> SMB_VFS_RENAMEAT */
+
+#define SMB_VFS_INTERFACE_VERSION 42
 
 /*
     All intercepted VFS operations must be declared as static functions inside module source
@@ -325,8 +337,6 @@ typedef struct files_struct {
        struct write_cache *wcp;
        struct timeval open_time;
        uint32_t access_mask;           /* NTCreateX access bits (FILE_READ_DATA etc.) */
-       uint32_t share_access;          /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */
-
        bool kernel_share_modes_taken;
 
        bool update_write_time_triggered;
@@ -366,6 +376,12 @@ typedef struct files_struct {
 
        struct files_struct *base_fsp; /* placeholder for delete on close */
 
+       /*
+        * Cache of share_mode_data->flags
+        */
+       int share_mode_flags_seqnum;
+       uint8_t share_mode_flags;
+
        /*
         * Read-only cached brlock record, thrown away when the
         * brlock.tdb seqnum changes. This avoids fetching data from
@@ -460,7 +476,7 @@ typedef struct connection_struct {
        enum timestamp_set_resolution ts_res;
        char *connectpath;
        char *origpath;
-       struct smb_filename *cwd_fname; /* Working directory. */
+       struct files_struct *cwd_fsp; /* Working directory. */
        bool tcon_done;
 
        struct vfs_handle_struct *vfs_handles;          /* for the new plugins */
@@ -700,7 +716,7 @@ struct vfs_fn_pointers {
                                   uint32_t create_options,
                                   uint32_t file_attributes,
                                   uint32_t oplock_request,
-                                  struct smb2_lease *lease,
+                                  const struct smb2_lease *lease,
                                   uint64_t allocation_size,
                                   uint32_t private_flags,
                                   struct security_descriptor *sd,
@@ -729,8 +745,10 @@ struct vfs_fn_pointers {
        off_t (*lseek_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t offset, int whence);
        ssize_t (*sendfile_fn)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, off_t offset, size_t count);
        ssize_t (*recvfile_fn)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, off_t offset, size_t count);
-       int (*rename_fn)(struct vfs_handle_struct *handle,
+       int (*renameat_fn)(struct vfs_handle_struct *handle,
+                        struct files_struct *srcdir_fsp,
                         const struct smb_filename *smb_fname_src,
+                        struct files_struct *dstdir_fsp,
                         const struct smb_filename *smb_fname_dst);
        struct tevent_req *(*fsync_send_fn)(struct vfs_handle_struct *handle,
                                            TALLOC_CTX *mem_ctx,
@@ -796,6 +814,8 @@ struct vfs_fn_pointers {
                                unsigned int flags);
        struct file_id (*file_id_create_fn)(struct vfs_handle_struct *handle,
                                            const SMB_STRUCT_STAT *sbuf);
+       uint64_t (*fs_file_id_fn)(struct vfs_handle_struct *handle,
+                                 const SMB_STRUCT_STAT *sbuf);
        struct tevent_req *(*offload_read_send_fn)(TALLOC_CTX *mem_ctx,
                                                   struct tevent_context *ev,
                                                   struct vfs_handle_struct *handle,
@@ -863,11 +883,9 @@ struct vfs_fn_pointers {
 
        NTSTATUS (*brl_lock_windows_fn)(struct vfs_handle_struct *handle,
                                        struct byte_range_lock *br_lck,
-                                       struct lock_struct *plock,
-                                       bool blocking_lock);
+                                       struct lock_struct *plock);
 
        bool (*brl_unlock_windows_fn)(struct vfs_handle_struct *handle,
-                                     struct messaging_context *msg_ctx,
                                      struct byte_range_lock *br_lck,
                                      const struct lock_struct *plock);
 
@@ -1197,7 +1215,7 @@ NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
                                  uint32_t create_options,
                                  uint32_t file_attributes,
                                  uint32_t oplock_request,
-                                 struct smb2_lease *lease,
+                                 const struct smb2_lease *lease,
                                  uint64_t allocation_size,
                                  uint32_t private_flags,
                                  struct security_descriptor *sd,
@@ -1239,8 +1257,10 @@ ssize_t smb_vfs_call_sendfile(struct vfs_handle_struct *handle, int tofd,
 ssize_t smb_vfs_call_recvfile(struct vfs_handle_struct *handle, int fromfd,
                              files_struct *tofsp, off_t offset,
                              size_t count);
-int smb_vfs_call_rename(struct vfs_handle_struct *handle,
+int smb_vfs_call_renameat(struct vfs_handle_struct *handle,
+                       struct files_struct *srcfsp,
                        const struct smb_filename *smb_fname_src,
+                       struct files_struct *dstfsp,
                        const struct smb_filename *smb_fname_dst);
 
 struct tevent_req *smb_vfs_call_fsync_send(struct vfs_handle_struct *handle,
@@ -1323,6 +1343,8 @@ int smb_vfs_call_chflags(struct vfs_handle_struct *handle,
                        unsigned int flags);
 struct file_id smb_vfs_call_file_id_create(struct vfs_handle_struct *handle,
                                           const SMB_STRUCT_STAT *sbuf);
+uint64_t smb_vfs_call_fs_file_id(struct vfs_handle_struct *handle,
+                                const SMB_STRUCT_STAT *sbuf);
 NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
                                 struct files_struct *fsp,
                                 const struct smb_filename *smb_fname,
@@ -1336,10 +1358,8 @@ const char *smb_vfs_call_connectpath(struct vfs_handle_struct *handle,
                                     const struct smb_filename *smb_fname);
 NTSTATUS smb_vfs_call_brl_lock_windows(struct vfs_handle_struct *handle,
                                       struct byte_range_lock *br_lck,
-                                      struct lock_struct *plock,
-                                      bool blocking_lock);
+                                      struct lock_struct *plock);
 bool smb_vfs_call_brl_unlock_windows(struct vfs_handle_struct *handle,
-                                    struct messaging_context *msg_ctx,
                                     struct byte_range_lock *br_lck,
                                     const struct lock_struct *plock);
 bool smb_vfs_call_strict_lock_check(struct vfs_handle_struct *handle,
@@ -1635,7 +1655,7 @@ NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle,
                                uint32_t create_options,
                                uint32_t file_attributes,
                                uint32_t oplock_request,
-                               struct smb2_lease *lease,
+                               const struct smb2_lease *lease,
                                uint64_t allocation_size,
                                uint32_t private_flags,
                                struct security_descriptor *sd,
@@ -1670,8 +1690,10 @@ ssize_t vfs_not_implemented_sendfile(vfs_handle_struct *handle, int tofd,
                                     off_t offset, size_t n);
 ssize_t vfs_not_implemented_recvfile(vfs_handle_struct *handle, int fromfd,
                                     files_struct *tofsp, off_t offset, size_t n);
-int vfs_not_implemented_rename(vfs_handle_struct *handle,
+int vfs_not_implemented_renameat(vfs_handle_struct *handle,
+                              files_struct *srcfsp,
                               const struct smb_filename *smb_fname_src,
+                              files_struct *dstfsp,
                               const struct smb_filename *smb_fname_dst);
 struct tevent_req *vfs_not_implemented_fsync_send(struct vfs_handle_struct *handle,
                                                  TALLOC_CTX *mem_ctx,
@@ -1747,6 +1769,8 @@ int vfs_not_implemented_chflags(vfs_handle_struct *handle,
                                uint flags);
 struct file_id vfs_not_implemented_file_id_create(vfs_handle_struct *handle,
                                                  const SMB_STRUCT_STAT *sbuf);
+uint64_t vfs_not_implemented_fs_file_id(vfs_handle_struct *handle,
+                                       const SMB_STRUCT_STAT *sbuf);
 struct tevent_req *vfs_not_implemented_offload_read_send(
                        TALLOC_CTX *mem_ctx,
                        struct tevent_context *ev,
@@ -1797,10 +1821,8 @@ const char *vfs_not_implemented_connectpath(struct vfs_handle_struct *handle,
                                            const struct smb_filename *smb_fname);
 NTSTATUS vfs_not_implemented_brl_lock_windows(struct vfs_handle_struct *handle,
                                              struct byte_range_lock *br_lck,
-                                             struct lock_struct *plock,
-                                             bool blocking_lock);
+                                             struct lock_struct *plock);
 bool vfs_not_implemented_brl_unlock_windows(struct vfs_handle_struct *handle,
-                                           struct messaging_context *msg_ctx,
                                            struct byte_range_lock *br_lck,
                                            const struct lock_struct *plock);
 bool vfs_not_implemented_strict_lock_check(struct vfs_handle_struct *handle,