VFS and the new modules system

Stefan (metze) Metzmacher metze at metzemix.de
Wed Apr 2 10:52:45 GMT 2003


Hi Alexander,

here are the my current patch with the following changes:

1. the connection_struct has 3 new members

(add the end of the struct (to let old modules working without knowing 
about the new fields)

TALLOC_CTX *mem_ctx, the whole connection_struct is talloced now
struct vfs_ops *vfs_opaque_ops, hte global opaque_ops atr removed and now 
per connection
struct vfs_handle_struct *vfs_handle, this holds a list of the vfs_handles 
for the new modules
(struct smb_vfs_handle_struct *vfs_private, is still there for the old modules)

both handle structs are talloced on the connection context.

there maybe also some minir fixes...

metze


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...




metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <metze at metzemix.de> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vfs-03.diff
Type: application/octet-stream
Size: 82626 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20030402/8bd8ab6b/vfs-03.obj


More information about the samba-technical mailing list