2 /* The following definitions come from locking/brlock.c */
4 bool brl_same_context(const struct lock_context *ctx1,
5 const struct lock_context *ctx2);
6 NTSTATUS brl_lock_failed(files_struct *fsp, const struct lock_struct *lock, bool blocking_lock);
7 void brl_init(bool read_only);
8 void brl_shutdown(void);
10 NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
11 struct lock_struct *plock,
14 NTSTATUS brl_lock(struct messaging_context *msg_ctx,
15 struct byte_range_lock *br_lck,
20 enum brl_type lock_type,
21 enum brl_flavour lock_flav,
24 struct blocking_lock_record *blr);
25 bool brl_unlock(struct messaging_context *msg_ctx,
26 struct byte_range_lock *br_lck,
31 enum brl_flavour lock_flav);
32 bool brl_unlock_windows_default(struct messaging_context *msg_ctx,
33 struct byte_range_lock *br_lck,
34 const struct lock_struct *plock);
35 bool brl_locktest(struct byte_range_lock *br_lck,
40 enum brl_type lock_type,
41 enum brl_flavour lock_flav);
42 NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
47 enum brl_type *plock_type,
48 enum brl_flavour lock_flav);
49 bool brl_lock_cancel(struct byte_range_lock *br_lck,
54 enum brl_flavour lock_flav,
55 struct blocking_lock_record *blr);
56 bool brl_lock_cancel_default(struct byte_range_lock *br_lck,
57 struct lock_struct *plock);
58 void brl_close_fnum(struct messaging_context *msg_ctx,
59 struct byte_range_lock *br_lck);
60 int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
61 enum brl_type lock_type,
62 enum brl_flavour lock_flav,
63 br_off start, br_off size,
66 struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx,
68 struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp);
69 void brl_register_msgs(struct messaging_context *msg_ctx);
71 /* The following definitions come from locking/locking.c */
73 const char *lock_type_name(enum brl_type lock_type);
74 const char *lock_flav_name(enum brl_flavour lock_flav);
75 void init_strict_lock_struct(files_struct *fsp,
79 enum brl_type lock_type,
80 struct lock_struct *plock);
81 bool strict_lock_default(files_struct *fsp,
82 struct lock_struct *plock);
83 void strict_unlock_default(files_struct *fsp,
84 struct lock_struct *plock);
85 NTSTATUS query_lock(files_struct *fsp,
89 enum brl_type *plock_type,
90 enum brl_flavour lock_flav);
91 struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
96 enum brl_type lock_type,
97 enum brl_flavour lock_flav,
101 struct blocking_lock_record *blr);
102 NTSTATUS do_unlock(struct messaging_context *msg_ctx,
107 enum brl_flavour lock_flav);
108 NTSTATUS do_lock_cancel(files_struct *fsp,
112 enum brl_flavour lock_flav,
113 struct blocking_lock_record *blr);
114 void locking_close_file(struct messaging_context *msg_ctx,
116 enum file_close_type close_type);
117 bool locking_init(void);
118 bool locking_init_readonly(void);
119 bool locking_end(void);
120 char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e);
121 struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
122 const struct file_id id,
123 const char *servicepath,
124 const struct smb_filename *smb_fname,
125 const struct timespec *old_write_time);
126 struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
127 const struct file_id id);
128 bool rename_share_filename(struct messaging_context *msg_ctx,
129 struct share_mode_lock *lck,
130 const char *servicepath,
131 uint32_t orig_name_hash,
132 uint32_t new_name_hash,
133 const struct smb_filename *smb_fname);
134 void get_file_infos(struct file_id id,
136 bool *delete_on_close,
137 struct timespec *write_time);
138 bool is_valid_share_mode_entry(const struct share_mode_entry *e);
139 bool is_deferred_open_entry(const struct share_mode_entry *e);
140 bool is_unused_share_mode_entry(const struct share_mode_entry *e);
141 void set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
142 uid_t uid, uint64_t mid, uint16 op_type);
143 void add_deferred_open(struct share_mode_lock *lck, uint64_t mid,
144 struct timeval request_time,
145 struct server_id pid, struct file_id id);
146 bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp);
147 void del_deferred_open_entry(struct share_mode_lock *lck, uint64_t mid,
148 struct server_id pid);
149 bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
150 bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
151 NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode);
152 const struct security_unix_token *get_delete_on_close_token(struct share_mode_lock *lck, uint32_t name_hash);
153 void set_delete_on_close_lck(files_struct *fsp,
154 struct share_mode_lock *lck,
155 bool delete_on_close,
156 const struct security_unix_token *tok);
157 bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const struct security_unix_token *tok);
158 bool is_delete_on_close_set(struct share_mode_lock *lck, uint32_t name_hash);
159 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
160 bool set_write_time(struct file_id fileid, struct timespec write_time);
161 int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
162 const char *, void *),
165 /* The following definitions come from locking/posix.c */
167 bool is_posix_locked(files_struct *fsp,
170 enum brl_type *plock_type,
171 enum brl_flavour lock_flav);
172 bool posix_locking_init(bool read_only);
173 bool posix_locking_end(void);
174 void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount);
175 int fd_close_posix(struct files_struct *fsp);
176 bool set_posix_lock_windows_flavour(files_struct *fsp,
179 enum brl_type lock_type,
180 const struct lock_context *lock_ctx,
181 const struct lock_struct *plocks,
184 bool release_posix_lock_windows_flavour(files_struct *fsp,
187 enum brl_type deleted_lock_type,
188 const struct lock_context *lock_ctx,
189 const struct lock_struct *plocks,
191 bool set_posix_lock_posix_flavour(files_struct *fsp,
194 enum brl_type lock_type,
196 bool release_posix_lock_posix_flavour(files_struct *fsp,
199 const struct lock_context *lock_ctx,
200 const struct lock_struct *plocks,