diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2003-11-25 03:15:26 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2003-11-25 03:15:26 +0000 |
commit | a846e592058726b670e40505493a4668bd856186 (patch) | |
tree | ef949e82c7bbd5e58dffb11f75ecababcf10d369 /source4/ntvfs/ntvfs_base.c | |
parent | 97dbe926ecbc71a8b0f423c07b09140f44647598 (diff) | |
download | samba-a846e592058726b670e40505493a4668bd856186.tar.gz samba-a846e592058726b670e40505493a4668bd856186.tar.bz2 samba-a846e592058726b670e40505493a4668bd856186.zip |
CVS: ----------------------------------------------------------------------
CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS: Makefile.in configure.in include/includes.h include/ntvfs.h
CVS: include/smb.h lib/iconv.c lib/module.c ntvfs/ntvfs_base.c
CVS: ntvfs/cifs/vfs_cifs.c ntvfs/ipc/vfs_ipc.c
CVS: ntvfs/posix/vfs_posix.c ntvfs/print/vfs_print.c
CVS: ntvfs/reference/vfs_ref.c ntvfs/simple/vfs_simple.c
CVS: passdb/pdb_interface.c
CVS: Added Files:
CVS: include/module.h
CVS: ----------------------------------------------------------------------
Update to the modules system. Fixed:
- get rid of smb_probe_module
- merge older updates from 3.0
- introduced register_subsystem() and register_backend() functions
- adapt ntvfs and charset to use new register functions
- made smb_load_modules() work recursively (e.g. 'preload modules = /usr/lib/samba')
- got rid of some old remains
Things that still need work:
- Did I break tankFS? I don't think so, but I can't test it here :-(
- Add 'postload modules = ' (for modules that need to be loaded after fork() in smbd, if applicable)
- Convert RPC, auth, passdb, etc to use new register_{subsystem,backend}() functions
- Accept wildcards in 'preload modules' option, instead of loading recursively
(This used to be commit 7512b9ab1a8b3103f7a6c13f736353c46a26b668)
Diffstat (limited to 'source4/ntvfs/ntvfs_base.c')
-rw-r--r-- | source4/ntvfs/ntvfs_base.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c index 57cdb97e9f..11f39c5d59 100644 --- a/source4/ntvfs/ntvfs_base.c +++ b/source4/ntvfs/ntvfs_base.c @@ -28,8 +28,6 @@ * can be more than one backend with the same name, as long as they * have different typesx */ static struct { - const char *name; - enum ntvfs_type type; struct ntvfs_ops *ops; } *backends = NULL; static int num_backends; @@ -42,13 +40,15 @@ static int num_backends; The 'type' is used to specify whether this is for a disk, printer or IPC$ share */ -BOOL ntvfs_register(const char *name, enum ntvfs_type type, struct ntvfs_ops *ops) +static NTSTATUS ntvfs_register(void *_ops) { - if (ntvfs_backend_byname(name, type) != NULL) { + struct ntvfs_ops *ops = _ops; + + if (ntvfs_backend_byname(ops->name, ops->type) != NULL) { /* its already registered! */ DEBUG(2,("NTVFS backend '%s' for type %d already registered\n", - name, (int)type)); - return False; + ops->name, (int)ops->type)); + return NT_STATUS_OBJECT_NAME_COLLISION; } backends = Realloc(backends, sizeof(backends[0]) * (num_backends+1)); @@ -56,13 +56,12 @@ BOOL ntvfs_register(const char *name, enum ntvfs_type type, struct ntvfs_ops *op smb_panic("out of memory in ntvfs_register"); } - backends[num_backends].name = smb_xstrdup(name); - backends[num_backends].type = type; backends[num_backends].ops = smb_xmemdup(ops, sizeof(*ops)); + backends[num_backends].ops->name = smb_xstrdup(ops->name); num_backends++; - return True; + return NT_STATUS_OK; } @@ -74,8 +73,8 @@ struct ntvfs_ops *ntvfs_backend_byname(const char *name, enum ntvfs_type type) int i; for (i=0;i<num_backends;i++) { - if (backends[i].type == type && - strcmp(backends[i].name, name) == 0) { + if (backends[i].ops->type == type && + strcmp(backends[i].ops->name, name) == 0) { return backends[i].ops; } } @@ -105,19 +104,10 @@ int ntvfs_interface_version(struct ntvfs_critical_sizes *sizes) */ BOOL ntvfs_init(void) { - /* initialise our 3 basic backends. These are assumed to be - * present and are always built in */ - if (!posix_vfs_init() || - !ipc_vfs_init() || - !print_vfs_init()) { - return False; - } - /* initialize optional backends, e.g. CIFS. We allow failures here. */ - cifs_vfs_init(); + register_subsystem("ntvfs", ntvfs_register); -#if WITH_NTVFS_STFS - tank_vfs_init(); -#endif + /* FIXME: Perhaps panic if a basic backend, such as IPC, fails to initialise? */ + static_init_ntvfs; DEBUG(3,("NTVFS version %d initialised\n", NTVFS_INTERFACE_VERSION)); return True; |