mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Update code to use misc_register()/misc_deregister()
When the SPL was originally written it was designed to use the device_create() and device_destroy() functions. Unfortunately, these functions changed considerably over the years making them difficult to rely on. As it turns out a better choice would have been to use the misc_register()/misc_deregister() functions. This interface for registering character devices has remained stable, is simple, and provides everything we need. Therefore the code has been reworked to use this interface. The higher level ZFS code has always depended on these same interfaces so this is also as a step towards minimizing our kernel dependencies. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
@@ -34,9 +34,6 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
|
||||
SPL_AC_VMALLOC_INFO
|
||||
SPL_AC_PDE_DATA
|
||||
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
|
||||
SPL_AC_TIMESPEC_SUB
|
||||
@@ -1075,64 +1072,6 @@ AC_DEFUN([SPL_AC_FLS64],
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
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],
|
||||
[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 #
|
||||
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
|
||||
dnl # class_simple_device_add() which was fully removed in 2.6.13.
|
||||
dnl #
|
||||
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 #
|
||||
|
||||
Reference in New Issue
Block a user