summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2003-11-25 03:15:26 +0000
committerJelmer Vernooij <jelmer@samba.org>2003-11-25 03:15:26 +0000
commita846e592058726b670e40505493a4668bd856186 (patch)
treeef949e82c7bbd5e58dffb11f75ecababcf10d369 /source4/ntvfs
parent97dbe926ecbc71a8b0f423c07b09140f44647598 (diff)
downloadsamba-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')
-rw-r--r--source4/ntvfs/cifs/vfs_cifs.c14
-rw-r--r--source4/ntvfs/ipc/vfs_ipc.c14
-rw-r--r--source4/ntvfs/ntvfs_base.c36
-rw-r--r--source4/ntvfs/posix/vfs_posix.c16
-rw-r--r--source4/ntvfs/print/vfs_print.c14
-rw-r--r--source4/ntvfs/simple/vfs_simple.c14
6 files changed, 54 insertions, 54 deletions
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index 1afdb66a1c..3903203505 100644
--- a/source4/ntvfs/cifs/vfs_cifs.c
+++ b/source4/ntvfs/cifs/vfs_cifs.c
@@ -672,12 +672,15 @@ static NTSTATUS cvfs_trans2(struct request_context *req, struct smb_trans2 *tran
/*
initialise the CIFS->CIFS backend, registering ourselves with the ntvfs subsystem
*/
-BOOL cifs_vfs_init(void)
+NTSTATUS ntvfs_cifs_init(void)
{
- BOOL ret;
+ NTSTATUS ret;
struct ntvfs_ops ops;
ZERO_STRUCT(ops);
+
+ ops.name = "cifs";
+ ops.type = NTVFS_DISK;
/* fill in all the operations */
ops.connect = cvfs_connect;
@@ -712,12 +715,11 @@ BOOL cifs_vfs_init(void)
/* register ourselves with the NTVFS subsystem. We register under the name 'cifs'. */
- ret = ntvfs_register("cifs", NTVFS_DISK, &ops);
+ ret = register_backend("ntvfs", &ops);
- if (!ret) {
+ if (!NT_STATUS_IS_OK(ret)) {
DEBUG(0,("Failed to register CIFS backend!\n"));
- return False;
}
- return True;
+ return ret;
}
diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c
index b13c358dd5..da5c42507a 100644
--- a/source4/ntvfs/ipc/vfs_ipc.c
+++ b/source4/ntvfs/ipc/vfs_ipc.c
@@ -248,14 +248,16 @@ NTSTATUS ipc_search_close(struct request_context *req, union smb_search_close *i
/*
initialialise the IPC backend, registering ourselves with the ntvfs subsystem
*/
-BOOL ipc_vfs_init(void)
+NTSTATUS ntvfs_ipc_init(void)
{
- BOOL ret;
+ NTSTATUS ret;
struct ntvfs_ops ops;
ZERO_STRUCT(ops);
/* fill in all the operations */
+ ops.name = "ipc";
+ ops.type = NTVFS_IPC;
ops.connect = ipc_connect;
ops.disconnect = ipc_disconnect;
ops.unlink = ipc_unlink;
@@ -284,12 +286,12 @@ BOOL ipc_vfs_init(void)
ops.search_close = ipc_search_close;
/* register ourselves with the NTVFS subsystem. */
- ret = ntvfs_register("ipc", NTVFS_IPC, &ops);
+ ret = register_backend("ntvfs", &ops);
- if (!ret) {
+ if (!NT_STATUS_IS_OK(ret)) {
DEBUG(0,("Failed to register IPC backend!\n"));
- return False;
+ return ret;
}
- return True;
+ return ret;
}
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;
diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c
index b27e7493a0..9a35f19322 100644
--- a/source4/ntvfs/posix/vfs_posix.c
+++ b/source4/ntvfs/posix/vfs_posix.c
@@ -23,7 +23,7 @@
This is the default backend
*/
-#include "includes.h"
+#include "include/includes.h"
/*
connect to a share - used when a tree_connect operation comes
@@ -126,12 +126,15 @@ static NTSTATUS pvfs_unlink(struct ntvfs_context *ctx, const char *name, uint16
/*
initialialise the POSIX disk backend, registering ourselves with the ntvfs subsystem
*/
-BOOL posix_vfs_init(void)
+NTSTATUS ntvfs_posix_init(void)
{
- BOOL ret;
+ NTSTATUS ret;
struct ntvfs_ops ops;
ZERO_STRUCT(ops);
+
+ ops.name = "default";
+ ops.type = NTVFS_DISK;
/* fill in all the operations */
ops.connect = pvfs_connect;
@@ -140,12 +143,11 @@ BOOL posix_vfs_init(void)
/* register ourselves with the NTVFS subsystem. We register under the name 'default'
as we wish to be the default backend */
- ret = ntvfs_register("default", NTVFS_DISK, &ops);
+ ret = register_backend("ntvfs", &ops);
- if (!ret) {
+ if (!NT_STATUS_IS_OK(ret)) {
DEBUG(0,("Failed to register POSIX backend!\n"));
- return False;
}
- return True;
+ return ret;
}
diff --git a/source4/ntvfs/print/vfs_print.c b/source4/ntvfs/print/vfs_print.c
index 2563f0ad9c..82829d759a 100644
--- a/source4/ntvfs/print/vfs_print.c
+++ b/source4/ntvfs/print/vfs_print.c
@@ -78,13 +78,16 @@ static NTSTATUS print_ioctl(struct request_context *req, struct smb_ioctl *io)
/*
initialialise the print backend, registering ourselves with the ntvfs subsystem
*/
-BOOL print_vfs_init(void)
+NTSTATUS ntvfs_print_init(void)
{
- BOOL ret;
+ NTSTATUS ret;
struct ntvfs_ops ops;
ZERO_STRUCT(ops);
+ ops.name = "default";
+ ops.type = NTVFS_PRINT;
+
/* fill in all the operations */
ops.connect = print_connect;
ops.disconnect = print_disconnect;
@@ -93,12 +96,11 @@ BOOL print_vfs_init(void)
/* register ourselves with the NTVFS subsystem. We register under the name 'default'
as we wish to be the default backend */
- ret = ntvfs_register("default", NTVFS_PRINT, &ops);
+ ret = register_backend("ntvfs", &ops);
- if (!ret) {
+ if (!NT_STATUS_IS_OK(ret)) {
DEBUG(0,("Failed to register PRINT backend!\n"));
- return False;
}
- return True;
+ return ret;
}
diff --git a/source4/ntvfs/simple/vfs_simple.c b/source4/ntvfs/simple/vfs_simple.c
index c08b36fb39..f7ba41522c 100644
--- a/source4/ntvfs/simple/vfs_simple.c
+++ b/source4/ntvfs/simple/vfs_simple.c
@@ -807,13 +807,16 @@ static NTSTATUS svfs_search_close(struct request_context *req, union smb_search_
/*
initialialise the POSIX disk backend, registering ourselves with the ntvfs subsystem
*/
-BOOL posix_vfs_init(void)
+NTSTATUS ntvfs_simple_init(void)
{
- BOOL ret;
+ NTSTATUS ret;
struct ntvfs_ops ops;
ZERO_STRUCT(ops);
+ ops.name = "simple";
+ ops.type = NTVFS_DISK;
+
/* fill in all the operations */
ops.connect = svfs_connect;
ops.disconnect = svfs_disconnect;
@@ -844,12 +847,11 @@ BOOL posix_vfs_init(void)
/* register ourselves with the NTVFS subsystem. We register under the name 'default'
as we wish to be the default backend */
- ret = ntvfs_register("simple", NTVFS_DISK, &ops);
+ ret = register_backend("ntvfs", &ops);
- if (!ret) {
+ if (!NT_STATUS_IS_OK(ret)) {
DEBUG(0,("Failed to register POSIX backend!\n"));
- return False;
}
- return True;
+ return ret;
}