From 11db21cc1c00d63c6b23ec6b3a3bdb48728b2b64 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 27 Mar 2003 12:08:46 +0000 Subject: Use the new modules system in VFS. If a module can't be loaded with the new modules system, we still fall back to the old system. (This used to be commit cebe8d8b424f10006f2f791a8f086c6c8a7f5d57) --- source3/modules/vfs_audit.c | 14 ++++++-------- source3/modules/vfs_extd_audit.c | 15 ++++++--------- source3/modules/vfs_fake_perms.c | 8 +++----- source3/modules/vfs_netatalk.c | 8 +++----- source3/modules/vfs_recycle.c | 41 ++++++---------------------------------- 5 files changed, 24 insertions(+), 62 deletions(-) (limited to 'source3/modules') diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c index 1944c98e53..fa9bf67a67 100644 --- a/source3/modules/vfs_audit.c +++ b/source3/modules/vfs_audit.c @@ -98,10 +98,9 @@ static vfs_op_tuple audit_ops[] = { /* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, +static vfs_op_tuple *audit_init(const struct vfs_ops *def_vfs_ops, struct smb_vfs_handle_struct *vfs_handle) { - *vfs_version = SMB_VFS_INTERFACE_VERSION; memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); audit_handle = vfs_handle; @@ -111,12 +110,6 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, return audit_ops; } -/* VFS finalization function. */ -void vfs_done(connection_struct *conn) -{ - syslog(SYSLOG_PRIORITY, "VFS_DONE: vfs module unloaded\n"); -} - /* Implementation of vfs_ops. Pass everything on to the default operation but log event first. */ @@ -276,3 +269,8 @@ static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode) return result; } + +int vfs_audit_init(void) +{ + return smb_register_vfs("audit", audit_init, SMB_VFS_INTERFACE_VERSION); +} diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c index c75dc1d09c..f60acab36a 100644 --- a/source3/modules/vfs_extd_audit.c +++ b/source3/modules/vfs_extd_audit.c @@ -99,10 +99,9 @@ static vfs_op_tuple audit_ops[] = { /* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, +static vfs_op_tuple *audit_init(const struct vfs_ops *def_vfs_ops, struct smb_vfs_handle_struct *vfs_handle) { - *vfs_version = SMB_VFS_INTERFACE_VERSION; memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); audit_handle = vfs_handle; @@ -113,13 +112,6 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, return audit_ops; } -/* VFS finalization function. */ - -void vfs_done(connection_struct *conn) -{ - syslog(SYSLOG_PRIORITY, "VFS_DONE: vfs module unloaded\n"); -} - /* Implementation of vfs_ops. Pass everything on to the default operation but log event first. */ @@ -317,3 +309,8 @@ static int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode) return result; } + +int vfs_extd_audit_init(void) +{ + return smb_register_vfs("extd_audit", audit_init, SMB_VFS_INTERFACE_VERSION); +} diff --git a/source3/modules/vfs_fake_perms.c b/source3/modules/vfs_fake_perms.c index 85515df21a..121a99a451 100644 --- a/source3/modules/vfs_fake_perms.c +++ b/source3/modules/vfs_fake_perms.c @@ -267,12 +267,11 @@ static vfs_op_tuple fake_perms_ops[] = { /* VFS initialisation - return initialized vfs_op_tuple array back to Samba */ -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, +static vfs_op_tuple *fake_perms_init(const struct vfs_ops *def_vfs_ops, struct smb_vfs_handle_struct *vfs_handle) { DEBUG(3, ("Initialising default vfs hooks\n")); - *vfs_version = SMB_VFS_INTERFACE_VERSION; memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); /* Remember vfs_handle for further allocation and referencing of private @@ -282,8 +281,7 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, return fake_perms_ops; } -/* VFS finalization function */ -void vfs_done(connection_struct *conn) +int vfs_fake_perms_init(void) { - DEBUG(3, ("Finalizing default vfs hooks\n")); + return smb_register_vfs("fake_perms", fake_perms_init, SMB_VFS_INTERFACE_VERSION); } diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c index b69a900e14..c9e3cde621 100644 --- a/source3/modules/vfs_netatalk.c +++ b/source3/modules/vfs_netatalk.c @@ -410,10 +410,9 @@ static vfs_op_tuple atalk_ops[] = { }; /* VFS initialisation function. Return vfs_op_tuple array back to SAMBA. */ -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, +static vfs_op_tuple *netatalk_init(const struct vfs_ops *def_vfs_ops, struct smb_vfs_handle_struct *vfs_handle) { - *vfs_version = SMB_VFS_INTERFACE_VERSION; memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); atalk_handle = vfs_handle; @@ -422,8 +421,7 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, return atalk_ops; } -/* VFS finalization function. */ -void vfs_done(connection_struct *conn) +int vfs_netatalk_init(void) { - DEBUG(3, ("ATALK: vfs module unloaded\n")); + return smb_register_vfs("netatalk", netatalk_init, SMB_VFS_INTERFACE_VERSION); } diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c index ba453bad2c..a669d864c6 100644 --- a/source3/modules/vfs_recycle.c +++ b/source3/modules/vfs_recycle.c @@ -87,13 +87,12 @@ static vfs_op_tuple recycle_ops[] = { * * @retval initialised vfs_op_tuple array **/ -vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, +static vfs_op_tuple *recycle_init(const struct vfs_ops *def_vfs_ops, struct smb_vfs_handle_struct *vfs_handle) { TALLOC_CTX *mem_ctx = NULL; DEBUG(10, ("Initializing VFS module recycle\n")); - *vfs_version = SMB_VFS_INTERFACE_VERSION; memcpy(&default_vfs_ops, def_vfs_ops, sizeof(struct vfs_ops)); vfs_recycle_debug_level = debug_add_class("vfs_recycle_bin"); if (vfs_recycle_debug_level == -1) { @@ -120,39 +119,6 @@ vfs_op_tuple *vfs_init(int *vfs_version, struct vfs_ops *def_vfs_ops, return recycle_ops; } -/** - * VFS finalization function. - * - **/ -void vfs_done(void) -{ - recycle_bin_private_data *recdata; - recycle_bin_connections *recconn; - - DEBUG(10, ("Unloading/Cleaning VFS module recycle bin\n")); - - if (recycle_bin_private_handle) - recdata = (recycle_bin_private_data *)(recycle_bin_private_handle->data); - else { - DEBUG(0, ("Recycle bin not initialized!\n")); - return; - } - - if (recdata) { - if (recdata->conns) { - recconn = recdata->conns; - while (recconn) { - talloc_destroy(recconn->data->mem_ctx); - recconn = recconn->next; - } - } - if (recdata->mem_ctx) { - talloc_destroy(recdata->mem_ctx); - } - recdata = NULL; - } -} - static int recycle_connect(struct connection_struct *conn, const char *service, const char *user) { TALLOC_CTX *ctx = NULL; @@ -646,3 +612,8 @@ done: SAFE_FREE(final_name); return rc; } + +int vfs_recycle_init(void) +{ + return smb_register_vfs("recycle", recycle_init, SMB_VFS_INTERFACE_VERSION); +} -- cgit