Linux 3.10 compat: replace PDE()->data with PDE_DATA()

Linux kernel commit torvalds/linux@d9dda78b renamed PDE() to
PDE_DATA().  To handle this detect the prefered interface
and define a PDE_DATA() wrapper for consistency.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #257
This commit is contained in:
Yuxuan Shui 2013-05-14 08:39:26 +08:00 committed by Brian Behlendorf
parent c02ab72fb9
commit 1ddf9722dc
2 changed files with 23 additions and 1 deletions

View File

@ -34,6 +34,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_CTL_UNNUMBERED
SPL_AC_CTL_NAME
SPL_AC_VMALLOC_INFO
SPL_AC_PDE_DATA
SPL_AC_FLS64
SPL_AC_DEVICE_CREATE
SPL_AC_5ARGS_DEVICE_CREATE
@ -1377,6 +1378,24 @@ AC_DEFUN([SPL_AC_VMALLOC_INFO], [
])
])
dnl #
dnl # 3.10 API change,
dnl # PDE is replaced by PDE_DATA
dnl #
AC_DEFUN([SPL_AC_PDE_DATA], [
AC_MSG_CHECKING([whether PDE_DATA() is available])
SPL_LINUX_TRY_COMPILE_SYMBOL([
#include <linux/proc_fs.h>
], [
PDE_DATA(NULL);
], [PDE_DATA], [], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PDE_DATA, 1, [yes])
],[
AC_MSG_RESULT(no)
])
])
dnl #
dnl # 2.6.17 API change
dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and

View File

@ -33,6 +33,9 @@
#endif
#define SS_DEBUG_SUBSYS SS_KSTAT
#ifndef HAVE_PDE_DATA
#define PDE_DATA(x) (PDE(x)->data)
#endif
static spinlock_t kstat_lock;
static struct list_head kstat_list;
@ -359,7 +362,7 @@ proc_kstat_open(struct inode *inode, struct file *filp)
return rc;
f = filp->private_data;
f->private = PDE(inode)->data;
f->private = PDE_DATA(inode);
return rc;
}