summaryrefslogtreecommitdiff
path: root/source3/smbd/vfs.c
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-01-31 20:51:04 -0800
committerTim Prouty <tprouty@samba.org>2009-02-09 23:46:12 -0800
commit122dbbf00acc1768f98e5b57e94aab2b61671f40 (patch)
tree97dd65074e1d07f582ba945f50a9fb90d078cd05 /source3/smbd/vfs.c
parentfe5b0b595c926aea0916541ceeaf610bc018cb63 (diff)
downloadsamba-122dbbf00acc1768f98e5b57e94aab2b61671f40.tar.gz
samba-122dbbf00acc1768f98e5b57e94aab2b61671f40.tar.bz2
samba-122dbbf00acc1768f98e5b57e94aab2b61671f40.zip
s3 vfs: Add a destructor to the fsp extension data API
I'm not certain if the dummy pointer is needed in struct vfs_fsp_data, but I added it to be consistent with the comment below.
Diffstat (limited to 'source3/smbd/vfs.c')
-rw-r--r--source3/smbd/vfs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index df5a39eea2..515e557f67 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -220,7 +220,9 @@ bool vfs_init_custom(connection_struct *conn, const char *vfs_object)
#define EXT_DATA_AREA(e) ((uint8 *)(e) + sizeof(struct vfs_fsp_data))
-void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle, files_struct *fsp, size_t ext_size)
+void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle,
+ files_struct *fsp, size_t ext_size,
+ void (*destroy_fn)(void *p_data))
{
struct vfs_fsp_data *ext;
void * ext_data;
@@ -238,6 +240,7 @@ void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle, files_struct *fsp,
ext->owner = handle;
ext->next = fsp->vfs_extension;
+ ext->destroy = destroy_fn;
fsp->vfs_extension = ext;
return EXT_DATA_AREA(ext);
}
@@ -256,6 +259,9 @@ void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
} else {
fsp->vfs_extension = curr->next;
}
+ if (curr->destroy) {
+ curr->destroy(EXT_DATA_AREA(curr));
+ }
TALLOC_FREE(curr);
return;
}