VFS and the new modules system
Stefan (metze) Metzmacher
metze at metzemix.de
Tue Mar 25 23:52:45 GMT 2003
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.
Comments are welcome
Goodnight all...
metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <metze at metzemix.de>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vfs-02.diff
Type: application/octet-stream
Size: 44520 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20030326/101e16e7/vfs-02.obj
More information about the samba-technical
mailing list