Re: [PATCH] module stuff (BIG patch :-)

2003-02-16 Thread Jelmer Vernooij
On Wed, Dec 18, 2002 at 05:30:42PM +0100, Stefan (metze) Metzmacher wrote about 
'[PATCH] module stuff (BIG patch :-)':
 I have tested this patch this afternoon and I have no problems...
Hi Stefan,

Could you please send me a patch for the winsdb stuff only? The patch 
should really be splitted up in small pieces. Also, it contains a lot 
of architectural changes (especially the modules stuff) that haven't 
been discussed yet.

Jelmer



msg06133/pgp0.pgp
Description: PGP signature


[PATCH] module stuff (BIG patch :-)

2002-12-18 Thread Stefan (metze) Metzmacher
Hi Jelmer,

here are the things I changed from the last patch:

in Makefile.in:

DATADIR = @datadir@  jht agree:-)

module stuff:
we now have a

#define SMB_MODULE_INIT_SYMBOL_STR smb_module_init
#define SMB_MODULE_INIT_SYMBOL   smb_module_init

maybe we could postfix a version number? -
SMB_MODULE_INIT_SYMBOL smb_module_init_0_0

we now have the same syntax for the smb_register_*() functions

NTSTATUS smb_register_subsystem(struct subsystem_function_entry *func, 
int interfaceversion);

so we never have to change the parameter of the smb_register_fn's
(the subsystem can change the struct and the interfaceversion, but we'll 
allways have:
NTSTATUS smb_register_fn(void *,int); )

CHARSET stuff:

change prototype
NTSTATUS  smb_register_charset(struct charset_function *func, int 
interfaceversion)

add CHARSET_INTERFACE_VERSION

PASSDB stuff:

change prototype
NTSTATUS  smb_register_passdb(struct pdb_backend_function_entry *func, int 
interfaceversion)

a module now registeres only a struct of function pointers and no init 
function.
there's a new *_init_private_data function that provides the initialisation

we have to get rid of the 'passdb backend = ldapsam:ldap://localhost/'
syntax, (but later if abartlet is back :-)

AUTH stuff:

NTSTATUS smb_register_auth(struct auth_method_function_entry *func, int 
interfaceversion)

a module now registers a struct of function pointers...(maybe we should add 
a init_private_data() as in PASSDB too)

add AUTH_INTERFACE_VERSION

the 'auth method = module:module_param' syntax is gone :-)

VFS stuff:

change the prototype
NTSTATUS  smb_register_vfs(struct vfs_object_function_entry *func, int 
interfaceversion)

we now have conn-vfs_objects (a DLIST with all vfs_objects of the connection)

each vfs module got a global id number, with this number or it's registered 
name it can search itsself in the list. and got it's default options , 
opaque options or any other operations from other modules of the connection.

for making it easy for module writers we have:

vfs_get_deafult_ops(conn,module_id)  to get a pointer to a vfs_ops struct
vfs_get_default_op(conn,module_id,operation_type) to get a pointer to a 
specified operation function

vfs_get_default_ops_by_name(conn,module_name)
vfs_get_default_ops_by_name(conn.module_name)

vfs_get_opaque_ops(conn)
vfs_get_opaque_op(conn,operation_type)

the vfs_init() and vfs_done() function are gone...
and only the vfs_op_tuple array is registered by each module.
( if the module needs to init private data it should be done in the connect 
and disconnect functions)

(tridge: I hope your happy now)

- 'vfs options' is removed ( parametric options should be used)
- 'vfs objects = module1_name{[module2_name]}

---
here th ething witch were in the last patch:

here is a new patch for the modules stuff, parametric options and new 
smb_register_vfs():

- it adds 'modules path' and 'modules' as per share parameter
   (vfs path is now an alias for modules path)

- it add two new parameters to the smb_load_modules function

int smb_load_modules(const char **modules, connection_struct *conn, 
SMB_MODULE_TYPES types)

conn == NULL - for the global section.

SMB_MODULE_TYPES types - this is the bitmask witch module types should be 
loaded here, ( we don't need a winsdb module in smbd... also 
smb_register_winsdb() is not linked to smbd, witch would cause trouble)


now we can use 
smb_load_modules(lp_modules(GLOBAL_SECTION_SNUM),NULL,MODULE_TYPE_CHARSET) 
to load the charsets before the fork in smbd

smb_load_modules(lp_modules(SNUM(conn)),SNUM(conn),MODULE_TYPE_VFS) for 
loading the vfs modules per share..


lp_module_path is dyn_LIBDIR by default...

lib_path() for loading upcase.dat,... is replaced by data_path() witch is 
default dyn_DATADIR

for making jerry and jht happy I use :
DATADIR = @libdir@ in Makefile.in but it should be changed to
DATADIR = @datadir@

%-Macros can be in 'modules path' and 'modules'

- parametric options now all take a default value.
 char *lp_param_string() and char **lp_param_string_list() can be used as 
every othere
 lp_* function with char * or char **
 you should not try to free() the return values of this function!!!

- smb_register_vfs()
   Each SAMBA module must provide following global function:
init_module -- module initalization function

NTSTATUS init_module(SMB_MODULE_TYPES types)
{
if (types  MODULE_TYPE_VFS) {
if (smb_register_vfs(recycle, vfs_recycle_init, 
VFS_INTERFACE_VERSION)) {
return NT_STATUS_OK;
} else {
return NT_STATUS_UNSUCCESSFUL;
}
}

return NT_STATUS_OK;
}

Each VFS module must provide following global function:
vfs_*_init  -- vfs initialization function

vfs_*_init (e.g. vfs_recycle_init ) must return proper