1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

r19668: Convert the locking params to use struct share_param instead of snum

(This used to be commit 609dbec600)
This commit is contained in:
Volker Lendecke 2006-11-11 17:05:11 +00:00 committed by Gerald (Jerry) Carter
parent 5f3a692748
commit b6b84f98c0
5 changed files with 26 additions and 20 deletions

View File

@ -333,7 +333,7 @@ static NTSTATUS brl_lock_windows(struct byte_range_lock *br_lck,
be mapped into a lower level POSIX one, and if so can
we get it ? */
if (!IS_PENDING_LOCK(plock->lock_type) && lp_posix_locking(SNUM(fsp->conn))) {
if (!IS_PENDING_LOCK(plock->lock_type) && lp_posix_locking(fsp->conn->params)) {
int errno_ret;
if (!set_posix_lock_windows_flavour(fsp,
plock->start,
@ -654,7 +654,7 @@ static NTSTATUS brl_lock_posix(struct byte_range_lock *br_lck,
be mapped into a lower level POSIX one, and if so can
we get it ? */
if (!IS_PENDING_LOCK(plock->lock_type) && lp_posix_locking(SNUM(br_lck->fsp->conn))) {
if (!IS_PENDING_LOCK(plock->lock_type) && lp_posix_locking(br_lck->fsp->conn->params)) {
int errno_ret;
/* The lower layer just needs to attempt to
@ -829,7 +829,7 @@ static BOOL brl_unlock_windows(struct byte_range_lock *br_lck, const struct lock
br_lck->modified = True;
/* Unlock the underlying POSIX regions. */
if(lp_posix_locking(SNUM(br_lck->fsp->conn))) {
if(lp_posix_locking(br_lck->fsp->conn->params)) {
release_posix_lock_windows_flavour(br_lck->fsp,
plock->start,
plock->size,
@ -978,7 +978,7 @@ static BOOL brl_unlock_posix(struct byte_range_lock *br_lck, const struct lock_s
}
/* Unlock any POSIX regions. */
if(lp_posix_locking(SNUM(br_lck->fsp->conn))) {
if(lp_posix_locking(br_lck->fsp->conn->params)) {
release_posix_lock_posix_flavour(br_lck->fsp,
plock->start,
plock->size,
@ -1103,7 +1103,7 @@ BOOL brl_locktest(struct byte_range_lock *br_lck,
* This only conflicts with Windows locks, not POSIX locks.
*/
if(lp_posix_locking(SNUM(fsp->conn)) && (lock_flav == WINDOWS_LOCK)) {
if(lp_posix_locking(fsp->conn->params) && (lock_flav == WINDOWS_LOCK)) {
ret = is_posix_locked(fsp, &start, &size, &lock_type, WINDOWS_LOCK);
DEBUG(10,("brl_locktest: posix start=%.0f len=%.0f %s for fnum %d file %s\n",
@ -1169,7 +1169,7 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
* see if there is a POSIX lock from a UNIX or NFS process.
*/
if(lp_posix_locking(SNUM(fsp->conn))) {
if(lp_posix_locking(fsp->conn->params)) {
BOOL ret = is_posix_locked(fsp, pstart, psize, plock_type, POSIX_LOCK);
DEBUG(10,("brl_lockquery: posix start=%.0f len=%.0f %s for fnum %d file %s\n",
@ -1252,7 +1252,7 @@ void brl_close_fnum(struct byte_range_lock *br_lck)
struct process_id pid = procid_self();
BOOL unlock_individually = False;
if(lp_posix_locking(SNUM(fsp->conn))) {
if(lp_posix_locking(fsp->conn->params)) {
/* Check if there are any Windows locks associated with this dev/ino
pair that are not this fnum. If so we need to call unlock on each
@ -1358,7 +1358,7 @@ void brl_close_fnum(struct byte_range_lock *br_lck)
}
}
if(lp_posix_locking(SNUM(fsp->conn)) && num_deleted_windows_locks) {
if(lp_posix_locking(fsp->conn->params) && num_deleted_windows_locks) {
/* Reduce the Windows lock POSIX reference count on this dev/ino pair. */
reduce_windows_lock_ref_count(fsp, num_deleted_windows_locks);
}

View File

@ -80,8 +80,7 @@ BOOL is_locked(files_struct *fsp,
SMB_BIG_UINT offset,
enum brl_type lock_type)
{
int snum = SNUM(fsp->conn);
int strict_locking = lp_strict_locking(snum);
int strict_locking = lp_strict_locking(fsp->conn->params);
enum brl_flavour lock_flav = lp_posix_cifsu_locktype();
BOOL ret = True;
@ -89,7 +88,7 @@ BOOL is_locked(files_struct *fsp,
return False;
}
if (!lp_locking(snum) || !strict_locking) {
if (!lp_locking(fsp->conn->params) || !strict_locking) {
return False;
}
@ -156,7 +155,7 @@ NTSTATUS query_lock(files_struct *fsp,
return fsp->is_directory ? NT_STATUS_INVALID_DEVICE_REQUEST : NT_STATUS_INVALID_HANDLE;
}
if (!lp_locking(SNUM(fsp->conn))) {
if (!lp_locking(fsp->conn->params)) {
return NT_STATUS_OK;
}
@ -197,7 +196,7 @@ struct byte_range_lock *do_lock(files_struct *fsp,
return NULL;
}
if (!lp_locking(SNUM(fsp->conn))) {
if (!lp_locking(fsp->conn->params)) {
*perr = NT_STATUS_OK;
return NULL;
}
@ -243,7 +242,7 @@ NTSTATUS do_unlock(files_struct *fsp,
return fsp->is_directory ? NT_STATUS_INVALID_DEVICE_REQUEST : NT_STATUS_INVALID_HANDLE;
}
if (!lp_locking(SNUM(fsp->conn))) {
if (!lp_locking(fsp->conn->params)) {
return NT_STATUS_OK;
}
@ -290,7 +289,7 @@ NTSTATUS do_lock_cancel(files_struct *fsp,
NT_STATUS_INVALID_DEVICE_REQUEST : NT_STATUS_INVALID_HANDLE;
}
if (!lp_locking(SNUM(fsp->conn))) {
if (!lp_locking(fsp->conn->params)) {
return NT_STATUS_DOS(ERRDOS, ERRcancelviolation);
}
@ -327,7 +326,7 @@ void locking_close_file(files_struct *fsp)
{
struct byte_range_lock *br_lck;
if (!lp_locking(SNUM(fsp->conn))) {
if (!lp_locking(fsp->conn->params)) {
return;
}

View File

@ -643,7 +643,7 @@ int fd_close_posix(struct connection_struct *conn, files_struct *fsp)
int *fd_array = NULL;
size_t count, i;
if (!lp_locking(SNUM(fsp->conn)) || !lp_posix_locking(SNUM(conn))) {
if (!lp_locking(fsp->conn->params) || !lp_posix_locking(conn->params)) {
/*
* No locking or POSIX to worry about or we want POSIX semantics
* which will lose all locks on all fd's open on this dev/inode,

View File

@ -1752,6 +1752,8 @@ static char *lp_string(const char *s)
#define FN_LOCAL_PARM_BOOL(fn_name,val) \
BOOL fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
#define FN_LOCAL_PARM_INTEGER(fn_name,val) \
int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
#define FN_LOCAL_PARM_STRING(fn_name,val) \
char *fn_name(const struct share_params *p) {return(lp_string((LP_SNUM_OK(p->service) && ServicePtrs[(p->service)]->val) ? ServicePtrs[(p->service)]->val : sDefault.val));}
#define FN_LOCAL_CHAR(fn_name,val) \
@ -2020,9 +2022,9 @@ FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes)
FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport)
FN_LOCAL_BOOL(lp_locking, bLocking)
FN_LOCAL_INTEGER(lp_strict_locking, iStrictLocking)
FN_LOCAL_BOOL(lp_posix_locking, bPosixLocking)
FN_LOCAL_PARM_BOOL(lp_locking, bLocking)
FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking)
FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking)
FN_LOCAL_BOOL(lp_share_modes, bShareModes)
FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)

View File

@ -53,6 +53,11 @@ END {
printf "BOOL %s(const struct share_params *p );\n", a[2]
}
/^FN_LOCAL_PARM_INTEGER/ {
split($0,a,"[,()]")
printf "int %s(const struct share_params *p );\n", a[2]
}
/^FN_LOCAL_LIST/ {
split($0,a,"[,()]")
printf "const char **%s(int );\n", a[2]