summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--source3/modules/vfs_delay_inject.c1
-rw-r--r--source3/printing/queue_process.c1
-rw-r--r--source3/printing/spoolssd.c1
-rw-r--r--source3/rpc_server/srvsvc/srv_srvsvc_nt.c1
-rw-r--r--source3/smbd/blocking.c1
-rw-r--r--source3/smbd/close.c1
-rw-r--r--source3/smbd/dir.c1
-rw-r--r--source3/smbd/durable.c1
-rw-r--r--source3/smbd/open.c1
-rw-r--r--source3/smbd/oplock.c1
-rw-r--r--source3/smbd/reply.c1
-rw-r--r--source3/smbd/scavenger.c1
-rw-r--r--source3/smbd/server.c1
-rw-r--r--source3/smbd/server_exit.c1
-rw-r--r--source3/smbd/smb2_lock.c1
-rw-r--r--source3/smbd/smb2_query_directory.c1
-rw-r--r--source3/smbd/smb2_setinfo.c1
-rw-r--r--source3/torture/locktest2.c1
-rw-r--r--source3/torture/vfstest.c1
-rw-r--r--source3/utils/net_tdb.c1
-rw-r--r--source3/utils/net_vfs.c1
-rw-r--r--source3/utils/status.c1
26 files changed, 132 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
diff --git a/source3/modules/vfs_delay_inject.c b/source3/modules/vfs_delay_inject.c
index 6be9fe57292..d70c0f0cb6a 100644
--- a/source3/modules/vfs_delay_inject.c
+++ b/source3/modules/vfs_delay_inject.c
@@ -18,6 +18,7 @@
*/
#include "includes.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "lib/util/tevent_unix.h"
diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c
index 56f1b876e6b..7b14cd94568 100644
--- a/source3/printing/queue_process.c
+++ b/source3/printing/queue_process.c
@@ -28,6 +28,7 @@
#include "printing/pcap.h"
#include "printing/queue_process.h"
#include "locking/proto.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "rpc_server/rpc_config.h"
#include "printing/load.h"
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
index 2fe11d5bfc6..bf10b19e4a0 100644
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -17,6 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "messages.h"
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index c0c67c792e2..67477d7b416 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -35,6 +35,7 @@
#include "dbwrap/dbwrap.h"
#include "session.h"
#include "../lib/util/util_pw.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "auth.h"
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index a684c9e9043..30bb84c0a7b 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -18,6 +18,7 @@
*/
#include "includes.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "messages.h"
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 12735fc69da..42bdf67c2df 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -23,6 +23,7 @@
#include "system/filesys.h"
#include "lib/util/server_id.h"
#include "printing.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "smbd/scavenger.h"
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 14ce758422b..5602fa9ea15 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "system/filesys.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "libcli/security/security.h"
diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c
index e3334e15ae5..5a1dd79832c 100644
--- a/source3/smbd/durable.c
+++ b/source3/smbd/durable.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "lib/util/server_id.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "libcli/security/security.h"
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 0250df69db0..b7f050b80de 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -25,6 +25,7 @@
#include "system/filesys.h"
#include "lib/util/server_id.h"
#include "printing.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "fake_file.h"
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index a83a076152d..9feda47c922 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -22,6 +22,7 @@
#define DBGC_CLASS DBGC_LOCKING
#include "includes.h"
#include "lib/util/server_id.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "messages.h"
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 8dfc97c8586..e5ca576f7f8 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -28,6 +28,7 @@
#include "libsmb/namequery.h"
#include "system/filesys.h"
#include "printing.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "fake_file.h"
diff --git a/source3/smbd/scavenger.c b/source3/smbd/scavenger.c
index de07719468b..a24a5d7ccb9 100644
--- a/source3/smbd/scavenger.c
+++ b/source3/smbd/scavenger.c
@@ -23,6 +23,7 @@
#include "serverid.h"
#include "smbd/globals.h"
#include "smbd/scavenger.h"
+#include "locking/share_mode_lock.h"
#include "locking/proto.h"
#include "lib/util/server_id.h"
#include "lib/util/util_process.h"
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 3d9db5d8407..ea2d08c13a0 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -25,6 +25,7 @@
#include "system/filesys.h"
#include "lib/util/server_id.h"
#include "popt_common.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "registry/reg_init_full.h"
diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c
index 397ea810633..aa5ebe5fcd4 100644
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -23,6 +23,7 @@
*/
#include "includes.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "ntdomain.h"
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c
index 80a174cb293..12ad12aaf93 100644
--- a/source3/smbd/smb2_lock.c
+++ b/source3/smbd/smb2_lock.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "../libcli/smb/smb_common.h"
diff --git a/source3/smbd/smb2_query_directory.c b/source3/smbd/smb2_query_directory.c
index b72639630b3..ba10f925a46 100644
--- a/source3/smbd/smb2_query_directory.c
+++ b/source3/smbd/smb2_query_directory.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "../libcli/smb/smb_common.h"
diff --git a/source3/smbd/smb2_setinfo.c b/source3/smbd/smb2_setinfo.c
index fdda9b5af3c..bd2caab862a 100644
--- a/source3/smbd/smb2_setinfo.c
+++ b/source3/smbd/smb2_setinfo.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "../libcli/smb/smb_common.h"
diff --git a/source3/torture/locktest2.c b/source3/torture/locktest2.c
index 62f60ee1fe4..27366a6fbb9 100644
--- a/source3/torture/locktest2.c
+++ b/source3/torture/locktest2.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "libsmb/libsmb.h"
#include "system/filesys.h"
+#include "locking/share_mode_lock.h"
#include "locking/proto.h"
#include "lib/util/string_wrappers.h"
diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c
index 6a2fe59a2d8..b89596e487c 100644
--- a/source3/torture/vfstest.c
+++ b/source3/torture/vfstest.c
@@ -24,6 +24,7 @@
*/
#include "includes.h"
+#include "locking/share_mode_lock.h"
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "popt_common.h"
diff --git a/source3/utils/net_tdb.c b/source3/utils/net_tdb.c
index 0b81acf18e5..efca041d8e3 100644
--- a/source3/utils/net_tdb.c
+++ b/source3/utils/net_tdb.c
@@ -19,6 +19,7 @@
#include "includes.h"
#include "utils/net.h"
+#include "locking/share_mode_lock.h"
#include "locking/proto.h"
#include "librpc/gen_ndr/open_files.h"
#include "librpc/gen_ndr/ndr_open_files.h"
diff --git a/source3/utils/net_vfs.c b/source3/utils/net_vfs.c
index 59e9c60b3a6..72603e33c9f 100644
--- a/source3/utils/net_vfs.c
+++ b/source3/utils/net_vfs.c
@@ -28,6 +28,7 @@
#include "lib/param/param.h"
#include "libcli/security/security.h"
#include "smbd/proto.h"
+#include "locking/share_mode_lock.h"
#include "locking/proto.h"
#include "auth.h"
#include "client.h"
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 05cc46086fe..46fd457c8c8 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -39,6 +39,7 @@
#include "dbwrap/dbwrap_open.h"
#include "../libcli/security/security.h"
#include "session.h"
+#include "locking/share_mode_lock.h"
#include "locking/proto.h"
#include "messages.h"
#include "librpc/gen_ndr/open_files.h"