Merge branch 'builtin-clean'

Support in-tree builtin module building.

These commits add support for compiling the SPL module as a built-in
kernel module by copying the module code into the kernel source tree.
Here's the procedure:

  - Create your kernel configuration (`.config` file) as usual. This
    has to be done first so that SPL's configure script is able to
    detect kernel features correctly.
  - Run `make prepare scripts` inside the kernel source tree.
  - Run `./configure --enable-linux-builtin --with-linux=/usr/src/linux-...`
    inside the SPL directory.
  - Run `./copy-builtin /usr/src/linux-...` inside the SPL directory.
  - In the kernel source tree, enable the `CONFIG_SPL` option
    (e.g. using `make menuconfig`).
  - Build the kernel as usual.

SPL module parameters can be set at boot time using the following syntax
on the kernel command line: `spl.parameter_name=parameter_value`.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue zfsonlinux/zfs#851
This commit is contained in:
Brian Behlendorf 2012-07-26 15:30:47 -07:00
commit 744038069d
15 changed files with 4985 additions and 1403 deletions

View File

@ -845,20 +845,18 @@ uninstall-am:
srpm-modules:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common
@CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common
srpm-utils:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common
@CONFIG_USER_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common
srpm: srpm-modules srpm-utils
rpm-modules: srpm-modules
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
@CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
rpm-utils: srpm-utils
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
rpm-modules: srpm-modules
@CONFIG_USER_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
rpm: rpm-modules rpm-utils
@ -936,22 +934,22 @@ deb-local:
fi)
deb-modules: deb-local rpm-modules
name=${PACKAGE}-modules; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \
$(RM) $$pkg1 $$pkg2
@CONFIG_KERNEL_TRUE@ name=${PACKAGE}-modules; \
@CONFIG_KERNEL_TRUE@ version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
@CONFIG_KERNEL_TRUE@ release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
@CONFIG_KERNEL_TRUE@ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
@CONFIG_KERNEL_TRUE@ pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
@CONFIG_KERNEL_TRUE@ pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
@CONFIG_KERNEL_TRUE@ fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \
@CONFIG_KERNEL_TRUE@ $(RM) $$pkg1 $$pkg2
deb-utils: deb-local rpm-utils
name=${PACKAGE}; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
pkg1=$${name}-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \
$(RM) $$pkg1
@CONFIG_USER_TRUE@ name=${PACKAGE}; \
@CONFIG_USER_TRUE@ version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
@CONFIG_USER_TRUE@ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
@CONFIG_USER_TRUE@ pkg1=$${name}-$${version}.$${arch}.rpm; \
@CONFIG_USER_TRUE@ fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \
@CONFIG_USER_TRUE@ $(RM) $$pkg1
deb: deb-modules deb-utils
@ -965,22 +963,22 @@ tgz-local:
fi)
tgz-modules: tgz-local rpm-modules
name=${PACKAGE}-modules; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \
$(RM) $$pkg1 $$pkg2
@CONFIG_KERNEL_TRUE@ name=${PACKAGE}-modules; \
@CONFIG_KERNEL_TRUE@ version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
@CONFIG_KERNEL_TRUE@ release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
@CONFIG_KERNEL_TRUE@ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
@CONFIG_KERNEL_TRUE@ pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \
@CONFIG_KERNEL_TRUE@ pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
@CONFIG_KERNEL_TRUE@ fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \
@CONFIG_KERNEL_TRUE@ $(RM) $$pkg1 $$pkg2
tgz-utils: tgz-local rpm-utils
name=${PACKAGE}; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
pkg1=$${name}-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1; \
$(RM) $$pkg1
@CONFIG_USER_TRUE@ name=${PACKAGE}; \
@CONFIG_USER_TRUE@ version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
@CONFIG_USER_TRUE@ arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
@CONFIG_USER_TRUE@ pkg1=$${name}-$${version}.$${arch}.rpm; \
@CONFIG_USER_TRUE@ fakeroot $(ALIEN) --scripts --to-tgz $$pkg1; \
@CONFIG_USER_TRUE@ $(RM) $$pkg1
tgz: tgz-modules tgz-utils
@ -993,10 +991,10 @@ sarch-utils:
sarch: sarch-modules sarch-utils
arch-modules:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" arch-common
@CONFIG_KERNEL_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" arch-common
arch-utils:
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" arch-common
@CONFIG_USER_TRUE@ $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" arch-common
arch: arch-modules arch-utils

View File

@ -11,5 +11,11 @@ To build packages for your distribution:
$ ./configure
$ make pkg
To copy the kernel code inside your kernel source tree for builtin
compilation:
$ ./configure --enable-linux-builtin --with-linux=/usr/src/linux-...
$ ./copy-builtin /usr/src/linux-...
Full documentation for building, configuring, and using the SPL can
be found at: <http://zfsonlinux.org>

View File

@ -13,10 +13,14 @@ sarch-utils:
sarch: sarch-modules sarch-utils
arch-modules:
if CONFIG_KERNEL
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" arch-common
endif
arch-utils:
if CONFIG_USER
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" arch-common
endif
arch: arch-modules arch-utils

View File

