summaryrefslogtreecommitdiff
path: root/source3/smbd/files.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-04-24 19:23:51 +0000
committerJeremy Allison <jra@samba.org>2000-04-24 19:23:51 +0000
commite82dbfcbe97c79b1c81915ae949bb2b1763970ba (patch)
tree6575dd984ef9bdf74807736d48fe4eee856b96df /source3/smbd/files.c
parentb76e942639ab4d75bbf8103f6ea0822466b7615d (diff)
downloadsamba-e82dbfcbe97c79b1c81915ae949bb2b1763970ba.tar.gz
samba-e82dbfcbe97c79b1c81915ae949bb2b1763970ba.tar.bz2
samba-e82dbfcbe97c79b1c81915ae949bb2b1763970ba.zip
Now that fsp's are created on successful file open, the structure member
fsp->open is no longer needed (if an fsp pointer is valid, then it's open :-). NB for Luke, this patch also did not apply to TNG. TNG is not yet identical w.r.t file serving with HEAD. This makes it impossible for me to help maintain TNG. Please fix asap. lib/substitute.c: Removed unused variable (pidstr). Jeremy. (This used to be commit 389b700a26e8a308a0dff6fc038c38068aa0119a)
Diffstat (limited to 'source3/smbd/files.c')
-rw-r--r--source3/smbd/files.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 6c0465097b..e644f52669 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -120,7 +120,7 @@ void file_close_conn(connection_struct *conn)
for (fsp=Files;fsp;fsp=next) {
next = fsp->next;
- if (fsp->conn == conn && fsp->open) {
+ if (fsp->conn == conn) {
close_file(fsp,False);
}
}
@@ -173,7 +173,7 @@ void file_close_user(int vuid)
for (fsp=Files;fsp;fsp=next) {
next=fsp->next;
- if ((fsp->vuid == vuid) && fsp->open) {
+ if (fsp->vuid == vuid) {
close_file(fsp,False);
}
}
@@ -191,8 +191,7 @@ files_struct *file_find_dit(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval
files_struct *fsp;
for (fsp=Files;fsp;fsp=fsp->next,count++) {
- if (fsp->open &&
- fsp->fd != -1 &&
+ if (fsp->fd != -1 &&
fsp->dev == dev &&
fsp->inode == inode &&
(tval ? (fsp->open_time.tv_sec == tval->tv_sec) : True ) &&
@@ -208,6 +207,22 @@ files_struct *file_find_dit(SMB_DEV_T dev, SMB_INO_T inode, struct timeval *tval
}
/****************************************************************************
+ Check if an fsp still exists.
+****************************************************************************/
+
+files_struct *file_find_fsp(files_struct *orig_fsp)
+{
+ files_struct *fsp;
+
+ for (fsp=Files;fsp;fsp=fsp->next) {
+ if (fsp == orig_fsp)
+ return fsp;
+ }
+
+ return NULL;
+}
+
+/****************************************************************************
Find the first fsp given a device and inode.
****************************************************************************/
@@ -216,8 +231,7 @@ 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 != -1 &&
+ if ( fsp->fd != -1 &&
fsp->dev == dev &&
fsp->inode == inode )
return fsp;
@@ -235,8 +249,7 @@ 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 != -1 &&
+ if ( fsp->fd != -1 &&
fsp->dev == start_fsp->dev &&
fsp->inode == start_fsp->inode )
return fsp;
@@ -253,7 +266,7 @@ files_struct *file_find_print(void)
files_struct *fsp;
for (fsp=Files;fsp;fsp=fsp->next) {
- if (fsp->open && fsp->print_file) return fsp;
+ if (fsp->print_file) return fsp;
}
return NULL;
@@ -269,7 +282,7 @@ void file_sync_all(connection_struct *conn)
for (fsp=Files;fsp;fsp=next) {
next=fsp->next;
- if (fsp->open && (conn == fsp->conn) && (fsp->fd != -1)) {
+ if ((conn == fsp->conn) && (fsp->fd != -1)) {
conn->vfs_ops.fsync(fsp->fd);
}
}