summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-04-10 12:58:14 +0000
committerAndrew Tridgell <tridge@samba.org>2000-04-10 12:58:14 +0000
commitb36ea9a7e1fadc30a78c4eb2aabab9ff2011eacd (patch)
tree460c99458eb3c0ae657eb7003131ca7c5da8ab27 /source3/locking
parentc7d3912eba0055f0424e38e3b1b205aa409e1c64 (diff)
downloadsamba-b36ea9a7e1fadc30a78c4eb2aabab9ff2011eacd.tar.gz
samba-b36ea9a7e1fadc30a78c4eb2aabab9ff2011eacd.tar.bz2
samba-b36ea9a7e1fadc30a78c4eb2aabab9ff2011eacd.zip
the first of a bunch of changes to code with getting rid of the fd_ptr
element in the fsp pretty mechanical stuff, but it affects lots of files. (This used to be commit 368b0bc1b122ece18d11854c1506517816a01a82)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 2f85e92932..45d414daf1 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -48,7 +48,7 @@ void locking_close_file(files_struct *fsp)
{
if (!lp_locking(SNUM(fsp->conn))) return;
- brl_close(fsp->fd_ptr->dev, fsp->fd_ptr->inode,
+ brl_close(fsp->dev, fsp->inode,
getpid(), fsp->conn->cnum, fsp->fnum);
}
@@ -68,7 +68,7 @@ BOOL is_locked(files_struct *fsp,connection_struct *conn,
if (!lp_locking(snum) || !lp_strict_locking(snum))
return(False);
- return !brl_locktest(fsp->fd_ptr->dev, fsp->fd_ptr->inode,
+ return !brl_locktest(fsp->dev, fsp->inode,
global_smbpid, getpid(), conn->cnum,
offset, count, lock_type);
}
@@ -96,7 +96,7 @@ BOOL do_lock(files_struct *fsp,connection_struct *conn,
lock_type, (double)offset, (double)count, fsp->fsp_name ));
if (OPEN_FSP(fsp) && fsp->can_lock && (fsp->conn == conn)) {
- ok = brl_lock(fsp->fd_ptr->dev, fsp->fd_ptr->inode, fsp->fnum,
+ ok = brl_lock(fsp->dev, fsp->inode, fsp->fnum,
global_smbpid, getpid(), conn->cnum,
offset, count,
lock_type);
@@ -127,7 +127,7 @@ BOOL do_unlock(files_struct *fsp,connection_struct *conn,
(double)offset, (double)count, fsp->fsp_name ));
if (OPEN_FSP(fsp) && fsp->can_lock && (fsp->conn == conn)) {
- ok = brl_unlock(fsp->fd_ptr->dev, fsp->fd_ptr->inode, fsp->fnum,
+ ok = brl_unlock(fsp->dev, fsp->inode, fsp->fnum,
global_smbpid, getpid(), conn->cnum,
offset, count);
}
@@ -186,7 +186,7 @@ static TDB_DATA locking_key(SMB_DEV_T dev, SMB_INO_T inode)
}
static TDB_DATA locking_key_fsp(files_struct *fsp)
{
- return locking_key(fsp->fd_ptr->dev, fsp->fd_ptr->inode);
+ return locking_key(fsp->dev, fsp->inode);
}
/*******************************************************************
@@ -207,6 +207,23 @@ BOOL unlock_share_entry(connection_struct *conn,
return tdb_unlockchain(tdb, locking_key(dev, inode)) == 0;
}
+
+/*******************************************************************
+ Lock a hash bucket entry. use a fsp for convenience
+******************************************************************/
+BOOL lock_share_entry_fsp(files_struct *fsp)
+{
+ return tdb_lockchain(tdb, locking_key(fsp->dev, fsp->inode)) == 0;
+}
+
+/*******************************************************************
+ Unlock a hash bucket entry.
+******************************************************************/
+BOOL unlock_share_entry_fsp(files_struct *fsp)
+{
+ return tdb_unlockchain(tdb, locking_key(fsp->dev, fsp->inode)) == 0;
+}
+
/*******************************************************************
Get all share mode entries for a dev/inode pair.
********************************************************************/
@@ -370,7 +387,7 @@ static BOOL mod_share_mode(files_struct *fsp,
shares[i].share_mode == fsp->share_mode &&
memcmp(&shares[i].time,
&fsp->open_time,sizeof(struct timeval)) == 0) {
- mod_fn(&shares[i], fsp->fd_ptr->dev, fsp->fd_ptr->inode, param);
+ mod_fn(&shares[i], fsp->dev, fsp->inode, param);
need_store=1;
}
}