mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Set cwd to '/' for the process executing insmod.
Ricardo has pointed out that under Solaris the cwd is set to '/'
during module load, while under Linux it is set to the callers cwd.
To handle this cleanly I've reworked the module *_init()/_exit()
macros so they call a *_setup()/_cleanup() function when any SPL
dependent module is loaded or unloaded. This gives us a chance to
perform any needed modification of the process, in this case changing
the cwd. It also handily provides a way to avoid creating wrapper
init()/exit() functions because the Solaris and Linux prototypes
differ slightly. All dependent modules should now call the spl
helper macros spl_module_{init,exit}() instead of the native linux
versions.
Unfortunately, it appears that under Linux there has been no consistent
API in the kernel to set the cwd in a module. Because of this I have
had to add more autoconf magic than I'd like. However, what I have
done is correct and has been tested on RHEL5, SLES11, FC11, and CHAOS
kernels.
In addition, I have change the rootdir type from a 'void *' to the
correct 'vnode_t *' type. And I've set rootdir to a non-NULL value.
This commit is contained in:
@@ -608,7 +608,7 @@ static struct cdev splat_cdev = {
|
||||
.kobj = { .name = SPLAT_NAME, },
|
||||
};
|
||||
|
||||
static int __init
|
||||
static int
|
||||
splat_init(void)
|
||||
{
|
||||
dev_t dev;
|
||||
@@ -667,7 +667,7 @@ error:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
splat_fini(void)
|
||||
{
|
||||
dev_t dev = MKDEV(SPLAT_MAJOR, 0);
|
||||
@@ -695,10 +695,12 @@ splat_fini(void)
|
||||
ASSERT(list_empty(&splat_module_list));
|
||||
printk(KERN_INFO "SPLAT: Unloaded Solaris Porting LAyer "
|
||||
"Tests v%s\n", SPL_META_VERSION);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_init(splat_init);
|
||||
module_exit(splat_fini);
|
||||
spl_module_init(splat_init);
|
||||
spl_module_exit(splat_fini);
|
||||
|
||||
MODULE_AUTHOR("Lawrence Livermore National Labs");
|
||||
MODULE_DESCRIPTION("Solaris Porting LAyer Tests");
|
||||
|
||||
Reference in New Issue
Block a user