summaryrefslogtreecommitdiffstats
path: root/source/smbd/files.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-12-28 21:50:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:46 -0500
commitbcf5c751cbe203c00814642e26440cf88f300bce (patch)
tree28b34332e97db9a922ebaf2e51a042d629a6aa06 /source/smbd/files.c
parent48798b5e57fcb2ee7debfe9d5178adef37907f92 (diff)
downloadsamba-bcf5c751cbe203c00814642e26440cf88f300bce.tar.gz
samba-bcf5c751cbe203c00814642e26440cf88f300bce.tar.xz
samba-bcf5c751cbe203c00814642e26440cf88f300bce.zip
r20394: This is a *VERY* early start of my work on notify.
Checking in because Jeremy was bugging me. Potentially this becomes quite intrusive, I'm not sure if I should open a temporary branch for this. Jeremy, Jerry, do you think 3_0 is the right place for this? Volker
Diffstat (limited to 'source/smbd/files.c')
-rw-r--r--source/smbd/files.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/source/smbd/files.c b/source/smbd/files.c
index 7069818dee4..8df7a29a65d 100644
--- a/source/smbd/files.c
+++ b/source/smbd/files.c
@@ -100,6 +100,12 @@ NTSTATUS file_new(connection_struct *conn, files_struct **result)
ZERO_STRUCTP(fsp->fh);
+ if (!(fsp->notify = TALLOC_ZERO_P(NULL, struct notify_changes))) {
+ SAFE_FREE(fsp->fh);
+ SAFE_FREE(fsp);
+ return NT_STATUS_NO_MEMORY;
+ }
+
fsp->fh->ref_count = 1;
fsp->fh->fd = -1;
@@ -362,6 +368,35 @@ files_struct *file_find_di_next(files_struct *start_fsp)
}
/****************************************************************************
+ Find the directory fsp given a device and inode with the lowest
+ file_id. First use is for notify actions.
+****************************************************************************/
+
+files_struct *file_find_dir_lowest_id(SMB_DEV_T dev, SMB_INO_T inode)
+{
+ files_struct *fsp;
+ files_struct *min_fsp = NULL;
+
+ for (fsp = Files; fsp; fsp = fsp->next) {
+ if (!fsp->is_directory
+ || fsp->dev != dev || fsp->inode != inode) {
+ continue;
+ }
+
+ if (min_fsp == NULL) {
+ min_fsp = fsp;
+ continue;
+ }
+
+ if (fsp->fh->file_id < min_fsp->fh->file_id) {
+ min_fsp = fsp;
+ }
+ }
+
+ return min_fsp;
+}
+
+/****************************************************************************
Find a fsp that is open for printing.
****************************************************************************/
@@ -439,6 +474,8 @@ void file_free(files_struct *fsp)
fsp->fh->ref_count--;
}
+ TALLOC_FREE(fsp->notify);
+
bitmap_clear(file_bmap, fsp->fnum - FILE_HANDLE_OFFSET);
files_used--;