summaryrefslogtreecommitdiff
path: root/source3/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
commit98c082489bec0a0ce4db1daf4390e785381f229a (patch)
treee0872d7bdb525991311bab54137208381a58c223 /source3/smbd/files.c
parent143a364d6253125c27e229d533940a6822ce7575 (diff)
downloadsamba-98c082489bec0a0ce4db1daf4390e785381f229a.tar.gz
samba-98c082489bec0a0ce4db1daf4390e785381f229a.tar.bz2
samba-98c082489bec0a0ce4db1daf4390e785381f229a.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 (This used to be commit bcf5c751cbe203c00814642e26440cf88f300bce)
Diffstat (limited to 'source3/smbd/files.c')
-rw-r--r--source3/smbd/files.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 7069818dee..8df7a29a65 100644
--- a/source3/smbd/files.c
+++ b/source3/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--;