s3:vfs: add create tags to SMB_VFS_CREATEFILE
[obnox/samba/samba-obnox.git] / source3 / include / vfs.h
index d60cb5e73bc815b84564faecf629dbdae0c76e3b..1843ef428ee3f58f0b5c36038bf9b85849069915 100644 (file)
                connection_struct a pointer. */
 /* Leave at 31 - not yet released. Add share_access to vuid_cache_entry. */
 /* Leave at 31 - not yet released. add SMB_VFS_COPY_CHUNK() */
+/* Leave at 31 - not yet released. Remove the unused
+               fsp->pending_break_messages array */
+/* Leave at 31 - not yet released. add SMB_VFS_[GET/SET]_COMPRESSION() */
 
-#define SMB_VFS_INTERFACE_VERSION 31
+/* Bump to version 32 - Samba 4.2 will ship with that. */
+/* Version 32 - Add "lease" to CREATE_FILE operation */
+/* Version 32 - Add "lease" to struct files_struct */
+/* Version 32 - Add SMB_VFS_READDIR_ATTR() */
+/* Version 32 - Add in and our create context blobs to create_file */
+
+#define SMB_VFS_INTERFACE_VERSION 32
 
 /*
     All intercepted VFS operations must be declared as static functions inside module source
@@ -196,6 +205,13 @@ struct fd_handle {
        unsigned long gen_id;
 };
 
+struct fsp_lease {
+       size_t ref_count;
+       struct smbd_server_connection *sconn;
+       struct tevent_timer *timeout;
+       struct smb2_lease lease;
+};
+
 typedef struct files_struct {
        struct files_struct *next, *prev;
        uint64_t fnum;
@@ -213,27 +229,24 @@ typedef struct files_struct {
        uint32 share_access;            /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */
 
        bool update_write_time_triggered;
-       struct timed_event *update_write_time_event;
+       struct tevent_timer *update_write_time_event;
        bool update_write_time_on_close;
        struct timespec close_write_time;
        bool write_time_forced;
 
        int oplock_type;
+       struct fsp_lease *lease; /* Not yet used. Placeholder for leases. */
        int sent_oplock_break;
-       struct timed_event *oplock_timeout;
+       struct tevent_timer *oplock_timeout;
        struct lock_struct last_lock_failure;
        int current_lock_count; /* Count the number of outstanding locks and pending locks. */
 
-       struct share_mode_entry *pending_break_messages;
-       int num_pending_break_messages;
-
        bool can_lock;
        bool can_read;
        bool can_write;
        bool modified;
        bool is_directory;
        bool aio_write_behind;
-       bool lockdb_clean;
        bool initial_delete_on_close; /* Only set at NTCreateX if file was created. */
        bool delete_on_close;
        bool posix_open;
