mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Added SPL_AC_5ARGS_DEVICE_CREATE autoconf configure check
As of 2.6.27 kernels the device_create() API changed to include a private data argument. This check detects which version of device_create() function the kernel has and properly defines spl_device_create() to use the correct prototype.
This commit is contained in:
parent
a0b5ae8aca
commit
8123ac4f0d
@ -503,6 +503,28 @@ AC_DEFUN([SPL_AC_DEVICE_CREATE], [
|
||||
[])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 2.6.27 API change,
|
||||
dnl # device_create() uses 5 args, new 'drvdata' argument.
|
||||
dnl #
|
||||
AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
|
||||
AC_MSG_CHECKING([whether device_create() wants 5 args])
|
||||
tmp_flags="$EXTRA_KCFLAGS"
|
||||
EXTRA_KCFLAGS="-Werror"
|
||||
SPL_LINUX_TRY_COMPILE([
|
||||
#include <linux/device.h>
|
||||
],[
|
||||
device_create(NULL, NULL, 0, NULL, "%d", 1);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
|
||||
[device_create wants 5 args])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
EXTRA_KCFLAGS="$tmp_flags"
|
||||
])
|
||||
|
||||
dnl #
|
||||
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
|
||||
|
68
configure
vendored
68
configure
vendored
@ -19788,6 +19788,74 @@ _ACEOF
|
||||
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking whether device_create() wants 5 args" >&5
|
||||
echo $ECHO_N "checking whether device_create() wants 5 args... $ECHO_C" >&6
|
||||
tmp_flags="$EXTRA_KCFLAGS"
|
||||
EXTRA_KCFLAGS="-Werror"
|
||||
|
||||
|
||||
cat >conftest.c <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
#include <linux/device.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
device_create(NULL, NULL, 0, NULL, "%d", 1);
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
|
||||
|
||||
rm -Rf build && mkdir -p build
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules CC="$CC" LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_5ARGS_DEVICE_CREATE 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
|
||||
|
||||
|
||||
fi
|
||||
|
||||
rm -Rf build
|
||||
|
||||
|
||||
EXTRA_KCFLAGS="$tmp_flags"
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking whether symbol class_device_create is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol class_device_create is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]class_device_create[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
|
@ -54,6 +54,7 @@ SPL_AC_TASK_CURR
|
||||
SPL_AC_CTL_UNNUMBERED
|
||||
SPL_AC_FLS64
|
||||
SPL_AC_DEVICE_CREATE
|
||||
SPL_AC_5ARGS_DEVICE_CREATE
|
||||
SPL_AC_CLASS_DEVICE_CREATE
|
||||
SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
|
||||
SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
|
||||
|
@ -13,8 +13,15 @@ typedef struct device spl_device;
|
||||
|
||||
#define spl_class_create(mod, name) class_create(mod, name)
|
||||
#define spl_class_destroy(cls) class_destroy(cls)
|
||||
#define spl_device_create(cls, parent, devt, device, fmt, args...) \
|
||||
|
||||
# ifdef HAVE_5ARGS_DEVICE_CREATE
|
||||
# define spl_device_create(cls, parent, devt, drvdata, fmt, args...) \
|
||||
device_create(cls, parent, devt, drvdata, fmt, ## args)
|
||||
# else
|
||||
# define spl_device_create(cls, parent, devt, drvdata, fmt, args...) \
|
||||
device_create(cls, parent, devt, fmt, ## args)
|
||||
# endif
|
||||
|
||||
#define spl_device_destroy(cls, cls_dev, devt) \
|
||||
device_destroy(cls, devt)
|
||||
|
||||
|
@ -21,6 +21,9 @@
|
||||
/* on_each_cpu wants 3 args */
|
||||
#undef HAVE_3ARGS_ON_EACH_CPU
|
||||
|
||||
/* device_create wants 5 args */
|
||||
#undef HAVE_5ARGS_DEVICE_CREATE
|
||||
|
||||
/* kernel defines atomic64_t */
|
||||
#undef HAVE_ATOMIC64_T
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user