Skip to content

Commit

Permalink
Retire spl_module_init()/spl_module_fini()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Issue openzfs/zfs#2985
  • Loading branch information
behlendorf committed Feb 27, 2015
1 parent 086476f commit c1bc8e6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 95 deletions.
1 change: 0 additions & 1 deletion include/linux/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ KERNEL_H = \
$(top_srcdir)/include/linux/list_compat.h \
$(top_srcdir)/include/linux/math64_compat.h \
$(top_srcdir)/include/linux/mm_compat.h \
$(top_srcdir)/include/linux/module_compat.h \
$(top_srcdir)/include/linux/proc_compat.h \
$(top_srcdir)/include/linux/rwsem_compat.h \
$(top_srcdir)/include/linux/wait_compat.h \
Expand Down
59 changes: 0 additions & 59 deletions include/linux/module_compat.h

This file was deleted.

32 changes: 4 additions & 28 deletions module/spl/spl-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,8 @@ spl_kvmem_fini(void)
spl_kmem_fini();
}

static int
__init spl_init(void)
static int __init
spl_init(void)
{
int rc = 0;

Expand Down Expand Up @@ -575,10 +575,10 @@ __init spl_init(void)
"v%s-%s%s, rc = %d\n", SPL_META_VERSION, SPL_META_RELEASE,
SPL_DEBUG_STR, rc);

return rc;
return (rc);
}

static void
static void __exit
spl_fini(void)
{
printk(KERN_NOTICE "SPL: Unloaded module v%s-%s%s\n",
Expand All @@ -594,30 +594,6 @@ spl_fini(void)
spl_kvmem_fini();
}

/* Called when a dependent module is loaded */
void
spl_setup(void)
{
int rc;

/*
* At module load time the pwd is set to '/' on a Solaris system.
* On a Linux system will be set to whatever directory the caller
* was in when executing insmod/modprobe.
*/
rc = vn_set_pwd("/");
if (rc)
printk("SPL: Warning unable to set pwd to '/': %d\n", rc);
}
EXPORT_SYMBOL(spl_setup);

/* Called when a dependent module is unloaded */
void
spl_cleanup(void)
{
}
EXPORT_SYMBOL(spl_cleanup);

module_init(spl_init);
module_exit(spl_fini);

Expand Down
11 changes: 4 additions & 7 deletions module/splat/splat-ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/module_compat.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/vmalloc.h>
Expand Down Expand Up @@ -600,7 +599,7 @@ static struct miscdevice splat_misc = {
.fops = &splat_fops,
};

static int
static int __init
splat_init(void)
{
int error;
Expand Down Expand Up @@ -636,7 +635,7 @@ splat_init(void)
return (error);
}

static int
static void __exit
splat_fini(void)
{
int error;
Expand Down Expand Up @@ -665,12 +664,10 @@ splat_fini(void)
ASSERT(list_empty(&splat_module_list));
printk(KERN_INFO "SPLAT: Unloaded module v%s-%s%s\n",
SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR);

return (0);
}

spl_module_init(splat_init);
spl_module_exit(splat_fini);
module_init(splat_init);
module_exit(splat_fini);

MODULE_DESCRIPTION("Solaris Porting LAyer Tests");
MODULE_AUTHOR(SPL_META_AUTHOR);
Expand Down

0 comments on commit c1bc8e6

Please sign in to comment.