s3-locking: move locking prototypes out of proto.h.
authorGünther Deschner <gd@samba.org>
Wed, 23 Mar 2011 11:43:17 +0000 (12:43 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 29 Mar 2011 23:13:09 +0000 (01:13 +0200)
Will later become part of locking.h

Guenther

source3/include/proto.h
source3/locking/brlock.c
source3/locking/locking.c
source3/locking/posix.c
source3/locking/proto.h [new file with mode: 0644]
source3/printing/spoolssd.c
source3/smbd/smbd.h
source3/torture/locktest.c
source3/torture/locktest2.c
source3/utils/status.c
source3/web/statuspage.c

index 6c6c8d8d94f10341c8bce206cd1f6200bb5fa1a5..0473ddf54efbb9520b69002d1b9a03945bbc969f 100644 (file)
@@ -2488,207 +2488,6 @@ struct tevent_req *nb_packet_read_send(TALLOC_CTX *mem_ctx,
 NTSTATUS nb_packet_read_recv(struct tevent_req *req,
                             struct packet_struct **ppacket);
 
-/* The following definitions come from locking/brlock.c  */
-
-bool brl_same_context(const struct lock_context *ctx1, 
-                            const struct lock_context *ctx2);
-NTSTATUS brl_lock_failed(files_struct *fsp, const struct lock_struct *lock, bool blocking_lock);
-void brl_init(bool read_only);
-void brl_shutdown(void);
-
-NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
-               struct lock_struct *plock,
-               bool blocking_lock);
-
-NTSTATUS brl_lock(struct messaging_context *msg_ctx,
-               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,
-               bool blocking_lock,
-               uint64_t *psmblctx,
-               struct blocking_lock_record *blr);
-bool brl_unlock(struct messaging_context *msg_ctx,
-               struct byte_range_lock *br_lck,
-               uint64_t smblctx,
-               struct server_id pid,
-               br_off start,
-               br_off size,
-               enum brl_flavour lock_flav);
-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);
-NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
-               uint64_t *psmblctx,
-               struct server_id pid,
-               br_off *pstart,
-               br_off *psize, 
-               enum brl_type *plock_type,
-               enum brl_flavour lock_flav);
-bool brl_lock_cancel(struct byte_range_lock *br_lck,
-               uint64_t smblctx,
-               struct server_id pid,
-               br_off start,
-               br_off size,
-               enum brl_flavour lock_flav,
-               struct blocking_lock_record *blr);
-bool brl_lock_cancel_default(struct byte_range_lock *br_lck,
-               struct lock_struct *plock);
-void brl_close_fnum(struct messaging_context *msg_ctx,
-                   struct byte_range_lock *br_lck);
-int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
-                         enum brl_type lock_type,
-                         enum brl_flavour lock_flav,
-                         br_off start, br_off size,
-                         void *private_data),
-              void *private_data);
-struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx,
-                                       files_struct *fsp);
-struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp);
-void brl_register_msgs(struct messaging_context *msg_ctx);
-
-/* The following definitions come from locking/locking.c  */
-
-const char *lock_type_name(enum brl_type lock_type);
-const char *lock_flav_name(enum brl_flavour lock_flav);
-void init_strict_lock_struct(files_struct *fsp,
-                               uint64_t smblctx,
-                               br_off start,
-                               br_off size,
-                               enum brl_type lock_type,
-                               struct lock_struct *plock);
-bool strict_lock_default(files_struct *fsp,
-                               struct lock_struct *plock);
-void strict_unlock_default(files_struct *fsp,
-                               struct lock_struct *plock);
-NTSTATUS query_lock(files_struct *fsp,
-                       uint64_t *psmblctx,
-                       uint64_t *pcount,
-                       uint64_t *poffset,
-                       enum brl_type *plock_type,
-                       enum brl_flavour lock_flav);
-struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
-                       files_struct *fsp,
-                       uint64_t smblctx,
-                       uint64_t count,
-                       uint64_t offset,
-                       enum brl_type lock_type,
-                       enum brl_flavour lock_flav,
-                       bool blocking_lock,
-                       NTSTATUS *perr,
-                       uint64_t *psmblctx,
-                       struct blocking_lock_record *blr);
-NTSTATUS do_unlock(struct messaging_context *msg_ctx,
-                       files_struct *fsp,
-                       uint64_t smblctx,
-                       uint64_t count,
-                       uint64_t offset,
-                       enum brl_flavour lock_flav);
-NTSTATUS do_lock_cancel(files_struct *fsp,
-                       uint64 smblctx,
-                       uint64_t count,
-                       uint64_t offset,
-                       enum brl_flavour lock_flav,
-                       struct blocking_lock_record *blr);
-void locking_close_file(struct messaging_context *msg_ctx,
-                       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 share_mode_entry *e);
-struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
-                                           const struct file_id id,
-                                           const char *servicepath,
-                                           const struct smb_filename *smb_fname,
-                                           const struct timespec *old_write_time);
-struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
-                                                 const struct file_id id);
-bool rename_share_filename(struct messaging_context *msg_ctx,
-                       struct share_mode_lock *lck,
-                       const char *servicepath,
-                       uint32_t orig_name_hash,
-                       uint32_t new_name_hash,
-                       const struct smb_filename *smb_fname);
-void get_file_infos(struct file_id id,
-                   uint32_t name_hash,
-                   bool *delete_on_close,
-                   struct timespec *write_time);
-bool is_valid_share_mode_entry(const struct share_mode_entry *e);
-bool is_deferred_open_entry(const struct share_mode_entry *e);
-bool is_unused_share_mode_entry(const struct share_mode_entry *e);
-void set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
-                   uid_t uid, uint64_t mid, uint16 op_type);
-void add_deferred_open(struct share_mode_lock *lck, uint64_t mid,
-                      struct timeval request_time,
-                      struct server_id pid, struct file_id id);
-bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp);
-void del_deferred_open_entry(struct share_mode_lock *lck, uint64_t mid,
-                            struct server_id pid);
-bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
-bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
-NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode);
-const struct security_unix_token *get_delete_on_close_token(struct share_mode_lock *lck, uint32_t name_hash);
-void set_delete_on_close_lck(files_struct *fsp,
-                       struct share_mode_lock *lck,
-                       bool delete_on_close,
-                       const struct security_unix_token *tok);
-bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const struct security_unix_token *tok);
-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);
-int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
-                                const char *, void *),
-                     void *private_data);
-
-/* The following definitions come from locking/posix.c  */
-
-bool is_posix_locked(files_struct *fsp,
-                       uint64_t *pu_offset,
-                       uint64_t *pu_count,
-                       enum brl_type *plock_type,
-                       enum brl_flavour lock_flav);
-bool posix_locking_init(bool read_only);
-bool posix_locking_end(void);
-void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount);
-int fd_close_posix(struct files_struct *fsp);
-bool set_posix_lock_windows_flavour(files_struct *fsp,
-                       uint64_t u_offset,
-                       uint64_t u_count,
-                       enum brl_type lock_type,
-                       const struct lock_context *lock_ctx,
-                       const struct lock_struct *plocks,
-                       int num_locks,
-                       int *errno_ret);
-bool release_posix_lock_windows_flavour(files_struct *fsp,
-                               uint64_t u_offset,
-                               uint64_t u_count,
-                               enum brl_type deleted_lock_type,
-                               const struct lock_context *lock_ctx,
-                               const struct lock_struct *plocks,
-                               int num_locks);
-bool set_posix_lock_posix_flavour(files_struct *fsp,
-                       uint64_t u_offset,
-                       uint64_t u_count,
-                       enum brl_type lock_type,
-                       int *errno_ret);
-bool release_posix_lock_posix_flavour(files_struct *fsp,
-                               uint64_t u_offset,
-                               uint64_t u_count,
-                               const struct lock_context *lock_ctx,
-                               const struct lock_struct *plocks,
-                               int num_locks);
-
 /* The following definitions come from modules/vfs_default.c  */
 
 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
