VFS MODULE writers HEAD's up!!! Fixing Cascaded VFS modules

Stefan (metze) Metzmacher metze at metzemix.de
Fri Apr 18 21:41:16 GMT 2003

Hi all,

the current design of handling the cascaded vfs modules.

is broken for the following setup:

         path = /data1
         vfs object = audit recycle

         path = /data2
         vfs object = audit fake_perms

1.)Since the audit module has a global:
vfs_ops default_vfs_ops; struct

this can only holds the recylce vfs_ops OR the fake_perms ops.

So what we need is, a function witch returns the default vfs_ops
for the module and the current onnection.

So Jelmer and me have choosen a solution for this.

this old module:
static int example_stat(struct connection_struct *conn, const char *fname, 
         return default_vfs_ops.stat(conn, fname, sbuf);

the new module:
static int example_stat(struct connection_struct *conn, const char *fname, 

         VFS_HANDLE_GET_OPS(conn, return -1);

         return default_vfs_ops->stat(conn, fname, sbuf);

So for module writers it would be very easy to port there modules to the 
new system.

just add


         VFS_HANDLE_GET_OPS(conn, return -1);

on top of each function that should be able to call a vfs_op of the next 
module in the chain.

and then in site the code:
the '.' move to a '->':

default_vfs_ops.stat(conn, fname, sbuf);
default_vfs_ops->stat(conn, fname, sbuf);

The rest will be done by the VFS_HANDLE_GET_OPS macro!
( there will be also macros to set and get per connection private data for 
the modules)

2.) Since we have the new module loading system
we can remove the vfs_init() and vfs_done() functions
(we allready have vfs_connect() an vfs_disconnect() to manage the per 
connection stuff)

the smb_register_vfs() fn will directly register the vfs_op_tuple array.

3.) Limitation of the system:

we can't allow:

vfs object = recycle audit recycle

but I think such a combination doesn't make any sense.

and if someone would really need it, he should copy the recycle.c to recycle2.c

let the recycle2.c register under name 'recycle2'

and then he could use:

vfs object = recycle audit recycle2

4.) Does anybody has any objections against this system?

It would be really cool to get a fast feedback!!!
Because I think this fix should be get its way into SAMBA 3.0 !!!

(I have allready a working patch for this)

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

More information about the samba-technical mailing list