s3: locking: Add a const struct lock_context * paramter to set_posix_lock_posix_flavour()
[sharpe/samba-autobuild/.git] / source3 / locking / proto.h
index 1e559c9a0348031549bfd82ab5ccb1833daaef12..13499cfbf41bed1d0c2b3e56ca57c5d701746a39 100644 (file)
@@ -30,9 +30,9 @@ void brl_shutdown(void);
 
 unsigned int brl_num_locks(const struct byte_range_lock *brl);
 struct files_struct *brl_fsp(struct byte_range_lock *brl);
-bool brl_have_read_oplocks(const struct byte_range_lock *brl);
-void brl_set_have_read_oplocks(struct byte_range_lock *brl,
-                              bool have_read_oplocks);
+uint32_t brl_num_read_oplocks(const struct byte_range_lock *brl);
+void brl_set_num_read_oplocks(struct byte_range_lock *brl,
+                             uint32_t num_read_oplocks);
 
 NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
                struct lock_struct *plock,
@@ -59,12 +59,7 @@ bool brl_unlock_windows_default(struct messaging_context *msg_ctx,
                               struct byte_range_lock *br_lck,
                               const struct lock_struct *plock);
 bool brl_locktest(struct byte_range_lock *br_lck,
-               uint64_t smblctx,
-               struct server_id pid,
-               br_off start,
-               br_off size,
-               enum brl_type lock_type,
-               enum brl_flavour lock_flav);
+                 const struct lock_struct *rw_probe);
 NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
                uint64_t *psmblctx,
                struct server_id pid,
@@ -77,8 +72,7 @@ bool brl_lock_cancel(struct byte_range_lock *br_lck,
                struct server_id pid,
                br_off start,
                br_off size,
-               enum brl_flavour lock_flav,
-               struct blocking_lock_record *blr);
+               enum brl_flavour lock_flav);
 bool brl_lock_cancel_default(struct byte_range_lock *br_lck,
                struct lock_struct *plock);
 bool brl_mark_disconnected(struct files_struct *fsp);
@@ -138,11 +132,10 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx,
                        uint64_t offset,
                        enum brl_flavour lock_flav);
 NTSTATUS do_lock_cancel(files_struct *fsp,
-                       uint64 smblctx,
+                       uint64_t smblctx,
                        uint64_t count,
                        uint64_t offset,
-                       enum brl_flavour lock_flav,
-                       struct blocking_lock_record *blr);
+                       enum brl_flavour lock_flav);
 void locking_close_file(struct messaging_context *msg_ctx,
                        files_struct *fsp,
                        enum file_close_type close_type);
@@ -173,21 +166,29 @@ void get_file_infos(struct file_id id,
                    struct timespec *write_time);
 bool is_valid_share_mode_entry(const struct share_mode_entry *e);
 bool share_mode_stale_pid(struct share_mode_data *d, uint32_t idx);
-bool set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
-                   uid_t uid, uint64_t mid, uint16 op_type);
+bool set_share_mode(struct share_mode_lock *lck, struct files_struct *fsp,
+                   uid_t uid, uint64_t mid, uint16_t op_type,
+                   uint32_t lease_idx);
 void remove_stale_share_mode_entries(struct share_mode_data *d);
 bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp);
 bool mark_share_mode_disconnected(struct share_mode_lock *lck,
                                  struct files_struct *fsp);
 bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
 bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
+struct share_mode_lease;
+NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
+                              struct share_mode_lock *lck,
+                              const struct smb2_lease_key *key,
+                              uint32_t new_lease_state,
+                              struct share_mode_lease **_l);
 bool get_delete_on_close_token(struct share_mode_lock *lck,
                                uint32_t name_hash,
                                const struct security_token **pp_nt_tok,
                                const struct security_unix_token **pp_tok);
+void reset_delete_on_close_lck(files_struct *fsp,
+                              struct share_mode_lock *lck);
 void set_delete_on_close_lck(files_struct *fsp,
                        struct share_mode_lock *lck,
-                       bool delete_on_close,
                        const struct security_token *nt_tok,
                        const struct security_unix_token *tok);
 bool set_delete_on_close(files_struct *fsp, bool delete_on_close,
@@ -197,7 +198,12 @@ bool is_delete_on_close_set(struct share_mode_lock *lck, uint32_t name_hash);
 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
 bool set_write_time(struct file_id fileid, struct timespec write_time);
 struct timespec get_share_mode_write_time(struct share_mode_lock *lck);
-int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
+int share_mode_forall(int (*fn)(struct file_id fid,
+                               const struct share_mode_data *data,
+                               void *private_data),
+                     void *private_data);
+int share_entry_forall(int (*fn)(const struct share_mode_entry *,
+                                const char *, const char *,
                                 const char *, void *),
                      void *private_data);
 bool share_mode_cleanup_disconnected(struct file_id id,
@@ -213,7 +219,7 @@ bool is_posix_locked(files_struct *fsp,
                        enum brl_flavour lock_flav);
 bool posix_locking_init(bool read_only);
 bool posix_locking_end(void);
-int fd_close_posix(struct files_struct *fsp);
+int fd_close_posix(const struct files_struct *fsp);
 bool set_posix_lock_windows_flavour(files_struct *fsp,
                        uint64_t u_offset,
                        uint64_t u_count,
@@ -233,6 +239,7 @@ bool set_posix_lock_posix_flavour(files_struct *fsp,
                        uint64_t u_offset,
                        uint64_t u_count,
                        enum brl_type lock_type,
+                       const struct lock_context *lock_ctx,
                        int *errno_ret);
 bool release_posix_lock_posix_flavour(files_struct *fsp,
                                uint64_t u_offset,