index 015289708167e97cc2b00fda74764f77d1c6d482..c09b10e271f470ce83936e734da33b1ad856a66e 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "includes.h"
 #include "system/filesys.h"
+#include "locking/proto.h"
 #include "librpc/gen_ndr/messaging.h"
 #include "smbd/globals.h"
 #include "dbwrap.h"
index bfdf8092fd4cdf7d38ae287514e59c506988e420..e541c04025c68ca5b09d11a1ae07d849bfede4f5 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "includes.h"
 #include "system/filesys.h"
+#include "locking/proto.h"
 #include "librpc/gen_ndr/messaging.h"
 #include "smbd/globals.h"
 #include "dbwrap.h"
index c0eca295a2339d9b9dc3b5bcd2843f5bea9e990d..cea8d2f8a2e7be751a3f3193724ab057099c1019 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "includes.h"
 #include "system/filesys.h"
+#include "locking/proto.h"
 #include "dbwrap.h"
 
 #undef DBGC_CLASS
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
new file mode 100644 (file)
index 0000000..6f13096
--- /dev/null
@@ -0,0 +1,201 @@
+
+/* The following definitions come from locking/brlock.c  */
+
+bool brl_same_context(const struct lock_context *ctx1,
+                            const struct lock_context *ctx2);
+NTSTATUS brl_lock_failed(files_struct *fsp, const struct lock_struct *lock, bool blocking_lock);
+void brl_init(bool read_only);
+void brl_shutdown(void);
+
+NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
+               struct lock_struct *plock,
+               bool blocking_lock);
+
+NTSTATUS brl_lock(struct messaging_context *msg_ctx,
+               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,
+               bool blocking_lock,
+               uint64_t *psmblctx,
+               struct blocking_lock_record *blr);
+bool brl_unlock(struct messaging_context *msg_ctx,
+               struct byte_range_lock *br_lck,
+               uint64_t smblctx,
+               struct server_id pid,
+               br_off start,
+               br_off size,
+               enum brl_flavour lock_flav);
+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);
+NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
+               uint64_t *psmblctx,
+               struct server_id pid,
+               br_off *pstart,
+               br_off *psize,
+               enum brl_type *plock_type,
+               enum brl_flavour lock_flav);
+bool brl_lock_cancel(struct byte_range_lock *br_lck,
+               uint64_t smblctx,
+               struct server_id pid,
+               br_off start,
+               br_off size,
+               enum brl_flavour lock_flav,
+               struct blocking_lock_record *blr);
+bool brl_lock_cancel_default(struct byte_range_lock *br_lck,
+               struct lock_struct *plock);
+void brl_close_fnum(struct messaging_context *msg_ctx,
+                   struct byte_range_lock *br_lck);
+int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
+                         enum brl_type lock_type,
+                         enum brl_flavour lock_flav,
+                         br_off start, br_off size,
+                         void *private_data),
+              void *private_data);
+struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx,
+                                       files_struct *fsp);
+struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp);
+void brl_register_msgs(struct messaging_context *msg_ctx);
+
+/* The following definitions come from locking/locking.c  */
+
+const char *lock_type_name(enum brl_type lock_type);
+const char *lock_flav_name(enum brl_flavour lock_flav);
+void init_strict_lock_struct(files_struct *fsp,
+                               uint64_t smblctx,
+                               br_off start,
+                               br_off size,
+                               enum brl_type lock_type,
+                               struct lock_struct *plock);
+bool strict_lock_default(files_struct *fsp,
+                               struct lock_struct *plock);
+void strict_unlock_default(files_struct *fsp,
+                               struct lock_struct *plock);
+NTSTATUS query_lock(files_struct *fsp,
+                       uint64_t *psmblctx,
+                       uint64_t *pcount,
+                       uint64_t *poffset,
+                       enum brl_type *plock_type,
+                       enum brl_flavour lock_flav);
+struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
+                       files_struct *fsp,
+                       uint64_t smblctx,
+                       uint64_t count,
+                       uint64_t offset,
+                       enum brl_type lock_type,
+                       enum brl_flavour lock_flav,
+                       bool blocking_lock,
+                       NTSTATUS *perr,
+                       uint64_t *psmblctx,
+                       struct blocking_lock_record *blr);
+NTSTATUS do_unlock(struct messaging_context *msg_ctx,
+                       files_struct *fsp,
+                       uint64_t smblctx,
+                       uint64_t count,
+                       uint64_t offset,
+                       enum brl_flavour lock_flav);
+NTSTATUS do_lock_cancel(files_struct *fsp,
+                       uint64 smblctx,
+                       uint64_t count,
+                       uint64_t offset,
+                       enum brl_flavour lock_flav,
+                       struct blocking_lock_record *blr);
+void locking_close_file(struct messaging_context *msg_ctx,
+                       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 share_mode_entry *e);
+struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
+                                           const struct file_id id,
+                                           const char *servicepath,
+                                           const struct smb_filename *smb_fname,
+                                           const struct timespec *old_write_time);
+struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
+                                                 const struct file_id id);
+bool rename_share_filename(struct messaging_context *msg_ctx,
+                       struct share_mode_lock *lck,
+                       const char *servicepath,
+                       uint32_t orig_name_hash,
+                       uint32_t new_name_hash,
+                       const struct smb_filename *smb_fname);
+void get_file_infos(struct file_id id,
+                   uint32_t name_hash,
+                   bool *delete_on_close,
+                   struct timespec *write_time);
+bool is_valid_share_mode_entry(const struct share_mode_entry *e);
+bool is_deferred_open_entry(const struct share_mode_entry *e);
+bool is_unused_share_mode_entry(const struct share_mode_entry *e);
+void set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
+                   uid_t uid, uint64_t mid, uint16 op_type);
+void add_deferred_open(struct share_mode_lock *lck, uint64_t mid,
+                      struct timeval request_time,
+                      struct server_id pid, struct file_id id);
+bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp);
+void del_deferred_open_entry(struct share_mode_lock *lck, uint64_t mid,
+                            struct server_id pid);
+bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
+bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
+NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode);
+const struct security_unix_token *get_delete_on_close_token(struct share_mode_lock *lck, uint32_t name_hash);
+void set_delete_on_close_lck(files_struct *fsp,
+                       struct share_mode_lock *lck,
+                       bool delete_on_close,
+                       const struct security_unix_token *tok);
+bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const struct security_unix_token *tok);
+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);
+int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
+                                const char *, void *),
+                     void *private_data);
+
+/* The following definitions come from locking/posix.c  */
+
+bool is_posix_locked(files_struct *fsp,
+                       uint64_t *pu_offset,
+                       uint64_t *pu_count,
+                       enum brl_type *plock_type,
+                       enum brl_flavour lock_flav);
+bool posix_locking_init(bool read_only);
+bool posix_locking_end(void);
+void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount);
+int fd_close_posix(struct files_struct *fsp);
+bool set_posix_lock_windows_flavour(files_struct *fsp,
+                       uint64_t u_offset,
+                       uint64_t u_count,
+                       enum brl_type lock_type,
+                       const struct lock_context *lock_ctx,
+                       const struct lock_struct *plocks,
+                       int num_locks,
+                       int *errno_ret);
+bool release_posix_lock_windows_flavour(files_struct *fsp,
+                               uint64_t u_offset,
+                               uint64_t u_count,
+                               enum brl_type deleted_lock_type,
+                               const struct lock_context *lock_ctx,
+                               const struct lock_struct *plocks,
+                               int num_locks);
+bool set_posix_lock_posix_flavour(files_struct *fsp,
+                       uint64_t u_offset,
+                       uint64_t u_count,
+                       enum brl_type lock_type,
+                       int *errno_ret);
+bool release_posix_lock_posix_flavour(files_struct *fsp,
+                               uint64_t u_offset,
+                               uint64_t u_count,
+                               const struct lock_context *lock_ctx,
+                               const struct lock_struct *plocks,
+                               int num_locks);
index 67e83f31105b80e6595f0f34f1bddfad2150b995..e6991c6f0fb8641256bf0b3dfdf83db46710add3 100644 (file)
@@ -19,6 +19,7 @@
 #include "includes.h"
 #include "serverid.h"
 #include "smbd/smbd.h"
