]> git.proxmox.com Git - mirror_spl-debian.git/commit - module/spl/spl-generic.c
Set cwd to '/' for the process executing insmod.
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 1 Oct 2009 23:06:15 +0000 (16:06 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 1 Oct 2009 23:06:15 +0000 (16:06 -0700)
commit51a727e90f1dd11194737e64e85ca09d34be5d8b
tree06a0b78065a317c9e8f9536e28189b3032cfccf0
parent0e77fc118e2c105af0df5d1c7aa6627ed601bfa1
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.
config/spl-build.m4
configure
include/linux/module_compat.h [new file with mode: 0644]
include/sys/sysmacros.h
include/sys/types.h
include/sys/vnode.h
module/spl/spl-generic.c
module/spl/spl-vnode.c
module/splat/splat-ctl.c
spl_config.h.in