From b4f3666a16a61aa2ac7dca0b199e7ce51edbcd60 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 18 Feb 2015 15:39:05 -0800 Subject: [PATCH] Retire spl_module_init()/spl_module_fini() In the original implementation of the SPL wrappers were provided for module initialization and cleanup. This was done to abstract away any compatibility code which might be needed for the SPL. As it turned out the only significant compatibility issue was that the default pwd during module load differed under Illumos and Linux. Since this is such as minor thing and the wrappers complicate the code they are being retired. Signed-off-by: Brian Behlendorf Closes #2985 --- module/avl/avl.c | 16 +++++++++++----- module/nvpair/nvpair.c | 16 +++++++++++----- module/unicode/u8_textprep.c | 15 ++++++++++----- module/zcommon/zfs_prop.c | 16 +++++++++++----- module/zfs/zfs_ioctl.c | 18 +++++++++++------- module/zpios/pios.c | 11 ++++------- 6 files changed, 58 insertions(+), 34 deletions(-) diff --git a/module/avl/avl.c b/module/avl/avl.c index 5c2b722e66..f9971da20a 100644 --- a/module/avl/avl.c +++ b/module/avl/avl.c @@ -1030,13 +1030,19 @@ done: } #if defined(_KERNEL) && defined(HAVE_SPL) -#include +static int __init +avl_init(void) +{ + return (0); +} -static int avl_init(void) { return 0; } -static int avl_fini(void) { return 0; } +static void __exit +avl_fini(void) +{ +} -spl_module_init(avl_init); -spl_module_exit(avl_fini); +module_init(avl_init); +module_exit(avl_fini); MODULE_DESCRIPTION("Generic AVL tree implementation"); MODULE_AUTHOR(ZFS_META_AUTHOR); diff --git a/module/nvpair/nvpair.c b/module/nvpair/nvpair.c index 9fd486bca7..1eca0feea7 100644 --- a/module/nvpair/nvpair.c +++ b/module/nvpair/nvpair.c @@ -3293,13 +3293,19 @@ nvs_xdr(nvstream_t *nvs, nvlist_t *nvl, char *buf, size_t *buflen) } #if defined(_KERNEL) && defined(HAVE_SPL) -#include +static int __init +nvpair_init(void) +{ + return (0); +} -static int nvpair_init(void) { return 0; } -static int nvpair_fini(void) { return 0; } +static void __exit +nvpair_fini(void) +{ +} -spl_module_init(nvpair_init); -spl_module_exit(nvpair_fini); +module_init(nvpair_init); +module_exit(nvpair_fini); MODULE_DESCRIPTION("Generic name/value pair implementation"); MODULE_AUTHOR(ZFS_META_AUTHOR); diff --git a/module/unicode/u8_textprep.c b/module/unicode/u8_textprep.c index f5ab779516..26cc39f3bc 100644 --- a/module/unicode/u8_textprep.c +++ b/module/unicode/u8_textprep.c @@ -2133,13 +2133,18 @@ u8_textprep_str(char *inarray, size_t *inlen, char *outarray, size_t *outlen, } #if defined(_KERNEL) && defined(HAVE_SPL) -#include +static int __init +unicode_init(void) { + return (0); +} -static int unicode_init(void) { return 0; } -static int unicode_fini(void) { return 0; } +static void __exit +unicode_fini(void) +{ +} -spl_module_init(unicode_init); -spl_module_exit(unicode_fini); +module_init(unicode_init); +module_exit(unicode_fini); MODULE_DESCRIPTION("Unicode implementation"); MODULE_AUTHOR(ZFS_META_AUTHOR); diff --git a/module/zcommon/zfs_prop.c b/module/zcommon/zfs_prop.c index 18b5f951ee..192f8f2210 100644 --- a/module/zcommon/zfs_prop.c +++ b/module/zcommon/zfs_prop.c @@ -678,13 +678,19 @@ zfs_prop_align_right(zfs_prop_t prop) #endif #if defined(_KERNEL) && defined(HAVE_SPL) -#include +static int __init +zcommon_init(void) +{ + return (0); +} -static int zcommon_init(void) { return 0; } -static int zcommon_fini(void) { return 0; } +static void __exit +zcommon_fini(void) +{ +} -spl_module_init(zcommon_init); -spl_module_exit(zcommon_fini); +module_init(zcommon_init); +module_exit(zcommon_fini); MODULE_DESCRIPTION("Generic ZFS support"); MODULE_AUTHOR(ZFS_META_AUTHOR); diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index 171e08c7aa..998ee15962 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -186,7 +186,6 @@ #include #include -#include #include "zfs_namecheck.h" #include "zfs_prop.h" @@ -5954,11 +5953,18 @@ zfs_allow_log_destroy(void *arg) #define ZFS_DEBUG_STR "" #endif -int +static int __init _init(void) { int error; + error = vn_set_pwd("/"); + if (error) { + printk(KERN_NOTICE + "ZFS: Warning unable to set pwd to '/': %d\n", error); + return (error); + } + spa_init(FREAD | FWRITE); zfs_init(); @@ -5996,7 +6002,7 @@ out1: return (error); } -int +static void __exit _fini(void) { zfs_detach(); @@ -6010,13 +6016,11 @@ _fini(void) printk(KERN_NOTICE "ZFS: Unloaded module v%s-%s%s\n", ZFS_META_VERSION, ZFS_META_RELEASE, ZFS_DEBUG_STR); - - return (0); } #ifdef HAVE_SPL -spl_module_init(_init); -spl_module_exit(_fini); +module_init(_init); +module_exit(_fini); MODULE_DESCRIPTION("ZFS"); MODULE_AUTHOR(ZFS_META_AUTHOR); diff --git a/module/zpios/pios.c b/module/zpios/pios.c index fb15046bee..8e5077da51 100644 --- a/module/zpios/pios.c +++ b/module/zpios/pios.c @@ -36,7 +36,6 @@ #include #include #include -#include #include "zpios-internal.h" @@ -1292,7 +1291,7 @@ static struct miscdevice zpios_misc = { #define ZFS_DEBUG_STR "" #endif -static int +static int __init zpios_init(void) { int error; @@ -1308,7 +1307,7 @@ zpios_init(void) return (error); } -static int +static void __exit zpios_fini(void) { int error; @@ -1319,12 +1318,10 @@ zpios_fini(void) printk(KERN_INFO "ZPIOS: Unloaded module v%s-%s%s\n", ZFS_META_VERSION, ZFS_META_RELEASE, ZFS_DEBUG_STR); - - return (0); } -spl_module_init(zpios_init); -spl_module_exit(zpios_fini); +module_init(zpios_init); +module_exit(zpios_fini); MODULE_AUTHOR("LLNL / Sun"); MODULE_DESCRIPTION("Kernel PIOS implementation");