+#include "locking/proto.h"
 
 #include "librpc/gen_ndr/messaging.h"
 #include "include/printing.h"
index f48e877ff48218a03408fd042c1a750deaf6a86e..f0eb601d8cf25e94a76babfffb2206033c04b007 100644 (file)
@@ -22,5 +22,6 @@
 #include "smb_acls.h"
 #include "vfs.h"
 #include "smbd/proto.h"
+#include "locking/proto.h"
 
 #endif /* _SMBD_SMBD_H */
index 6a53c88e5af799b775375d3f201cd3c3a4f0ecba..c415f4c5d8564fa79e7552b9abfeabedecd233aa 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "includes.h"
 #include "system/filesys.h"
+#include "locking/proto.h"
 
 static fstring password[2];
 static fstring username[2];
index b51b8f2cad6a66a19d6cb44554b8750adae51c1c..55dc1d52b782331434b5c9cd004af887640bcbeb 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "includes.h"
 #include "system/filesys.h"
+#include "locking/proto.h"
 
 static fstring password;
 static fstring username;
index 21ed9ea52f925f1a4a5f061ba180adb220c97449..18d338539d6c7442d5fe6ddf199f75f93abc881d 100644 (file)
@@ -36,6 +36,7 @@
 #include "dbwrap.h"
 #include "../libcli/security/security.h"
 #include "session.h"
+#include "locking/proto.h"
 
 #define SMB_MAXPIDS            2048
 static uid_t           Ucrit_uid = 0;               /* added by OH */
index 85bd33b7de0d5da33432cfb56c23858c63abffc3..02f5ca78e94db58cc3dd0e77d417b4544a19ea11 100644 (file)
@@ -20,6 +20,7 @@
 #include "includes.h"
 #include "web/swat_proto.h"
 #include "libcli/security/security.h"
+#include "locking/proto.h"
 
 #define _(x) lang_msg_rotate(talloc_tos(),x)