summaryrefslogtreecommitdiff
path: root/source3/locking/locking.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-10-23 03:34:50 +0000
committerJeremy Allison <jra@samba.org>1998-10-23 03:34:50 +0000
commit9bb7ac81b6e4d33e1be49447dbdbbb8d24259f53 (patch)
tree0bffe55dcb3dee8574d89546af83bd44cd476491 /source3/locking/locking.c
parent1e60cc49f5ecb864ab965a6e7ab9287e1204d1d6 (diff)
downloadsamba-9bb7ac81b6e4d33e1be49447dbdbbb8d24259f53.tar.gz
samba-9bb7ac81b6e4d33e1be49447dbdbbb8d24259f53.tar.bz2
samba-9bb7ac81b6e4d33e1be49447dbdbbb8d24259f53.zip
Reasonably large change to give us *exactly* correct NT delete on close semantics.
This was trickier than it looks :-). Check out the new DELETE_ON_CLOSE flag in the share modes and the new code that iterates through all open files on the same device and inode in files.c and trans2.c Also changed the code that modifies share mode entries to take generic function pointers rather than doing a specific thing so this sort of change should be easier in the future. Jeremy. (This used to be commit 5e6a7cd99d29d1cf068fc517272559c1cf47ea3a)
Diffstat (limited to 'source3/locking/locking.c')
-rw-r--r--source3/locking/locking.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index f088720e0a..b71b775524 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -230,11 +230,52 @@ BOOL set_share_mode(int token, files_struct *fsp, uint16 port, uint16 op_type)
}
/*******************************************************************
+ Static function that actually does the work for the generic function
+ below.
+********************************************************************/
+
+static void remove_share_oplock_fn(share_mode_entry *entry, SMB_DEV_T dev, SMB_INO_T inode,
+ void *param)
+{
+ DEBUG(10,("remove_share_oplock_fn: removing oplock info for entry dev=%x ino=%.0f\n",
+ (unsigned int)dev, (double)inode ));
+ /* Delete the oplock info. */
+ entry->op_port = 0;
+ entry->op_type = 0;
+}
+
+/*******************************************************************
Remove an oplock port and mode entry from a share mode.
********************************************************************/
-BOOL remove_share_oplock(files_struct *fsp, int token)
+
+BOOL remove_share_oplock(int token, files_struct *fsp)
+{
+ return share_ops->mod_entry(token, fsp, remove_share_oplock_fn, NULL);
+}
+
+/*******************************************************************
+ Static function that actually does the work for the generic function
+ below.
+********************************************************************/
+
+static void modify_share_mode_fn(share_mode_entry *entry, SMB_DEV_T dev, SMB_INO_T inode,
+ void *param)
+{
+ int new_share_mode = *(int *)param;
+ DEBUG(10,("modify_share_mode_fn: changing share mode info from %x to %x for entry dev=%x ino=%.0f\n",
+ entry->share_mode, new_share_mode, (unsigned int)dev, (double)inode ));
+ /* Change the share mode info. */
+ entry->share_mode = new_share_mode;
+}
+
+/*******************************************************************
+ Modify a share mode on a file. Used by the delete open file code.
+ Return False on fail, True on success.
+********************************************************************/
+
+BOOL modify_share_mode(int token, files_struct *fsp, int new_mode)
{
- return share_ops->remove_oplock(fsp, token);
+ return share_ops->mod_entry(token, fsp, modify_share_mode_fn, (void *)&new_mode);
}
/*******************************************************************