Author: vlendec
Date: 2006-11-11 17:05:11 +0000 (Sat, 11 Nov 2006)
New Revision: 19668

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19668

Log:
Convert the locking params to use struct share_param instead of snum
Modified:
   branches/SAMBA_3_0/source/locking/brlock.c
   branches/SAMBA_3_0/source/locking/locking.c
   branches/SAMBA_3_0/source/locking/posix.c
   branches/SAMBA_3_0/source/param/loadparm.c
   branches/SAMBA_3_0/source/script/mkproto.awk


Changeset:
Modified: branches/SAMBA_3_0/source/locking/brlock.c
===================================================================
--- branches/SAMBA_3_0/source/locking/brlock.c  2006-11-11 17:04:08 UTC (rev 
19667)
+++ branches/SAMBA_3_0/source/locking/brlock.c  2006-11-11 17:05:11 UTC (rev 
19668)
@@ -333,7 +333,7 @@
           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 @@
           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 @@
        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 @@
        }
 
        /* 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 @@
         * 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 @@
         * 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 @@
        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 @@
                }
        }
 
-       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);
        }

Modified: branches/SAMBA_3_0/source/locking/locking.c
===================================================================
--- branches/SAMBA_3_0/source/locking/locking.c 2006-11-11 17:04:08 UTC (rev 
19667)
+++ branches/SAMBA_3_0/source/locking/locking.c 2006-11-11 17:05:11 UTC (rev 
19668)
@@ -80,8 +80,7 @@
                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 @@
                return False;
        }
 
-       if (!lp_locking(snum) || !strict_locking) {
+       if (!lp_locking(fsp->conn->params) || !strict_locking) {
                return False;
        }
 
@@ -156,7 +155,7 @@
                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 @@
                return NULL;
        }
 
-       if (!lp_locking(SNUM(fsp->conn))) {
+       if (!lp_locking(fsp->conn->params)) {
                *perr = NT_STATUS_OK;
                return NULL;
        }
@@ -243,7 +242,7 @@
                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 @@
                        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 @@
 {
        struct byte_range_lock *br_lck;
 
-       if (!lp_locking(SNUM(fsp->conn))) {
+       if (!lp_locking(fsp->conn->params)) {
                return;
        }
 

Modified: branches/SAMBA_3_0/source/locking/posix.c
===================================================================
--- branches/SAMBA_3_0/source/locking/posix.c   2006-11-11 17:04:08 UTC (rev 
19667)
+++ branches/SAMBA_3_0/source/locking/posix.c   2006-11-11 17:05:11 UTC (rev 
19668)
@@ -643,7 +643,7 @@
        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,

Modified: branches/SAMBA_3_0/source/param/loadparm.c
===================================================================
--- branches/SAMBA_3_0/source/param/loadparm.c  2006-11-11 17:04:08 UTC (rev 
19667)
+++ branches/SAMBA_3_0/source/param/loadparm.c  2006-11-11 17:05:11 UTC (rev 
19668)
@@ -1752,6 +1752,8 @@
 
 #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_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)

Modified: branches/SAMBA_3_0/source/script/mkproto.awk
===================================================================
--- branches/SAMBA_3_0/source/script/mkproto.awk        2006-11-11 17:04:08 UTC 
(rev 19667)
+++ branches/SAMBA_3_0/source/script/mkproto.awk        2006-11-11 17:05:11 UTC 
(rev 19668)
@@ -53,6 +53,11 @@
   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]

Reply via email to