summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2020-10-28 12:09:39 +0100
committerJeremy Allison <jra@samba.org>2020-11-10 19:49:34 +0000
commit15e9e2945c2d404a4ba7b26744978ff22b4b7ef5 (patch)
tree32bbe36aa200c4166a3505847452ec7945249b88 /source3/locking
parent4da7de80d566d2e19f4a6c5e219fcad993e0a3a7 (diff)
downloadsamba-15e9e2945c2d404a4ba7b26744978ff22b4b7ef5.tar.gz
smbd: Give locking/share_mode_lock.c its own header file
To me this is then easier to figure out what is defined there, and where it's exactly used. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c1
-rw-r--r--source3/locking/proto.h77
-rw-r--r--source3/locking/share_mode_lock.c1
-rw-r--r--source3/locking/share_mode_lock.h108
4 files changed, 110 insertions, 77 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 06c6a91cd59..9c2674f7d19 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -39,6 +39,7 @@
#include "lib/util/time_basic.h"
#include "system/filesys.h"
#include "lib/util/server_id.h"
+#include "share_mode_lock.h"
#include "locking/proto.h"
#include "smbd/globals.h"
#include "dbwrap/dbwrap.h"
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 5c55ad9f8ba..72d037040f2 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -124,50 +124,12 @@ NTSTATUS do_unlock(files_struct *fsp,
enum brl_flavour lock_flav);
void locking_close_file(files_struct *fsp,
enum file_close_type close_type);
-bool locking_init(void);
-bool locking_init_readonly(void);
-bool locking_end(void);
char *share_mode_str(TALLOC_CTX *ctx, int num,
const struct file_id *id,
const struct share_mode_entry *e);
struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx,
struct file_id id);
-struct share_mode_lock *get_share_mode_lock(
- TALLOC_CTX *mem_ctx,
- struct file_id id,
- const char *servicepath,
- const struct smb_filename *smb_fname,
- const struct timespec *old_write_time);
-bool file_has_read_lease(struct files_struct *fsp);
-
-NTSTATUS share_mode_do_locked(
- struct file_id id,
- void (*fn)(const uint8_t *buf,
- size_t buflen,
- bool *modified_dependent,
- void *private_data),
- void *private_data);
-NTSTATUS share_mode_wakeup_waiters(struct file_id id);
-bool share_mode_have_entries(struct share_mode_lock *lck);
-
-struct tevent_req *share_mode_watch_send(
- TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct file_id id,
- struct server_id blocker);
-NTSTATUS share_mode_watch_recv(
- struct tevent_req *req, bool *blockerdead, struct server_id *blocker);
-
-struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
- struct file_id id);
-struct tevent_req *fetch_share_mode_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct file_id id,
- bool *queued);
-NTSTATUS fetch_share_mode_recv(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- struct share_mode_lock **_lck);
bool rename_share_filename(struct messaging_context *msg_ctx,
struct share_mode_lock *lck,
struct file_id id,
@@ -181,28 +143,9 @@ 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_entry_stale_pid(struct share_mode_entry *e);
-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 share_access,
- uint32_t access_mask);
-bool reset_share_mode_entry(
- struct share_mode_lock *lck,
- struct server_id old_pid,
- uint64_t old_share_file_id,
- struct server_id new_pid,
- uint64_t new_mid,
- uint64_t new_share_file_id);
NTSTATUS remove_lease_if_stale(struct share_mode_lock *lck,
const struct GUID *client_guid,
const struct smb2_lease_key *lease_key);
-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);
bool get_delete_on_close_token(struct share_mode_lock *lck,
uint32_t name_hash,
const struct security_token **pp_nt_tok,
@@ -221,32 +164,12 @@ 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);
bool file_has_open_streams(files_struct *fsp);
-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)(struct file_id fid,
- const struct share_mode_data *data,
- const struct share_mode_entry *entry,
- void *private_data),
- void *private_data);
-bool share_mode_cleanup_disconnected(struct file_id id,
- uint64_t open_persistent_id);
bool share_mode_forall_leases(
struct share_mode_lock *lck,
bool (*fn)(struct share_mode_entry *e,
void *private_data),
void *private_data);
-bool share_mode_forall_entries(
- struct share_mode_lock *lck,
- bool (*fn)(struct share_mode_entry *e,
- bool *modified,
- void *private_data),
- void *private_data);
-
-NTSTATUS share_mode_count_entries(struct file_id fid, size_t *num_share_modes);
-
/* The following definitions come from locking/posix.c */
bool is_posix_locked(files_struct *fsp,
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index 1c4d3a42221..ad69ef7c6e2 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -38,6 +38,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "lib/util/server_id.h"
+#include "share_mode_lock.h"
#include "locking/proto.h"
#include "smbd/globals.h"
#include "dbwrap/dbwrap.h"
diff --git a/source3/locking/share_mode_lock.h b/source3/locking/share_mode_lock.h
new file mode 100644
index 00000000000..644f2bda9e3
--- /dev/null
+++ b/source3/locking/share_mode_lock.h
@@ -0,0 +1,108 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __LOCKING_SHARE_MODE_LOCK_H__
+#define __LOCKING_SHARE_MODE_LOCK_H__
+
+bool locking_init(void);
+bool locking_init_readonly(void);
+bool locking_end(void);
+
+struct share_mode_lock *get_share_mode_lock(
+ TALLOC_CTX *mem_ctx,
+ struct file_id id,
+ const char *servicepath,
+ const struct smb_filename *smb_fname,
+ const struct timespec *old_write_time);
+
+bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp);
+bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
+bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
+bool file_has_read_lease(struct files_struct *fsp);
+
+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 share_access,
+ uint32_t access_mask);
+bool reset_share_mode_entry(
+ struct share_mode_lock *lck,
+ struct server_id old_pid,
+ uint64_t old_share_file_id,
+ struct server_id new_pid,
+ uint64_t new_mid,
+ uint64_t new_share_file_id);
+
+bool mark_share_mode_disconnected(
+ struct share_mode_lock *lck, struct files_struct *fsp);
+
+struct share_mode_lock *fetch_share_mode_unlocked(
+ TALLOC_CTX *mem_ctx,
+ struct file_id id);
+
+struct tevent_req *fetch_share_mode_send(
+ TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct file_id id,
+ bool *queued);
+NTSTATUS fetch_share_mode_recv(
+ struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ struct share_mode_lock **_lck);
+
+int share_entry_forall(
+ int (*fn)(struct file_id fid,
+ const struct share_mode_data *data,
+ const struct share_mode_entry *entry,
+ void *private_data),
+ void *private_data);
+bool share_mode_cleanup_disconnected(
+ struct file_id fid,
+ uint64_t open_persistent_id);
+
+NTSTATUS share_mode_count_entries(struct file_id fid, size_t *num_share_modes);
+NTSTATUS share_mode_do_locked(
+ struct file_id id,
+ void (*fn)(const uint8_t *buf,
+ size_t buflen,
+ bool *modified_dependent,
+ void *private_data),
+ void *private_data);
+int share_mode_forall(
+ int (*fn)(struct file_id fid,
+ const struct share_mode_data *data,
+ void *private_data),
+ void *private_data);
+bool share_mode_forall_entries(
+ struct share_mode_lock *lck,
+ bool (*fn)(struct share_mode_entry *e,
+ bool *modified,
+ void *private_data),
+ void *private_data);
+bool share_mode_have_entries(struct share_mode_lock *lck);
+
+struct tevent_req *share_mode_watch_send(
+ TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct file_id id,
+ struct server_id blocker);
+NTSTATUS share_mode_watch_recv(
+ struct tevent_req *req, bool *blockerdead, struct server_id *blocker);
+NTSTATUS share_mode_wakeup_waiters(struct file_id id);
+
+#endif