disign of the VFS modules

Stefan (metze) Metzmacher metze at metzemix.de
Tue Nov 26 13:25:01 GMT 2002


At 13:40 26.11.2002 +0100, Stefan (metze) Metzmacher wrote:
>we need a way to access vfs_handle in all module functions but don't make 
>vfs_handle global!!! conn->vfs_private is the head of a DLIST and we need 
>a way to access the right element of this list.
>
>has anybody an idea???

the following small patch should make it possible.

the vfs_init functions gets vfs_handle

and the module can have a DLIST witch cantains the following struct
struct {
         unsigned cnum;
         struct smb_vfs_handle_struct  *handle;
}

vfs_handle->conn->cnum contains a unique connection number with this as key 
we can find the pointer to the vfs_handle used for the current connection.


metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <metze at metzemix.de>
-------------- next part --------------
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/include/smb.h HEAD-fix/source/include/smb.h
--- HEAD/source/include/smb.h	Fri Nov  8 07:25:32 2002
+++ HEAD-fix/source/include/smb.h	Tue Nov 26 14:11:55 2002
@@ -428,7 +428,8 @@ typedef struct smb_vfs_handle_struct
     /* Handle on dlopen() call */
     void *handle;
     struct smb_vfs_handle_struct  *next, *prev;
-    
+
+    struct connection_struct *conn;
 } smb_vfs_handle_struct;
 
 typedef struct connection_struct
diff -Npur --exclude=CVS --exclude=*.bak --exclude=*.o --exclude=*.po --exclude=.#* HEAD/source/smbd/vfs.c HEAD-fix/source/smbd/vfs.c
--- HEAD/source/smbd/vfs.c	Thu Oct 24 11:11:00 2002
+++ HEAD-fix/source/smbd/vfs.c	Tue Nov 26 14:09:20 2002
@@ -238,6 +238,7 @@ BOOL smbd_vfs_init(connection_struct *co
 					handle = (struct smb_vfs_handle_struct *) smb_xmalloc(sizeof(smb_vfs_handle_struct));
 					/* Loadable object file */
 					handle->handle = NULL;
+					handle->conn = conn;
 					DLIST_ADD(conn->vfs_private, handle)
 					vfs_module = NULL;
 					if (vfs_path) {


More information about the samba-technical mailing list