xref: /freebsd/sys/contrib/openzfs/config/kernel-assign_str.m4 (revision 7a7741af18d6c8a804cc643cb7ecda9d730c6aa6)
1dnl #
2dnl # 6.10 kernel, check number of args of __assign_str() for trace:
3dnl
4dnl # 6.10+:           one arg
5dnl # 6.9 and older:   two args
6dnl #
7dnl # More specifically, this will test to see if __assign_str() takes one
8dnl # arg.  If __assign_str() takes two args, or is not defined, then
9dnl # HAVE_1ARG_ASSIGN_STR will not be set.
10dnl #
11AC_DEFUN([ZFS_AC_KERNEL_1ARG_ASSIGN_STR], [
12       AC_MSG_CHECKING([whether __assign_str() has one arg])
13       ZFS_LINUX_TRY_COMPILE_HEADER([
14               #include <linux/module.h>
15               MODULE_LICENSE("$ZFS_META_LICENSE");
16
17               #define CREATE_TRACE_POINTS
18               #include "conftest.h"
19       ],[
20               trace_zfs_autoconf_event_one("1");
21               trace_zfs_autoconf_event_two("2");
22       ],[
23               AC_MSG_RESULT(yes)
24               AC_DEFINE(HAVE_1ARG_ASSIGN_STR, 1,
25                   [__assign_str() has one arg])
26       ],[
27               AC_MSG_RESULT(no)
28       ],[
29               #if !defined(_CONFTEST_H) || defined(TRACE_HEADER_MULTI_READ)
30               #define _CONFTEST_H
31
32               #undef  TRACE_SYSTEM
33               #define TRACE_SYSTEM zfs
34               #include <linux/tracepoint.h>
35
36               DECLARE_EVENT_CLASS(zfs_autoconf_event_class,
37                       TP_PROTO(char *string),
38                       TP_ARGS(string),
39                       TP_STRUCT__entry(
40                               __string(str, string)
41                       ),
42                       TP_fast_assign(
43                               __assign_str(str);
44                       ),
45                       TP_printk("str = %s", __get_str(str))
46               );
47
48               #define DEFINE_AUTOCONF_EVENT(name) \
49               DEFINE_EVENT(zfs_autoconf_event_class, name, \
50                       TP_PROTO(char * str), \
51                       TP_ARGS(str))
52               DEFINE_AUTOCONF_EVENT(zfs_autoconf_event_one);
53               DEFINE_AUTOCONF_EVENT(zfs_autoconf_event_two);
54
55               #endif /* _CONFTEST_H */
56
57               #undef  TRACE_INCLUDE_PATH
58               #define TRACE_INCLUDE_PATH .
59               #define TRACE_INCLUDE_FILE conftest
60               #include <trace/define_trace.h>
61       ])
62])
63