diff options
author | Volker Lendecke <vl@samba.org> | 2009-05-18 09:46:05 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-05-18 10:42:22 +0200 |
commit | 22085c59cb31e90bd7fb555f54836f057bf4018b (patch) | |
tree | 41d4623fb0b4c0389c20b7db070a604e8b65f75a /source3/smbd | |
parent | 8b9c5f04831216aa3d3b89fd2a81be12ac8592dd (diff) | |
download | samba-22085c59cb31e90bd7fb555f54836f057bf4018b.tar.gz samba-22085c59cb31e90bd7fb555f54836f057bf4018b.tar.bz2 samba-22085c59cb31e90bd7fb555f54836f057bf4018b.zip |
Add "file_walk_table" to do stuff with all open files
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/files.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c index d2ea520146..0e6dd7e457 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -204,6 +204,28 @@ void file_close_user(int vuid) } } +/* + * Walk the files table until "fn" returns non-NULL + */ + +struct files_struct *file_walk_table( + struct files_struct *(*fn)(struct files_struct *fsp, + void *private_data), + void *private_data) +{ + struct files_struct *fsp, *next; + + for (fsp = Files; fsp; fsp = next) { + struct files_struct *ret; + next = fsp->next; + ret = fn(fsp, private_data); + if (ret != NULL) { + return ret; + } + } + return NULL; +} + /**************************************************************************** Debug to enumerate all open files in the smbd. ****************************************************************************/ |