summaryrefslogtreecommitdiff
path: root/source3/smbd/files.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/smbd/files.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/smbd/files.c')
-rw-r--r--source3/smbd/files.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index c369a45bab..e58c3834a0 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -277,6 +277,41 @@ files_struct *file_find_dit(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval
return NULL;
}
+/****************************************************************************
+ Find the first fsp given a device and inode.
+****************************************************************************/
+
+files_struct *file_find_di_first(SMB_DEV_T dev, SMB_INO_T inode)
+{
+ files_struct *fsp;
+
+ for (fsp=Files;fsp;fsp=fsp->next) {
+ if (fsp->open &&
+ fsp->fd_ptr->dev == dev &&
+ fsp->fd_ptr->inode == inode )
+ return fsp;
+ }
+
+ return NULL;
+}
+
+/****************************************************************************
+ Find the next fsp having the same device and inode.
+****************************************************************************/
+
+files_struct *file_find_di_next(files_struct *start_fsp)
+{
+ files_struct *fsp;
+
+ for (fsp = start_fsp->next;fsp;fsp=fsp->next) {
+ if (fsp->open &&
+ fsp->fd_ptr->dev == start_fsp->fd_ptr->dev &&
+ fsp->fd_ptr->inode == start_fsp->fd_ptr->inode )
+ return fsp;
+ }
+
+ return NULL;
+}
/****************************************************************************
find a fsp that is open for printing