@ -29,6 +29,7 @@ deb-local:
fi)
deb-modules: deb-local rpm-modules
if CONFIG_KERNEL
name=${PACKAGE}-modules; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
@ -37,13 +38,16 @@ deb-modules: deb-local rpm-modules
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \
$(RM) $$pkg1 $$pkg2
endif
deb-utils: deb-local rpm-utils
if CONFIG_USER
name=${PACKAGE}; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
pkg1=$${name}-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-deb $$pkg1; \
$(RM) $$pkg1
endif
deb: deb-modules deb-utils

View File

@ -7,20 +7,26 @@
###############################################################################
srpm-modules:
if CONFIG_KERNEL
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" srpm-common
endif
srpm-utils:
if CONFIG_USER
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" srpm-common
endif
srpm: srpm-modules srpm-utils
rpm-modules: srpm-modules
if CONFIG_KERNEL
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-modules" rpm-common
endif
rpm-utils: srpm-utils
if CONFIG_USER
$(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" rpm-common
rpm-modules: srpm-modules
endif
rpm: rpm-modules rpm-utils

View File

@ -22,6 +22,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_DEBUG_LOG
SPL_AC_DEBUG_KMEM
SPL_AC_DEBUG_KMEM_TRACKING
SPL_AC_TEST_MODULE
SPL_AC_ATOMIC_SPINLOCK
SPL_AC_TYPE_ATOMIC64_CMPXCHG
SPL_AC_TYPE_ATOMIC64_XCHG
@ -94,7 +95,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
modpost=$LINUX/scripts/Makefile.modpost
AC_MSG_CHECKING([kernel file name for module symbols])
if test -f "$modpost"; then
if test "x$enable_linux_builtin" != xyes -a -f "$modpost"; then
if grep -q Modules.symvers $modpost; then
LINUX_SYMBOLS=Modules.symvers
else
@ -136,7 +137,7 @@ AC_DEFUN([SPL_AC_KERNEL], [
sourcelink=$(readlink -f "$headersdir")
else
sourcelink=$(ls -1d /usr/src/kernels/* \
/usr/src/linux-* \
/usr/src/linux-* \
2>/dev/null | grep -v obj | tail -1)
fi
@ -196,7 +197,13 @@ AC_DEFUN([SPL_AC_KERNEL], [
fi
else
AC_MSG_RESULT([Not found])
AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
if test "x$enable_linux_builtin" != xyes; then
AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
else
AC_MSG_ERROR([
*** Cannot find UTS_RELEASE definition.
*** Please run 'make prepare' inside the kernel source tree.])
fi
fi
AC_MSG_RESULT([$kernsrcver])
@ -439,34 +446,38 @@ AC_DEFUN([SPL_AC_LICENSE], [
])
AC_DEFUN([SPL_AC_CONFIG], [
SPL_CONFIG=all
AC_ARG_WITH([config],
AS_HELP_STRING([--with-config=CONFIG],
[Config file 'kernel|user|all|srpm']),
[SPL_CONFIG="$withval"])
SPL_CONFIG=all
AC_ARG_WITH([config],
AS_HELP_STRING([--with-config=CONFIG],
[Config file 'kernel|user|all|srpm']),
[SPL_CONFIG="$withval"])
AC_ARG_ENABLE([linux-builtin],
[AC_HELP_STRING([--enable-linux-builtin],
[Configure for builtin in-tree kernel modules @<:@default=no@:>@])],
[],
[enable_linux_builtin=no])
AC_MSG_CHECKING([spl config])
AC_MSG_RESULT([$SPL_CONFIG]);
AC_SUBST(SPL_CONFIG)
AC_MSG_CHECKING([spl config])
AC_MSG_RESULT([$SPL_CONFIG]);
AC_SUBST(SPL_CONFIG)
case "$SPL_CONFIG" in
kernel) SPL_AC_CONFIG_KERNEL ;;
user) SPL_AC_CONFIG_USER ;;
all) SPL_AC_CONFIG_KERNEL
SPL_AC_CONFIG_USER ;;
case "$SPL_CONFIG" in
kernel) SPL_AC_CONFIG_KERNEL ;;
user) SPL_AC_CONFIG_USER ;;
all) SPL_AC_CONFIG_KERNEL
SPL_AC_CONFIG_USER ;;
srpm) ;;
*)
AC_MSG_RESULT([Error!])
AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
user kernel|user|all|srpm]) ;;
esac
*)
AC_MSG_RESULT([Error!])
AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
user kernel|user|all|srpm]) ;;
esac
AM_CONDITIONAL([CONFIG_USER],
[test "$SPL_CONFIG" = user] ||
[test "$SPL_CONFIG" = all])
AM_CONDITIONAL([CONFIG_KERNEL],
[test "$SPL_CONFIG" = kernel] ||
[test "$SPL_CONFIG" = all])
AM_CONDITIONAL([CONFIG_USER],
[test "$SPL_CONFIG" = user -o "$SPL_CONFIG" = all])
AM_CONDITIONAL([CONFIG_KERNEL],
[test "$SPL_CONFIG" = kernel -o "$SPL_CONFIG" = all] &&
[test "x$enable_linux_builtin" != xyes ])
])
dnl #
@ -620,12 +631,14 @@ dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
dnl #
AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
rm -Rf build && mkdir -p build
rm -Rf build && mkdir -p build && touch build/conftest.mod.c
echo "obj-m := conftest.o" >build/Makefile
modpost_flag=''
test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
AS_IF(
[AC_TRY_COMMAND(cp conftest.c build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
[$4],
[_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
[AC_TRY_COMMAND(cp conftest.c build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])],
[$4],
[_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
)
rm -Rf build
])
@ -665,8 +678,7 @@ dnl #
dnl # SPL_CHECK_SYMBOL_EXPORT
dnl # check symbol exported or not
dnl #
AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
[AC_MSG_CHECKING([whether symbol $1 is exported])
AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT], [
grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
$LINUX_OBJ/Module*.symvers 2>/dev/null
rc=$?
@ -676,24 +688,42 @@ AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
grep -q -E "EXPORT_SYMBOL.*($1)" \
"$LINUX_OBJ/$file" 2>/dev/null
rc=$?
if test $rc -eq 0; then
export=1
break;
fi
if test $rc -eq 0; then
export=1
break;
fi
done
if test $export -eq 0; then
AC_MSG_RESULT([no])
if test $export -eq 0; then :
$4
else
AC_MSG_RESULT([yes])
else :
$3
fi
else
AC_MSG_RESULT([yes])
else :
$3
fi
])
dnl #
dnl # SPL_LINUX_TRY_COMPILE_SYMBOL
dnl # like SPL_LINUX_TRY_COMPILE, except SPL_CHECK_SYMBOL_EXPORT
dnl # is called if not compiling for builtin
dnl #
AC_DEFUN([SPL_LINUX_TRY_COMPILE_SYMBOL], [
SPL_LINUX_TRY_COMPILE([$1], [$2], [rc=0], [rc=1])
if test $rc -ne 0; then :
$6
else
if test "x$enable_linux_builtin" != xyes; then
SPL_CHECK_SYMBOL_EXPORT([$3], [$4], [rc=0], [rc=1])
fi
if test $rc -ne 0; then :
$6
else :
$5
fi
fi
])
dnl #
dnl # SPL_CHECK_SYMBOL_HEADER
dnl # check if a symbol prototype is defined in listed headers.
@ -704,10 +734,10 @@ AC_DEFUN([SPL_CHECK_SYMBOL_HEADER], [
for file in $3; do
grep -q "$2" "$LINUX/$file" 2>/dev/null
rc=$?
if test $rc -eq 0; then
header=1
break;
fi
if test $rc -eq 0; then
header=1
break;
fi
done
if test $header -eq 0; then
AC_MSG_RESULT([no])
@ -738,6 +768,25 @@ AC_DEFUN([SPL_CHECK_HEADER],
])
])
dnl #
dnl # Basic toolchain sanity check.
dnl #
AC_DEFUN([SPL_AC_TEST_MODULE],
[AC_MSG_CHECKING([whether modules can be built])
SPL_LINUX_TRY_COMPILE([],[],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
if test "x$enable_linux_builtin" != xyes; then
AC_MSG_ERROR([*** Unable to build an empty module.])
else
AC_MSG_ERROR([
*** Unable to build an empty module.
*** Please run 'make scripts' inside the kernel source tree.])
fi
])
])
dnl #
dnl # Use the atomic implemenation based on global spinlocks. This
dnl # should only be needed by 32-bit kernels which do not provide
@ -959,10 +1008,18 @@ AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
dnl #
dnl # Custom SPL patch may export this system it is not required
dnl #
AC_DEFUN([SPL_AC_TASK_CURR], [
SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c],
[AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])],
[])
AC_DEFUN([SPL_AC_TASK_CURR],
[AC_MSG_CHECKING([whether task_curr() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/sched.h>
], [
task_curr(NULL);
], [task_curr], [kernel/sched.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1028,13 +1085,15 @@ dnl # 2.6.18 API change, check whether device_create() is available.
dnl # Device_create() was introduced in 2.6.18 and depricated
dnl # class_device_create() which was fully removed in 2.6.26.
dnl #
AC_DEFUN([SPL_AC_DEVICE_CREATE], [
SPL_CHECK_SYMBOL_EXPORT(
[device_create],
[drivers/base/core.c],
[AC_DEFINE(HAVE_DEVICE_CREATE, 1,
[device_create() is available])],
[])
AC_DEFUN([SPL_AC_DEVICE_CREATE],
[AC_MSG_CHECKING([whether device_create() is available])
SPL_CHECK_SYMBOL_EXPORT([device_create], [drivers/base/core.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DEVICE_CREATE, 1,
[device_create() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1064,25 +1123,37 @@ dnl # 2.6.13 API change, check whether class_device_create() is available.
dnl # Class_device_create() was introduced in 2.6.13 and depricated
dnl # class_simple_device_add() which was fully removed in 2.6.13.
dnl #
AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
SPL_CHECK_SYMBOL_EXPORT(
[class_device_create],
[drivers/base/class.c],
[AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
[class_device_create() is available])],
[])
AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE],
[AC_MSG_CHECKING([whether class_device_create() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/device.h>
], [
class_device_create(NULL, NULL, 0, NULL, NULL);
], [class_device_create], [drivers/base/class.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
[class_device_create() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 2.6.26 API change, set_normalized_timespec() is exported.
dnl #
AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [
SPL_CHECK_SYMBOL_EXPORT(
[set_normalized_timespec],
[kernel/time.c],
[AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
[set_normalized_timespec() is available as export])],
[])
AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT],
[AC_MSG_CHECKING([whether set_normalized_timespec() is available as export])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/time.h>
], [
set_normalized_timespec(NULL, 0, 0);
], [set_normalized_timespec], [kernel/time.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
[set_normalized_timespec() is available as export])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1232,13 +1303,19 @@ dnl # 2.6.9 API change,
dnl # check whether 'monotonic_clock()' is available it may
dnl # be available for some archs but not others.
dnl #
AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
SPL_CHECK_SYMBOL_EXPORT(
[monotonic_clock],
[],
[AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
[monotonic_clock() is available])],
[])
AC_DEFUN([SPL_AC_MONOTONIC_CLOCK],
[AC_MSG_CHECKING([whether monotonic_clock() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/timex.h>
], [
monotonic_clock();
], [monotonic_clock], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
[monotonic_clock() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1352,13 +1429,19 @@ dnl #
dnl # 2.6.18 API change,
dnl # kallsyms_lookup_name no longer exported
dnl #
AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
SPL_CHECK_SYMBOL_EXPORT(
[kallsyms_lookup_name],
[],
[AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
[kallsyms_lookup_name() is available])],
[])
AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME],
[AC_MSG_CHECKING([whether kallsyms_lookup_name() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/kallsyms.h>
], [
kallsyms_lookup_name(NULL);
], [kallsyms_lookup_name], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
[kallsyms_lookup_name() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1368,13 +1451,15 @@ dnl # custom kernel with the *-spl-export-symbols.patch which will export
dnl # these symbols for use. If your already rolling a custom kernel for
dnl # your environment this is recommended.
dnl #
AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
SPL_CHECK_SYMBOL_EXPORT(
[get_vmalloc_info],
[],
[AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
[get_vmalloc_info() is available])],
[])
AC_DEFUN([SPL_AC_GET_VMALLOC_INFO],
[AC_MSG_CHECKING([whether get_vmalloc_info() is available])
SPL_CHECK_SYMBOL_EXPORT([get_vmalloc_info], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
[get_vmalloc_info() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1396,7 +1481,7 @@ AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
rc=$?
if test $rc -eq 0; then
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
else
AC_MSG_RESULT([no])
fi
@ -1409,13 +1494,19 @@ dnl # custom kernel with the *-spl-export-symbols.patch which will export
dnl # these symbols for use. If your already rolling a custom kernel for
dnl # your environment this is recommended.
dnl #
AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
SPL_CHECK_SYMBOL_EXPORT(
[first_online_pgdat],
[],
[AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
[first_online_pgdat() is available])],
[])
AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT],
[AC_MSG_CHECKING([whether first_online_pgdat() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/mmzone.h>
], [
first_online_pgdat();
], [first_online_pgdat], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
[first_online_pgdat() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1425,13 +1516,19 @@ dnl # custom kernel with the *-spl-export-symbols.patch which will export
dnl # these symbols for use. If your already rolling a custom kernel for
dnl # your environment this is recommended.
dnl #
AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
SPL_CHECK_SYMBOL_EXPORT(
[next_online_pgdat],
[],
[AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
[next_online_pgdat() is available])],
[])
AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT],
[AC_MSG_CHECKING([whether next_online_pgdat() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/mmzone.h>
], [
next_online_pgdat(NULL);
], [next_online_pgdat], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
[next_online_pgdat() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1441,26 +1538,35 @@ dnl # custom kernel with the *-spl-export-symbols.patch which will export
dnl # these symbols for use. If your already rolling a custom kernel for
dnl # your environment this is recommended.
dnl #
AC_DEFUN([SPL_AC_NEXT_ZONE], [
SPL_CHECK_SYMBOL_EXPORT(
[next_zone],
[],
[AC_DEFINE(HAVE_NEXT_ZONE, 1,
[next_zone() is available])],
[])
AC_DEFUN([SPL_AC_NEXT_ZONE],
[AC_MSG_CHECKING([whether next_zone() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/mmzone.h>
], [
next_zone(NULL);
], [next_zone], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_NEXT_ZONE, 1, [next_zone() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 2.6.17 API change,
dnl # See SPL_AC_PGDAT_HELPERS for details.
dnl #
AC_DEFUN([SPL_AC_PGDAT_LIST], [
SPL_CHECK_SYMBOL_EXPORT(
[pgdat_list],
[],
[AC_DEFINE(HAVE_PGDAT_LIST, 1,
[pgdat_list is available])],
[])
AC_DEFUN([SPL_AC_PGDAT_LIST],
[AC_MSG_CHECKING([whether pgdat_list is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/topology.h>
pg_data_t *tmp = pgdat_list;
], [], [pgdat_list], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PGDAT_LIST, 1, [pgdat_list is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1652,12 +1758,18 @@ AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
[get_zone_counts() is needed])
SPL_CHECK_SYMBOL_EXPORT(
[get_zone_counts],
[],
[AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
[get_zone_counts() is available])],
[])
AC_MSG_CHECKING([whether get_zone_counts() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/mmzone.h>
], [
get_zone_counts(NULL, NULL, NULL);
], [get_zone_counts], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
[get_zone_counts() is available])
], [
AC_MSG_RESULT(no)
])
])
])
@ -1665,25 +1777,37 @@ dnl #
dnl # 2.6.27 API change,
dnl # The user_path_dir() replaces __user_walk()
dnl #
AC_DEFUN([SPL_AC_USER_PATH_DIR], [
SPL_CHECK_SYMBOL_EXPORT(
[user_path_at],
[],
[AC_DEFINE(HAVE_USER_PATH_DIR, 1,
[user_path_dir() is available])],
[])
AC_DEFUN([SPL_AC_USER_PATH_DIR],
[AC_MSG_CHECKING([whether user_path_dir() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/fcntl.h>
#include <linux/namei.h>
], [
user_path_dir(NULL, NULL);
], [user_path_at], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_USER_PATH_DIR, 1, [user_path_dir() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
dnl # Symbol available in RHEL kernels not in stock kernels.
dnl #
AC_DEFUN([SPL_AC_SET_FS_PWD], [
SPL_CHECK_SYMBOL_EXPORT(
[set_fs_pwd],
[],
[AC_DEFINE(HAVE_SET_FS_PWD, 1,
[set_fs_pwd() is available])],
[])
AC_DEFUN([SPL_AC_SET_FS_PWD],
[AC_MSG_CHECKING([whether set_fs_pwd() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/spinlock.h>
#include <linux/fs_struct.h>
], [
(void) set_fs_pwd;
], [set_fs_pwd], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1791,26 +1915,37 @@ AC_DEFUN([SPL_AC_CRED_STRUCT], [
dnl #
dnl # Custom SPL patch may export this symbol.
dnl #
AC_DEFUN([SPL_AC_GROUPS_SEARCH], [
SPL_CHECK_SYMBOL_EXPORT(
[groups_search],
[],
[AC_DEFINE(HAVE_GROUPS_SEARCH, 1,
[groups_search() is available])],
[])
AC_DEFUN([SPL_AC_GROUPS_SEARCH],
[AC_MSG_CHECKING([whether groups_search() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/cred.h>
], [
groups_search(NULL, 0);
], [groups_search], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GROUPS_SEARCH, 1, [groups_search() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 2.6.x API change,
dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
dnl #
AC_DEFUN([SPL_AC_PUT_TASK_STRUCT], [
SPL_CHECK_SYMBOL_EXPORT(
[__put_task_struct],
[],
[AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
[__put_task_struct() is available])],
[])
AC_DEFUN([SPL_AC_PUT_TASK_STRUCT],
[AC_MSG_CHECKING([whether __put_task_struct() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/sched.h>
], [
__put_task_struct(NULL);
], [__put_task_struct], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
[__put_task_struct() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1836,25 +1971,36 @@ dnl #
dnl # 2.6.x API change,
dnl # kvasprintf() function added.
dnl #
AC_DEFUN([SPL_AC_KVASPRINTF], [
SPL_CHECK_SYMBOL_EXPORT(
[kvasprintf],
[],
[AC_DEFINE(HAVE_KVASPRINTF, 1,
[kvasprintf() is available])],
[])
AC_DEFUN([SPL_AC_KVASPRINTF],
[AC_MSG_CHECKING([whether kvasprintf() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/kernel.h>
], [
kvasprintf(0, NULL, *((va_list*)NULL));
], [kvasprintf], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_KVASPRINTF, 1, [kvasprintf() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 2.6.29 API change,
dnl # vfs_fsync() funcation added, prior to this use file_fsync().
dnl #
AC_DEFUN([SPL_AC_VFS_FSYNC], [
SPL_CHECK_SYMBOL_EXPORT(
[vfs_fsync],
[fs/sync.c],
[AC_DEFINE(HAVE_VFS_FSYNC, 1, [vfs_fsync() is available])],
[])
AC_DEFUN([SPL_AC_VFS_FSYNC],
[AC_MSG_CHECKING([whether vfs_fsync() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/fs.h>
], [
(void) vfs_fsync;
], [vfs_fsync], [fs/sync.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_VFS_FSYNC, 1, [vfs_fsync() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1882,13 +2028,18 @@ dnl # condition. The fixed version is exported as a symbol. The race
dnl # condition is fixed by acquiring sem->wait_lock, so we must not
dnl # call that version while holding sem->wait_lock.
dnl #
AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED], [
SPL_CHECK_SYMBOL_EXPORT(
[rwsem_is_locked],
[lib/rwsem-spinlock.c],
[AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
[rwsem_is_locked() acquires sem->wait_lock])],
[])
AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED],
[AC_MSG_CHECKING([whether rwsem_is_locked() acquires sem->wait_lock])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/rwsem.h>
int rwsem_is_locked(struct rw_semaphore *sem) { return 0; }
], [], [rwsem_is_locked], [lib/rwsem-spinlock.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
[rwsem_is_locked() acquires sem->wait_lock])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1905,18 +2056,31 @@ dnl # of these functions are exported invalidate_inodes() can be
dnl # safely used.
dnl #
AC_DEFUN([SPL_AC_KERNEL_INVALIDATE_INODES], [
SPL_CHECK_SYMBOL_EXPORT(
[invalidate_inodes],
[],
[AC_DEFINE(HAVE_INVALIDATE_INODES, 1,
[invalidate_inodes() is available])],
[])
SPL_CHECK_SYMBOL_EXPORT(
[invalidate_inodes_check],
[],
[AC_DEFINE(HAVE_INVALIDATE_INODES_CHECK, 1,
[invalidate_inodes_check() is available])],
[])
AC_MSG_CHECKING([whether invalidate_inodes() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/fs.h>
], [
invalidate_inodes;
], [invalidate_inodes], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INVALIDATE_INODES, 1,
[invalidate_inodes() is available])
], [
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING([whether invalidate_inodes_check() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/fs.h>
], [
invalidate_inodes_check(NULL, 0);
], [invalidate_inodes_check], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INVALIDATE_INODES_CHECK, 1,
[invalidate_inodes_check() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1955,13 +2119,19 @@ dnl # There currently exists no exposed API to partially shrink the dcache.
dnl # The expected mechanism to shrink the cache is a registered shrinker
dnl # which is called during memory pressure.
dnl #
AC_DEFUN([SPL_AC_SHRINK_DCACHE_MEMORY], [
SPL_CHECK_SYMBOL_EXPORT(
[shrink_dcache_memory],
[fs/dcache.c],
[AC_DEFINE(HAVE_SHRINK_DCACHE_MEMORY, 1,
[shrink_dcache_memory() is available])],
[])
AC_DEFUN([SPL_AC_SHRINK_DCACHE_MEMORY],
[AC_MSG_CHECKING([whether shrink_dcache_memory() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/dcache.h>
], [
shrink_dcache_memory(0, 0);
], [shrink_dcache_memory], [fs/dcache.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SHRINK_DCACHE_MEMORY, 1,
[shrink_dcache_memory() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -1970,13 +2140,19 @@ dnl # There currently exists no exposed API to partially shrink the icache.
dnl # The expected mechanism to shrink the cache is a registered shrinker
dnl # which is called during memory pressure.
dnl #
AC_DEFUN([SPL_AC_SHRINK_ICACHE_MEMORY], [
SPL_CHECK_SYMBOL_EXPORT(
[shrink_icache_memory],
[fs/inode.c],
[AC_DEFINE(HAVE_SHRINK_ICACHE_MEMORY, 1,
[shrink_icache_memory() is available])],
[])
AC_DEFUN([SPL_AC_SHRINK_ICACHE_MEMORY],
[AC_MSG_CHECKING([whether shrink_icache_memory() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/dcache.h>
], [
shrink_icache_memory(0, 0);
], [shrink_icache_memory], [fs/inode.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SHRINK_ICACHE_MEMORY, 1,
[shrink_icache_memory() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #
@ -2002,13 +2178,19 @@ dnl # The kern_path_parent() symbol is no longer exported by the kernel.
dnl # However, it remains the prefered interface and since we still have
dnl # access to the prototype we dynamically lookup the required address.
dnl #
AC_DEFUN([SPL_AC_KERN_PATH_PARENT_SYMBOL], [
SPL_CHECK_SYMBOL_EXPORT(
[kern_path_parent],
[fs/namei.c],
[AC_DEFINE(HAVE_KERN_PATH_PARENT_SYMBOL, 1,
[kern_path_parent() is available])],
[])
AC_DEFUN([SPL_AC_KERN_PATH_PARENT_SYMBOL],
[AC_MSG_CHECKING([whether kern_path_parent() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/namei.h>
], [
kern_path_parent(NULL, NULL);
], [kern_path_parent], [fs/namei.c], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_KERN_PATH_PARENT_SYMBOL, 1,
[kern_path_parent() is available])
], [
AC_MSG_RESULT(no)
])
])
dnl #

View File

@ -22,6 +22,7 @@ tgz-local:
fi)
tgz-modules: tgz-local rpm-modules
if CONFIG_KERNEL
name=${PACKAGE}-modules; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
release=`echo ${LINUX_VERSION} | $(SED) -e "s/-/_/g"`; \
@ -30,13 +31,16 @@ tgz-modules: tgz-local rpm-modules
pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \
$(RM) $$pkg1 $$pkg2
endif
tgz-utils: tgz-local rpm-utils
if CONFIG_USER
name=${PACKAGE}; \
version=${SPL_META_VERSION}-${SPL_META_RELEASE}; \
arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
pkg1=$${name}-$${version}.$${arch}.rpm; \
fakeroot $(ALIEN) --scripts --to-tgz $$pkg1; \
$(RM) $$pkg1
endif
tgz: tgz-modules tgz-utils

5437
configure vendored

File diff suppressed because it is too large Load Diff

122
copy-builtin Executable file
View File

@ -0,0 +1,122 @@
#!/bin/bash
set -e
usage()
{
echo "usage: $0 <kernel source tree>" >&2
exit 1
}
[ "$#" -eq 1 ] || usage
KERNEL_DIR="$(readlink --canonicalize-existing "$1")"
MODULES=()
for MODULE_DIR in module/*
do
[ -d "$MODULE_DIR" ] || continue
MODULES+=("${MODULE_DIR##*/}")
done
if ! [ -e 'spl_config.h' ]
then
echo >&2
echo " $0: you did not run configure, or you're not in the SPL source directory." >&2
echo " $0: run configure with --with-linux=$KERNEL_DIR and --enable-linux-builtin." >&2
echo >&2
exit 1
fi
make clean || true
rm -rf "$KERNEL_DIR/include/spl" "$KERNEL_DIR/spl"
cp --recursive include "$KERNEL_DIR/include/spl"
cp --recursive module "$KERNEL_DIR/spl"
cp spl_config.h "$KERNEL_DIR/"
adjust_obj_paths()
{
local FILE="$1"
local LINE OBJPATH
while IFS='' read -r LINE
do
OBJPATH="${LINE#\$(MODULE)-objs += }"
if [ "$OBJPATH" = "$LINE" ]
then
echo "$LINE"
else
echo "\$(MODULE)-objs += ${OBJPATH##*/}"
fi
done < "$FILE" > "$FILE.new"
mv "$FILE.new" "$FILE"
}
for MODULE in "${MODULES[@]}"
do
adjust_obj_paths "$KERNEL_DIR/spl/$MODULE/Makefile"
done
cat > "$KERNEL_DIR/spl/Kconfig" <<"EOF"
config SPL
tristate "Solaris Porting Layer (SPL)"
help
This is the SPL library from the ZFS On Linux project.
See http://zfsonlinux.org/
To compile this library as a module, choose M here.
If unsure, say N.
EOF
{
cat <<-"EOF"
SPL_MODULE_CFLAGS = -I$(srctree)/include/spl
SPL_MODULE_CFLAGS += -include $(srctree)/spl_config.h
export SPL_MODULE_CFLAGS
obj-$(CONFIG_SPL) :=
EOF
for MODULE in "${MODULES[@]}"
do
echo 'obj-$(CONFIG_SPL) += ' "$MODULE/"
done
} > "$KERNEL_DIR/spl/Kbuild"
add_after()
{
local FILE="$1"
local MARKER="$2"
local NEW="$3"
local LINE
while IFS='' read -r LINE
do
echo "$LINE"
if [ -n "$MARKER" -a "$LINE" = "$MARKER" ]
then
echo "$NEW"
MARKER=''
if IFS='' read -r LINE
then
[ "$LINE" != "$NEW" ] && echo "$LINE"
fi
fi
done < "$FILE" > "$FILE.new"
mv "$FILE.new" "$FILE"
}
add_after "$KERNEL_DIR/Kconfig" 'source "arch/$SRCARCH/Kconfig"' 'source "spl/Kconfig"'
# We must take care to build SPL before ZFS, else module initialization order will be wrong
sed -i 's#kernel/ mm/ fs/#kernel/ mm/ spl/ fs/#' "$KERNEL_DIR/Makefile"
echo >&2
echo " $0: done." >&2
echo " $0: now you can build the kernel with SPL support." >&2
echo " $0: make sure you enable SPL support (CONFIG_SPL) before building." >&2
echo >&2

View File

@ -3,8 +3,12 @@ subdir-m += splat
INSTALL=/usr/bin/install
SPL_MODULE_CFLAGS = -I@abs_top_srcdir@/include
SPL_MODULE_CFLAGS += -include @abs_top_builddir@/spl_config.h
export SPL_MODULE_CFLAGS
modules:
$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ CONFIG_SPL=m $@
clean:
@# Only cleanup the kernel build directories when CONFIG_KERNEL

View File

@ -1,29 +1,27 @@
# Makefile.in for spl kernel module
MODULES := spl
EXTRA_CFLAGS = @KERNELCPPFLAGS@
EXTRA_CFLAGS += -I@abs_top_srcdir@/include
EXTRA_CFLAGS += -include @abs_top_builddir@/spl_config.h
MODULE := spl
EXTRA_CFLAGS = $(SPL_MODULE_CFLAGS) @KERNELCPPFLAGS@
# Solaris porting layer module
obj-m := spl.o
obj-$(CONFIG_SPL) := $(MODULE).o
spl-objs += @top_srcdir@/module/spl/spl-debug.o
spl-objs += @top_srcdir@/module/spl/spl-proc.o
spl-objs += @top_srcdir@/module/spl/spl-kmem.o
spl-objs += @top_srcdir@/module/spl/spl-thread.o
spl-objs += @top_srcdir@/module/spl/spl-taskq.o
spl-objs += @top_srcdir@/module/spl/spl-rwlock.o
spl-objs += @top_srcdir@/module/spl/spl-vnode.o
spl-objs += @top_srcdir@/module/spl/spl-err.o
spl-objs += @top_srcdir@/module/spl/spl-time.o
spl-objs += @top_srcdir@/module/spl/spl-kobj.o
spl-objs += @top_srcdir@/module/spl/spl-generic.o
spl-objs += @top_srcdir@/module/spl/spl-atomic.o
spl-objs += @top_srcdir@/module/spl/spl-mutex.o
spl-objs += @top_srcdir@/module/spl/spl-kstat.o
spl-objs += @top_srcdir@/module/spl/spl-condvar.o
spl-objs += @top_srcdir@/module/spl/spl-xdr.o
spl-objs += @top_srcdir@/module/spl/spl-cred.o
spl-objs += @top_srcdir@/module/spl/spl-tsd.o
spl-objs += @top_srcdir@/module/spl/spl-zlib.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-debug.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-proc.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-kmem.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-thread.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-taskq.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-rwlock.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-vnode.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-err.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-time.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-kobj.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-generic.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-atomic.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-mutex.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-kstat.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-condvar.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-xdr.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-cred.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-tsd.o
$(MODULE)-objs += @top_srcdir@/module/spl/spl-zlib.o

View File

@ -546,11 +546,29 @@ hostid_exec(void)
uint32_t
zone_get_hostid(void *zone)
{
static int first = 1;
unsigned long hostid;
int rc;
/* Only the global zone is supported */
ASSERT(zone == NULL);
if (first) {
first = 0;
/*
* Get the hostid if it was not passed as a module parameter.
* Try reading the /etc/hostid file directly, and then fall
* back to calling the /usr/bin/hostid utility.
*/
if ((spl_hostid == HW_INVALID_HOSTID) &&
(rc = hostid_read()) && (rc = hostid_exec()))
return HW_INVALID_HOSTID;
printk(KERN_NOTICE "SPL: using hostid 0x%08x\n",
(unsigned int) spl_hostid);
}
if (ddi_strtoul(hw_serial, NULL, HW_HOSTID_LEN-1, &hostid) != 0)
return HW_INVALID_HOSTID;
@ -632,16 +650,6 @@ __init spl_init(void)
if ((rc = spl_zlib_init()))
SGOTO(out9, rc);
/*
* Get the hostid if it was not passed as a module parameter. Try
* reading the /etc/hostid file directly, and then fall back to calling
* the /usr/bin/hostid utility.
*/
if (spl_hostid == HW_INVALID_HOSTID
&& (rc = hostid_read()) && (rc = hostid_exec()))
SGOTO(out10, rc = -EADDRNOTAVAIL);
#ifndef HAVE_KALLSYMS_LOOKUP_NAME
if ((rc = set_kallsyms_lookup_name()))
SGOTO(out10, rc = -EADDRNOTAVAIL);
@ -653,9 +661,8 @@ __init spl_init(void)
if ((rc = spl_vn_init_kallsyms_lookup()))
SGOTO(out10, rc);
printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s, using hostid "
"0x%08x\n", SPL_META_VERSION, SPL_META_RELEASE, SPL_DEBUG_STR,
(unsigned int) spl_hostid);
printk(KERN_NOTICE "SPL: Loaded module v%s-%s%s\n", SPL_META_VERSION,
SPL_META_RELEASE, SPL_DEBUG_STR);
SRETURN(rc);
out10:
spl_zlib_fini();

View File

@ -51,7 +51,7 @@
* unavailable we provide a standard mutex.
*/
#ifndef HAVE_MUTEX_OWNER
#if !defined(HAVE_MUTEX_OWNER) || !defined(CONFIG_SMP) || defined(CONFIG_DEBUG_MUTEXES)
#ifdef HAVE_TASK_CURR
/*
* mutex_spin_max = { 0, -1, 1-MAX_INT }

View File

@ -1,27 +1,25 @@
# Makefile.in for splat kernel module
MODULES := splat
EXTRA_CFLAGS = @KERNELCPPFLAGS@
EXTRA_CFLAGS += -I@abs_top_srcdir@/include
EXTRA_CFLAGS += -include @abs_top_builddir@/spl_config.h
MODULE := splat
EXTRA_CFLAGS = $(SPL_MODULE_CFLAGS) @KERNELCPPFLAGS@
# Solaris Porting LAyer Tests
obj-m := splat.o
obj-$(CONFIG_SPL) := $(MODULE).o
splat-objs += @top_srcdir@/module/splat/splat-ctl.o
splat-objs += @top_srcdir@/module/splat/splat-kmem.o
splat-objs += @top_srcdir@/module/splat/splat-taskq.o
splat-objs += @top_srcdir@/module/splat/splat-random.o
splat-objs += @top_srcdir@/module/splat/splat-mutex.o
splat-objs += @top_srcdir@/module/splat/splat-condvar.o
splat-objs += @top_srcdir@/module/splat/splat-thread.o
splat-objs += @top_srcdir@/module/splat/splat-rwlock.o
splat-objs += @top_srcdir@/module/splat/splat-time.o
splat-objs += @top_srcdir@/module/splat/splat-vnode.o
splat-objs += @top_srcdir@/module/splat/splat-kobj.o
splat-objs += @top_srcdir@/module/splat/splat-atomic.o
splat-objs += @top_srcdir@/module/splat/splat-list.o
splat-objs += @top_srcdir@/module/splat/splat-generic.o
splat-objs += @top_srcdir@/module/splat/splat-cred.o
splat-objs += @top_srcdir@/module/splat/splat-zlib.o
splat-objs += @top_srcdir@/module/splat/splat-linux.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-ctl.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-kmem.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-taskq.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-random.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-mutex.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-condvar.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-thread.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-rwlock.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-time.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-vnode.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-kobj.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-atomic.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-list.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-generic.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-cred.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-zlib.o
$(MODULE)-objs += @top_srcdir@/module/splat/splat-linux.o

View File

@ -210,7 +210,7 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* task_curr() exported */
/* task_curr() is available */
#undef HAVE_TASK_CURR
/* timespec_sub() is available */