dnl #
AC_DEFUN([SPL_LINUX_TRY_COMPILE],
[SPL_LINUX_COMPILE_IFELSE(
- [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
- [modules],
- [test -s build/conftest.o],
- [$3], [$4])
+ [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
+ [modules],
+ [test -s build/conftest.o],
+ [$3], [$4])
])
dnl #
AC_DEFUN([SPL_CHECK_HEADER],
[AC_MSG_CHECKING([whether header $1 exists])
SPL_LINUX_TRY_COMPILE([
- #include <$1>
+ #include <$1>
],[
return 0;
],[
AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
[AC_MSG_CHECKING([whether kernel defines uintptr_t])
SPL_LINUX_TRY_COMPILE([
- #include <linux/types.h>
+ #include <linux/types.h>
],[
- uintptr_t *ptr;
+ uintptr_t *ptr;
],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_UINTPTR_T, 1,
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_UINTPTR_T, 1,
[kernel defines uintptr_t])
],[
- AC_MSG_RESULT([no])
- ])
-])
-
-dnl #
-dnl # 2.6.19 API change,
-dnl # panic_notifier_list use atomic_notifier operations
-dnl #
-
-AC_DEFUN([SPL_AC_ATOMIC_PANIC_NOTIFIER],
- [AC_MSG_CHECKING([whether panic_notifier_list is atomic])
- SPL_LINUX_TRY_COMPILE([
- #include <linux/notifier.h>
- #include <linux/kernel.h>
- ],[
- struct atomic_notifier_head panic_notifier_list;
- ],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_ATOMIC_PANIC_NOTIFIER, 1,
- [panic_notifier_list is atomic])
- ],[
- AC_MSG_RESULT(no)
+ AC_MSG_RESULT([no])
])
])
AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
[AC_MSG_CHECKING([whether INIT_WORK wants 3 args])
SPL_LINUX_TRY_COMPILE([
- #include <linux/workqueue.h>
+ #include <linux/workqueue.h>
],[
- struct work_struct work;
-
- INIT_WORK(&work, NULL, NULL);
+ struct work_struct work;
+ INIT_WORK(&work, NULL, NULL);
],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
- [INIT_WORK wants 3 args])
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
+ [INIT_WORK wants 3 args])
],[
- AC_MSG_RESULT(no)
+ AC_MSG_RESULT(no)
])
])
AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
[AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
SPL_LINUX_TRY_COMPILE([
- #include <linux/sysctl.h>
+ #include <linux/sysctl.h>
],[
- return register_sysctl_table(NULL,0);
+ return register_sysctl_table(NULL,0);
],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
- [register_sysctl_table() wants 2 args])
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
+ [register_sysctl_table() wants 2 args])
],[
- AC_MSG_RESULT(no)
+ AC_MSG_RESULT(no)
])
])
AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
[AC_MSG_CHECKING([whether struct path used in struct nameidata])
SPL_LINUX_TRY_COMPILE([
- #include <linux/namei.h>
+ #include <linux/namei.h>
],[
- struct nameidata nd;
+ struct nameidata nd;
nd.path.mnt = NULL;
nd.path.dentry = NULL;
],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
- [struct path used in struct nameidata])
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
+ [struct path used in struct nameidata])
],[
- AC_MSG_RESULT(no)
+ AC_MSG_RESULT(no)
])
])
AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
[AC_MSG_CHECKING([whether unnumbered sysctl support exists])
SPL_LINUX_TRY_COMPILE([
- #include <linux/sysctl.h>
+ #include <linux/sysctl.h>
],[
#ifndef CTL_UNNUMBERED
#error CTL_UNNUMBERED undefined
#endif
],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
- [unnumbered sysctl support exists])
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
+ [unnumbered sysctl support exists])
],[
- AC_MSG_RESULT(no)
+ AC_MSG_RESULT(no)
])
])
#include <linux/kthread.h>
#include <linux/hardirq.h>
#include <linux/interrupt.h>
-#include <linux/notifier.h>
#include <sys/sysmacros.h>
#include <sys/proc.h>
#include <sys/debug.h>
struct rw_semaphore trace_sem;
atomic_t trace_tage_allocated = ATOMIC_INIT(0);
-static int panic_notifier(struct notifier_block *, unsigned long, void *);
static int spl_debug_dump_all_pages(dumplog_priv_t *dp, char *);
static void trace_fini(void);
10 /* 10% pages for TCD_TYPE_IRQ */
};
-static struct notifier_block spl_panic_notifier = {
- notifier_call: panic_notifier,
- next: NULL,
- priority: 10000
-};
-
const char *
spl_debug_subsys2str(int subsys)
{
}
EXPORT_SYMBOL(spl_debug_mark_buffer);
-static int
-panic_notifier(struct notifier_block *self,
- unsigned long unused1, void *unused2)
-{
- if (spl_panic_in_progress)
- return 0;
-
- spl_panic_in_progress = 1;
- mb();
-
- if (!in_interrupt()) {
- while (current->lock_depth >= 0)
- unlock_kernel();
-
- spl_debug_dumplog(DL_NOTHREAD | DL_SINGLE_CPU);
- }
-
- return 0;
-}
-
static int
trace_init(int max_pages)
{
if (rc)
return rc;
-#ifdef HAVE_ATOMIC_PANIC_NOTIFIER
- atomic_notifier_chain_register(&panic_notifier_list,
- &spl_panic_notifier);
-#else
- notifier_chain_register(&panic_notifier_list,
- &spl_panic_notifier);
-#endif
- return rc;
+ return rc;
}
static void
void
debug_fini(void)
{
-#ifdef HAVE_ATOMIC_PANIC_NOTIFIER
- atomic_notifier_chain_unregister(&panic_notifier_list,
- &spl_panic_notifier);
-#else
- notifier_chain_unregister(&panic_notifier_list,
- &spl_panic_notifier);
-#endif
-
trace_fini();
-
- return;
}