From 81256ecbb977351b4d6a992df17be4b107071935 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 28 Apr 2003 18:33:25 +0000 Subject: Use NTSTATUS as return value for smb_register_*() functions and init_module() function. Patch by metze with some minor modifications. (This used to be commit f4576757d1d52a8f1b96894c869bb76450003fd1) --- source3/smbd/vfs.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 75bcb09917..e33a8ccbe7 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -153,29 +153,30 @@ static struct vfs_init_function_entry *vfs_find_backend_entry(const char *name) return NULL; } -BOOL smb_register_vfs(const char *name, vfs_op_tuple *(*init)(const struct vfs_ops *, struct smb_vfs_handle_struct *), int version) +NTSTATUS smb_register_vfs(uint16 version, const char *name, vfs_op_tuple *(*init)(const struct vfs_ops *, struct smb_vfs_handle_struct *)) { struct vfs_init_function_entry *entry = backends; - + if ((version < SMB_VFS_INTERFACE_CASCADED)) { DEBUG(0, ("vfs_init() returned wrong interface version info (was %d, should be no less than %d)\n", version, SMB_VFS_INTERFACE_VERSION )); - return False; + return NT_STATUS_OBJECT_TYPE_MISMATCH; } if ((version < SMB_VFS_INTERFACE_VERSION)) { DEBUG(0, ("Warning: vfs_init() states that module confirms interface version #%d, current interface version is #%d.\n\ Proceeding in compatibility mode, new operations (since version #%d) will fallback to default ones.\n", version, SMB_VFS_INTERFACE_VERSION, version )); - return False; + return NT_STATUS_OBJECT_TYPE_MISMATCH; + } + + if (!name || !init) { + return NT_STATUS_INVALID_PARAMETER; } - while(entry) { - if (strequal(entry->name, name)) { + if (vfs_find_backend_entry(name)) { DEBUG(0,("VFS module %s already loaded!\n", name)); - return False; - } - entry = entry->next; + return NT_STATUS_OBJECT_NAME_COLLISION; } entry = smb_xmalloc(sizeof(struct vfs_init_function_entry)); @@ -184,7 +185,7 @@ BOOL smb_register_vfs(const char *name, vfs_op_tuple *(*init)(const struct vfs_o DLIST_ADD(backends, entry); DEBUG(5, ("Successfully added vfs backend '%s'\n", name)); - return True; + return NT_STATUS_OK; } /**************************************************************************** @@ -267,7 +268,7 @@ BOOL vfs_init_custom(connection_struct *conn, const char *vfs_object) /* First, try to load the module with the new module system */ if((entry = vfs_find_backend_entry(vfs_object)) || - (smb_probe_module("vfs", vfs_object) && + (NT_STATUS_IS_OK(smb_probe_module("vfs", vfs_object)) && (entry = vfs_find_backend_entry(vfs_object)))) { DEBUG(3,("Successfully loaded %s with the new modules system\n", vfs_object)); -- cgit