mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
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>
This commit is contained in:
parent
4da7de80d5
commit
15e9e2945c
@ -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"
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
|
108
source3/locking/share_mode_lock.h
Normal file
108
source3/locking/share_mode_lock.h
Normal file
@ -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
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "locking/share_mode_lock.h"
|
||||
#include "smbd/smbd.h"
|
||||
#include "lib/util/tevent_unix.h"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "locking/share_mode_lock.h"
|
||||
#include "smbd/smbd.h"
|
||||
#include "smbd/globals.h"
|
||||
#include "messages.h"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "locking/share_mode_lock.h"
|
||||
#include "smbd/smbd.h"
|
||||
#include "smbd/globals.h"
|
||||
#include "ntdomain.h"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user