Expose per-fsp extension talloc context.
authorJames Peach <jpeach@apple.com>
Mon, 15 Oct 2007 21:01:12 +0000 (14:01 -0700)
committerJames Peach <jpeach@samba.org>
Thu, 20 Dec 2007 06:20:09 +0000 (22:20 -0800)
This patch supplements the fsp extension API with an operation to
retrieve the malloc zone pointer for that fsp.
(This used to be commit d5d9e4084cfb3db3bebff0334b93f376022ef5d3)

source3/include/vfs.h
source3/smbd/vfs.c

index e1669a271c4c08975290c04522fcb00d29386335..276f820fbcca7020426cb3a55ab39c874e76d750 100644 (file)
@@ -579,12 +579,21 @@ typedef struct vfs_statvfs_struct {
        /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call   */
 } vfs_statvfs_struct;
 
+/* Add a new FSP extension of the given type. Returns a pointer to the
+ * extenstion data.
+ */
 #define VFS_ADD_FSP_EXTENSION(handle, fsp, type) \
     vfs_add_fsp_extension_notype(handle, (fsp), sizeof(type))
 
+/* Return a pointer to the existing FSP extension data. */
 #define VFS_FETCH_FSP_EXTENSION(handle, fsp) \
     vfs_fetch_fsp_extension(handle, (fsp))
 
+/* Return the talloc context associated with an FSP extension. */
+#define VFS_MEMCTX_FSP_EXTENSION(handle, fsp) \
+    vfs_memctx_fsp_extension(handle, (fsp))
+
+/* Remove and destroy an FSP extension. */
 #define VFS_REMOVE_FSP_EXTENSION(handle, fsp) \
     vfs_remove_fsp_extension((handle), (fsp))
 
index 45d0788117c160dd298acfe226da56eb61d294ed..96d71da8d926b020e786caa8248fa7cc90d7bdc1 100644 (file)
@@ -263,19 +263,31 @@ void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
        }
 }
 
-void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
+void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
 {
        struct vfs_fsp_data *head;
 
        for (head = fsp->vfs_extension; head; head = head->next) {
                if (head->owner == handle) {
-                       return EXT_DATA_AREA(head);
+                       return head;
                }
        }
 
        return NULL;
 }
 
+void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp)
+{
+       struct vfs_fsp_data *head;
+
+       head = vfs_memctx_fsp_extension(handle, fsp);
+       if (head != NULL) {
+               return EXT_DATA_AREA(head);
+       }
+
+       return NULL;
+}
+
 #undef EXT_DATA_AREA
 
 /*****************************************************************