1*eda14cbcSMatt Macydnl #
2*eda14cbcSMatt Macydnl # Ensure the DECLARE_EVENT_CLASS macro is available to non-GPL modules.
3*eda14cbcSMatt Macydnl #
4*eda14cbcSMatt MacyAC_DEFUN([ZFS_AC_KERNEL_DECLARE_EVENT_CLASS], [
5*eda14cbcSMatt Macy	AC_MSG_CHECKING([whether DECLARE_EVENT_CLASS() is available])
6*eda14cbcSMatt Macy	ZFS_LINUX_TRY_COMPILE_HEADER([
7*eda14cbcSMatt Macy		#include <linux/module.h>
8*eda14cbcSMatt Macy		MODULE_LICENSE("$ZFS_META_LICENSE");
9*eda14cbcSMatt Macy
10*eda14cbcSMatt Macy		#define CREATE_TRACE_POINTS
11*eda14cbcSMatt Macy		#include "conftest.h"
12*eda14cbcSMatt Macy	],[
13*eda14cbcSMatt Macy		trace_zfs_autoconf_event_one(1UL);
14*eda14cbcSMatt Macy		trace_zfs_autoconf_event_two(2UL);
15*eda14cbcSMatt Macy	],[
16*eda14cbcSMatt Macy		AC_MSG_RESULT(yes)
17*eda14cbcSMatt Macy		AC_DEFINE(HAVE_DECLARE_EVENT_CLASS, 1,
18*eda14cbcSMatt Macy		    [DECLARE_EVENT_CLASS() is available])
19*eda14cbcSMatt Macy	],[
20*eda14cbcSMatt Macy		AC_MSG_RESULT(no)
21*eda14cbcSMatt Macy	],[
22*eda14cbcSMatt Macy		#if !defined(_CONFTEST_H) || defined(TRACE_HEADER_MULTI_READ)
23*eda14cbcSMatt Macy		#define _CONFTEST_H
24*eda14cbcSMatt Macy
25*eda14cbcSMatt Macy		#undef  TRACE_SYSTEM
26*eda14cbcSMatt Macy		#define TRACE_SYSTEM zfs
27*eda14cbcSMatt Macy		#include <linux/tracepoint.h>
28*eda14cbcSMatt Macy
29*eda14cbcSMatt Macy		DECLARE_EVENT_CLASS(zfs_autoconf_event_class,
30*eda14cbcSMatt Macy			TP_PROTO(unsigned long i),
31*eda14cbcSMatt Macy			TP_ARGS(i),
32*eda14cbcSMatt Macy			TP_STRUCT__entry(
33*eda14cbcSMatt Macy				__field(unsigned long, i)
34*eda14cbcSMatt Macy			),
35*eda14cbcSMatt Macy			TP_fast_assign(
36*eda14cbcSMatt Macy				__entry->i = i;
37*eda14cbcSMatt Macy			),
38*eda14cbcSMatt Macy			TP_printk("i = %lu", __entry->i)
39*eda14cbcSMatt Macy		);
40*eda14cbcSMatt Macy
41*eda14cbcSMatt Macy		#define DEFINE_AUTOCONF_EVENT(name) \
42*eda14cbcSMatt Macy		DEFINE_EVENT(zfs_autoconf_event_class, name, \
43*eda14cbcSMatt Macy			TP_PROTO(unsigned long i), \
44*eda14cbcSMatt Macy			TP_ARGS(i))
45*eda14cbcSMatt Macy		DEFINE_AUTOCONF_EVENT(zfs_autoconf_event_one);
46*eda14cbcSMatt Macy		DEFINE_AUTOCONF_EVENT(zfs_autoconf_event_two);
47*eda14cbcSMatt Macy
48*eda14cbcSMatt Macy		#endif /* _CONFTEST_H */
49*eda14cbcSMatt Macy
50*eda14cbcSMatt Macy		#undef  TRACE_INCLUDE_PATH
51*eda14cbcSMatt Macy		#define TRACE_INCLUDE_PATH .
52*eda14cbcSMatt Macy		#define TRACE_INCLUDE_FILE conftest
53*eda14cbcSMatt Macy		#include <trace/define_trace.h>
54*eda14cbcSMatt Macy	])
55*eda14cbcSMatt Macy])
56