VFS and the new modules system

Stefan (metze) Metzmacher metze at metzemix.de
Wed Mar 26 00:00:01 GMT 2003


At 00:52 26.03.2003 +0100, Stefan (metze) Metzmacher wrote:
>At 23:29 25.03.2003 +0100, Jelmer Vernooij wrote:
>I took Jelmer's patch and modifed it,
>
>to support an easy way to have per connection default_vfs_ops
>and per connection private data in the vfs modules
>
>so every module registers and got a unique vfs module number for te current
>smbd or vfstest process.
>
>now the module only regiter the vfsops_tuple_struct array
>and the vfs_init() and vfs_done() fn's are gone.
>
>vfs_init_custom() hang the default ops for each module on the vfs_handle
>and mark this handle with the unique vfs module number
>
>#define VFS_HANDLE_GET_OPS(conn, ret) \
>         if 
> ((default_vfs_ops=vfs_handle_get_ops(conn,vfs_module_number))==NULL) { \
>                 DEBUG(0,("%s() failed to get 
> default_vfs_ops!\n",FUNCTION_MACRO)); \
>         ret; \
>}
>
>this macro helps the module to get its default_vfs_ops
>
>struct vfs_ops *vfs_handle_get_ops(connection_struct *conn, int vfs_num)
>{
>         struct smb_vfs_handle_struct *handle = NULL;
>         if (!conn) {
>                 DEBUG(0,("vfs_handle_get_ops() called with NULL 
> pointer.\n"));
>                 return NULL;
>         }
>         handle = conn->vfs_handles;
>         while (handle) {
>                 if (handle->vfs_num == vfs_num) {
>                         return &handle->vfs_def_ops;
>                 }
>                 handle = handle->next;
>         }
>         return NULL;
>}
>
>I have converted vfs_recycle.c for this setup:
>
>all options are now resolved in run time (if smb.conf changed and smbd got 
>-HUP)
>the modified options are used
>
>What's left todo for this fix up pramateric options a bit....
>basicly prevent us from memory leeks when we alloc the lp_params values on 
>each call
>
>maybe we should cache the values and make the return values const
>
>But that will be another patch...
>
>I hope you see how the vfs stuff work.

Note: this patch is only a preview to get feedback
it's not tested and there maybe some typos and merging bugs

but here smbd/vfs.o and modules/vfs_recycle.o
are build fine (expect some cast warnings in vfs_recycle.o)



metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <metze at metzemix.de> 



More information about the samba-technical mailing list