@@ -403,6 +416,7 @@ struct smb_request {
        bool encrypted;
        connection_struct *conn;
        struct smbd_server_connection *sconn;
+       struct smbXsrv_connection *xconn;
        struct smb_perfcount_data pcd;
 
        /*
@@ -534,12 +548,15 @@ struct vfs_fn_pointers {
                                   uint32_t create_options,
                                   uint32_t file_attributes,
                                   uint32_t oplock_request,
+                                  struct smb2_lease *lease,
                                   uint64_t allocation_size,
                                   uint32_t private_flags,
                                   struct security_descriptor *sd,
                                   struct ea_list *ea_list,
                                   files_struct **result,
-                                  int *pinfo);
+                                  int *pinfo,
+                                  const struct smb2_create_blobs *in_context_blobs,
+                                  struct smb2_create_blobs *out_context_blobs);
        int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
        ssize_t (*read_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n);
        ssize_t (*pread_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, off_t offset);
@@ -627,6 +644,15 @@ struct vfs_fn_pointers {
        NTSTATUS (*copy_chunk_recv_fn)(struct vfs_handle_struct *handle,
                                       struct tevent_req *req,
                                       off_t *copied);
+       NTSTATUS (*get_compression_fn)(struct vfs_handle_struct *handle,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct files_struct *fsp,
+                                      struct smb_filename *smb_fname,
+                                      uint16_t *_compression_fmt);
+       NTSTATUS (*set_compression_fn)(struct vfs_handle_struct *handle,
+                                      TALLOC_CTX *mem_ctx,
+                                      struct files_struct *fsp,
+                                      uint16_t compression_fmt);
 
        NTSTATUS (*streaminfo_fn)(struct vfs_handle_struct *handle,
                                  struct files_struct *fsp,
@@ -647,8 +673,7 @@ 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 blocking_lock_record *blr);
+                                       bool blocking_lock);
 
        bool (*brl_unlock_windows_fn)(struct vfs_handle_struct *handle,
                                      struct messaging_context *msg_ctx,
@@ -657,8 +682,7 @@ struct vfs_fn_pointers {
 
        bool (*brl_cancel_windows_fn)(struct vfs_handle_struct *handle,
                                      struct byte_range_lock *br_lck,
-                                     struct lock_struct *plock,
-                                     struct blocking_lock_record *blr);
+                                     struct lock_struct *plock);
 
        bool (*strict_lock_fn)(struct vfs_handle_struct *handle,
                               struct files_struct *fsp,
@@ -769,6 +793,11 @@ struct vfs_fn_pointers {
                                         TALLOC_CTX *mem_ctx,
                                         struct files_struct **fsp,
                                         DATA_BLOB *new_cookie);
+
+       NTSTATUS (*readdir_attr_fn)(struct vfs_handle_struct *handle,
+                                   const struct smb_filename *fname,
+                                   TALLOC_CTX *mem_ctx,
+                                   struct readdir_attr_data **attr_data);
 };
 
 /*
@@ -932,12 +961,15 @@ 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,
                                  uint64_t allocation_size,
                                  uint32_t private_flags,
                                  struct security_descriptor *sd,
                                  struct ea_list *ea_list,
                                  files_struct **result,
-                                 int *pinfo);
+                                 int *pinfo,
+                                 const struct smb2_create_blobs *in_context_blobs,
+                                 struct smb2_create_blobs *out_context_blobs);
 int smb_vfs_call_close(struct vfs_handle_struct *handle,
                       struct files_struct *fsp);
 ssize_t smb_vfs_call_read(struct vfs_handle_struct *handle,
@@ -1068,16 +1100,14 @@ const char *smb_vfs_call_connectpath(struct vfs_handle_struct *handle,
 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 blocking_lock_record *blr);
+                                      bool blocking_lock);
 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_brl_cancel_windows(struct vfs_handle_struct *handle,
                                     struct byte_range_lock *br_lck,
-                                    struct lock_struct *plock,
-                                    struct blocking_lock_record *blr);
+                                    struct lock_struct *plock);
 bool smb_vfs_call_strict_lock(struct vfs_handle_struct *handle,
                              struct files_struct *fsp,
                              struct lock_struct *plock);
@@ -1110,6 +1140,15 @@ struct tevent_req *smb_vfs_call_copy_chunk_send(struct vfs_handle_struct *handle
 NTSTATUS smb_vfs_call_copy_chunk_recv(struct vfs_handle_struct *handle,
                                      struct tevent_req *req,
                                      off_t *copied);
+NTSTATUS smb_vfs_call_get_compression(struct vfs_handle_struct *handle,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct files_struct *fsp,
+                                     struct smb_filename *smb_fname,
+                                     uint16_t *_compression_fmt);
+NTSTATUS smb_vfs_call_set_compression(struct vfs_handle_struct *handle,
+                                     TALLOC_CTX *mem_ctx,
+                                     struct files_struct *fsp,
+                                     uint16_t compression_fmt);
 NTSTATUS smb_vfs_call_fget_nt_acl(struct vfs_handle_struct *handle,
                                  struct files_struct *fsp,
                                  uint32 security_info,
@@ -1206,6 +1245,10 @@ NTSTATUS smb_vfs_call_durable_reconnect(struct vfs_handle_struct *handle,
                                        TALLOC_CTX *mem_ctx,
                                        struct files_struct **fsp,
                                        DATA_BLOB *new_cookie);
+NTSTATUS smb_vfs_call_readdir_attr(struct vfs_handle_struct *handle,
+                                  const struct smb_filename *fname,
+                                  TALLOC_CTX *mem_ctx,
+                                  struct readdir_attr_data **attr_data);
 
 NTSTATUS smb_register_vfs(int version, const char *name,
                          const struct vfs_fn_pointers *fns);