summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-06-04 17:54:41 +0200
committerStefan Metzmacher <metze@samba.org>2012-06-06 10:18:36 +0200
commitcd3e658d8251de17f3657670f2026d8b22e6a376 (patch)
tree046af73b34624e0ebef2cd2928b3ae8e2f0adf06 /source3
parenta8e7c57862ce4511b5e9503265c1dbff575bd373 (diff)
downloadsamba-cd3e658d8251de17f3657670f2026d8b22e6a376.tar.gz
samba-cd3e658d8251de17f3657670f2026d8b22e6a376.tar.bz2
samba-cd3e658d8251de17f3657670f2026d8b22e6a376.zip
s3:smbd: add vfs_remove_all_fsp_extensions()
metze
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/proto.h1
-rw-r--r--source3/smbd/vfs.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 6358286ab9..693a498026 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -1149,6 +1149,7 @@ void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle,
files_struct *fsp, size_t ext_size,
void (*destroy_fn)(void *p_data));
void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
+void vfs_remove_all_fsp_extensions(struct files_struct *fsp);
void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
bool smbd_vfs_init(connection_struct *conn);
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 2be6c54a88..60320e6069 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -261,6 +261,27 @@ void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
}
}
+void vfs_remove_all_fsp_extensions(files_struct *fsp)
+{
+ struct vfs_fsp_data *curr;
+ struct vfs_fsp_data *prev;
+
+ for (curr = fsp->vfs_extension, prev = NULL;
+ curr;
+ prev = curr, curr = curr->next)
+ {
+ if (prev) {
+ prev->next = curr->next;
+ } else {
+ fsp->vfs_extension = curr->next;
+ }
+ if (curr->destroy) {
+ curr->destroy(EXT_DATA_AREA(curr));
+ }
+ TALLOC_FREE(curr);
+ }
+}
+
void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
{
struct vfs_fsp_data *head;