4 # whether to enable various libcfs debugs (CDEBUG, ENTRY/EXIT, LASSERT, etc.)
6 AC_DEFUN([LIBCFS_CONFIG_CDEBUG], [
7 AC_MSG_CHECKING([whether to enable CDEBUG, CWARN])
8 AC_ARG_ENABLE([libcfs_cdebug],
9 AS_HELP_STRING([--disable-libcfs-cdebug],
10 [disable libcfs CDEBUG, CWARN]),
11 [], [enable_libcfs_cdebug="yes"])
12 AC_MSG_RESULT([$enable_libcfs_cdebug])
13 AS_IF([test "x$enable_libcfs_cdebug" = xyes],
14 [AC_DEFINE(CDEBUG_ENABLED, 1, [enable libcfs CDEBUG, CWARN])])
16 AC_MSG_CHECKING([whether to enable ENTRY/EXIT])
17 AC_ARG_ENABLE([libcfs_trace],
18 AS_HELP_STRING([--disable-libcfs-trace],
19 [disable libcfs ENTRY/EXIT]),
20 [], [enable_libcfs_trace="yes"])
21 AC_MSG_RESULT([$enable_libcfs_trace])
22 AS_IF([test "x$enable_libcfs_trace" = xyes],
23 [AC_DEFINE(CDEBUG_ENTRY_EXIT, 1, [enable libcfs ENTRY/EXIT])])
25 AC_MSG_CHECKING([whether to enable LASSERT, LASSERTF])
26 AC_ARG_ENABLE([libcfs_assert],
27 AS_HELP_STRING([--disable-libcfs-assert],
28 [disable libcfs LASSERT, LASSERTF]),
29 [], [enable_libcfs_assert="yes"])
30 AC_MSG_RESULT([$enable_libcfs_assert])
31 AS_IF([test x$enable_libcfs_assert = xyes],
32 [AC_DEFINE(LIBCFS_DEBUG, 1, [enable libcfs LASSERT, LASSERTF])])
33 ]) # LIBCFS_CONFIG_CDEBUG
36 # LIBCFS_CONFIG_PANIC_DUMPLOG
38 # check if tunable panic_dumplog is wanted
40 AC_DEFUN([LIBCFS_CONFIG_PANIC_DUMPLOG], [
41 AC_MSG_CHECKING([whether to use tunable 'panic_dumplog' support])
42 AC_ARG_ENABLE([panic_dumplog],
43 AS_HELP_STRING([--enable-panic_dumplog],
44 [enable panic_dumplog]),
45 [], [enable_panic_dumplog="no"])
46 AC_MSG_RESULT([$enable_panic_dumplog])
47 AS_IF([test "x$enable_panic_dumplog" = xyes],
48 [AC_DEFINE(LNET_DUMP_ON_PANIC, 1, [use dumplog on panic])])
49 ]) # LIBCFS_CONFIG_PANIC_DUMPLOG
52 # Kernel version 3.11 introduced ktime_get_ts64
54 AC_DEFUN([LIBCFS_KTIME_GET_TS64],[
55 LB_CHECK_COMPILE([does function 'ktime_get_ts64' exist],
57 #include <linux/hrtimer.h>
58 #include <linux/ktime.h>
60 struct timespec64 *ts = NULL;
64 AC_DEFINE(HAVE_KTIME_GET_TS64, 1,
65 ['ktime_get_ts64' is available])
67 ]) # LIBCFS_KTIME_GET_TS64
70 # Kernel version 3.12-rc4 commit c2d816443ef30 added prepare_to_wait_event()
72 AC_DEFUN([LIBCFS_PREPARE_TO_WAIT_EVENT],[
73 LB_CHECK_COMPILE([does function 'prepare_to_wait_event' exist],
74 prepare_to_wait_event, [
75 #include <linux/wait.h>
77 prepare_to_wait_event(NULL, NULL, 0);
79 AC_DEFINE(HAVE_PREPARE_TO_WAIT_EVENT, 1,
80 ['prepare_to_wait_event' is available])
82 ]) # LIBCFS_PREPARE_TO_WAIT_EVENT
85 # Linux kernel 3.12 introduced struct kernel_param_ops
86 # This has been backported to all lustre supported
87 # clients except RHEL6. We have to handle the differences.
89 AC_DEFUN([LIBCFS_KERNEL_PARAM_OPS],[
90 LB_CHECK_COMPILE([does 'struct kernel_param_ops' exist],
92 #include <linux/module.h>
94 struct kernel_param_ops ops;
98 AC_DEFINE(HAVE_KERNEL_PARAM_OPS, 1,
99 ['struct kernel_param_ops' is available])
101 ]) # LIBCFS_KERNEL_PARAM_OPS
104 # Kernel version 3.12 introduced ktime_add
106 AC_DEFUN([LIBCFS_KTIME_ADD],[
107 LB_CHECK_COMPILE([does function 'ktime_add' exist],
109 #include <linux/hrtimer.h>
110 #include <linux/ktime.h>
112 ktime_t start = ktime_set(0, 0);
116 total = ktime_add(start, end);
118 AC_DEFINE(HAVE_KTIME_ADD, 1,
119 [ktime_add is available])
121 ]) # LIBCFS_KTIME_ADD
124 # Kernel version 3.12 introduced ktime_after
126 AC_DEFUN([LIBCFS_KTIME_AFTER],[
127 LB_CHECK_COMPILE([does function 'ktime_after' exist],
129 #include <linux/hrtimer.h>
130 #include <linux/ktime.h>
132 ktime_t start = ktime_set(0, 0);
135 ktime_after(start, end);
137 AC_DEFINE(HAVE_KTIME_AFTER, 1,
138 [ktime_after is available])
140 ]) # LIBCFS_KTIME_AFTER
143 # Kernel version 3.12 introduced ktime_before
144 # See linux commit 67cb9366ff5f99868100198efba5ca88aaa6ad25
146 AC_DEFUN([LIBCFS_KTIME_BEFORE],[
147 LB_CHECK_COMPILE([does function 'ktime_before' exist],
149 #include <linux/hrtimer.h>
150 #include <linux/ktime.h>
152 ktime_t start = ktime_set(0, 0);
155 ktime_before(start, end);
157 AC_DEFINE(HAVE_KTIME_BEFORE, 1,
158 [ktime_before is available])
160 ]) # LIBCFS_KTIME_BEFORE
163 # Kernel version 3.12 introduced ktime_compare
165 AC_DEFUN([LIBCFS_KTIME_COMPARE],[
166 LB_CHECK_COMPILE([does function 'ktime_compare' exist],
168 #include <linux/hrtimer.h>
169 #include <linux/ktime.h>
171 ktime_t start = ktime_set(0, 0);
174 ktime_compare(start, end);
176 AC_DEFINE(HAVE_KTIME_COMPARE, 1,
177 [ktime_compare is available])
179 ]) # LIBCFS_KTIME_COMPARE
182 # FC19 3.12 kernel struct shrinker change
184 AC_DEFUN([LIBCFS_SHRINKER_COUNT],[
185 LB_CHECK_COMPILE([shrinker has 'count_objects'],
186 shrinker_count_objects, [
187 #include <linux/mmzone.h>
188 #include <linux/shrinker.h>
190 struct shrinker shrinker;
192 shrinker.count_objects = NULL;
194 AC_DEFINE(HAVE_SHRINKER_COUNT, 1,
195 [shrinker has count_objects member])
197 ]) # LIBCFS_SHRINKER_COUNT
200 # Kernel version 3.13 commit aace05097a0fd467230e39acb148be0fdaa90068
201 # add match_wildcard() function.
203 AC_DEFUN([LIBCFS_MATCH_WILDCARD],[
204 LB_CHECK_COMPILE([does function 'match_wildcard' exist],
206 #include <linux/parser.h>
210 match = match_wildcard(NULL, NULL);
212 AC_DEFINE(HAVE_MATCH_WILDCARD, 1,
213 [match_wildcard() is available])
215 ]) # LIBCFS_MATCH_WILDCARD
218 # LIBCFS_HAVE_MAPPING_AS_EXITING_FLAG
220 # v3.14-7405-g91b0abe36a7b added AS_EXITING flag with
221 # mapping_exiting() and mapping_set_exiting()
223 AC_DEFUN([LIBCFS_HAVE_MAPPING_AS_EXITING_FLAG], [
224 m4_pattern_allow([AS_EXITING])
225 tmp_flags="$EXTRA_KCFLAGS"
226 EXTRA_KCFLAGS="-Werror"
227 LB_CHECK_COMPILE([if enum mapping_flags has AS_EXITING flag],
228 mapping_exiting_exists, [
229 #include <linux/pagemap.h>
231 enum mapping_flags flag = AS_EXITING;
234 AC_DEFINE(HAVE_MAPPING_AS_EXITING_FLAG, 1,
235 [enum mapping_flags has AS_EXITING flag])
237 EXTRA_KCFLAGS="$tmp_flags"
238 ]) # LIBCFS_HAVE_MAPPING_AS_EXITING_FLAG
241 # LIBCFS_IOV_ITER_HAS_TYPE
243 # kernel 3.15-rc4 commit 71d8e532b1549a478e6a6a8a44f309d050294d00
244 # start adding the tag to iov_iter
245 # kernel 5.13 commit 8cd54c1c848031a87820e58d772166ffdf8c08c0 change
246 # ->type to ->iter_type
248 AC_DEFUN([LIBCFS_IOV_ITER_HAS_TYPE], [
249 tmp_flags="$EXTRA_KCFLAGS"
250 EXTRA_KCFLAGS="-Werror"
252 LB_CHECK_COMPILE([if iov_iter has member type],
253 iov_iter_has_type_member, [
254 #include <linux/uio.h>
256 struct iov_iter iter = { .type = ITER_KVEC };
259 AC_DEFINE(HAVE_IOV_ITER_HAS_TYPE_MEMBER, 1,
260 [if iov_iter has member type])
263 if test $iter_type_member = no; then
264 LB_CHECK_COMPILE([if iov_iter has member iter_type],
265 iov_iter_has_iter_type_member, [
266 #include <linux/uio.h>
268 struct iov_iter iter = { .iter_type = ITER_KVEC };
271 AC_DEFINE(HAVE_IOV_ITER_HAS_TYPE_MEMBER, 1,
272 [if iov_iter has member iter_type])
276 EXTRA_KCFLAGS="$tmp_flags"
277 ]) # LIBCFS_IOV_ITER_HAS_TYPE
280 # LIBCFS_HAVE_NS_TO_TIMESPEC64
282 # Kernel version 3.16-rc3 commit a84d1169164b274f13b97a23ff235c000efe3b49
283 # introduced struct __kernel_old_timeval
285 AC_DEFUN([LIBCFS_HAVE_NS_TO_TIMESPEC64],[
286 LB_CHECK_COMPILE([does 'ns_to_timespec64()' exist],
287 kernel_old_timeval, [
288 #include <linux/time.h>
290 struct timespec64 kts;
292 kts = ns_to_timespec64(0);
294 AC_DEFINE(HAVE_NS_TO_TIMESPEC64, 1,
295 [ns_to_timespec64() is available])
297 ]) # LIBCFS_HAVE_NS_TO_TIMESPEC64
302 # Kernel version 3.16 commit b01250856b25f4417c51aa33afc451fbf7da1484
303 # added glob support to the Linux kernel
305 AC_DEFUN([LIBCFS_HAVE_GLOB],[
306 tmp_flags="$EXTRA_KCFLAGS"
307 EXTRA_KCFLAGS="-Werror"
308 LB_CHECK_COMPILE([does 'glob_match()' exist],
310 #include <linux/glob.h>
312 return glob_match(NULL, NULL);
314 AC_DEFINE(HAVE_GLOB, 1,
315 [glob_match() is available])
317 EXTRA_KCFLAGS="$tmp_flags"
318 ]) # LIBCFS_HAVE_GLOB
321 # Kernel version 3.17 changed hlist_add_after to
324 AC_DEFUN([LIBCFS_HLIST_ADD_AFTER],[
325 LB_CHECK_COMPILE([does function 'hlist_add_after' exist],
327 #include <linux/list.h>
329 hlist_add_after(NULL, NULL);
331 AC_DEFINE(HAVE_HLIST_ADD_AFTER, 1,
332 [hlist_add_after is available])
334 ]) # LIBCFS_HLIST_ADD_AFTER
337 # Kernel version 3.17 introduced struct timespec64
339 AC_DEFUN([LIBCFS_TIMESPEC64],[
340 LB_CHECK_COMPILE([does 'struct timespec64' exist],
342 #include <linux/time.h>
344 struct timespec64 ts;
349 AC_DEFINE(HAVE_TIMESPEC64, 1,
350 ['struct timespec64' is available])
352 ]) # LIBCFS_TIMESPEC64
355 # Kernel version 3.17 introduced ktime_get_real_ts64
357 AC_DEFUN([LIBCFS_KTIME_GET_REAL_TS64],[
358 LB_CHECK_COMPILE([does function 'ktime_get_real_ts64' exist],
359 ktime_get_real_ts64, [
360 #include <linux/ktime.h>
362 struct timespec64 *ts = NULL;
364 ktime_get_real_ts64(ts);
366 AC_DEFINE(HAVE_KTIME_GET_REAL_TS64, 1,
367 ['ktime_get_real_ts64' is available])
369 ]) # LIBCFS_KTIME_GET_REAL_TS64
372 # Kernel version 3.17 introduced ktime_get_real_seconds
374 AC_DEFUN([LIBCFS_KTIME_GET_REAL_SECONDS],[
375 LB_CHECK_COMPILE([does function 'ktime_get_real_seconds' exist],
376 ktime_get_real_seconds, [
377 #include <linux/hrtimer.h>
378 #include <linux/ktime.h>
382 now = ktime_get_real_seconds();
384 AC_DEFINE(HAVE_KTIME_GET_REAL_SECONDS, 1,
385 ['ktime_get_real_seconds' is available])
387 ]) # LIBCFS_KTIME_GET_REAL_SECONDS
390 # Kernel version 3.17 created ktime_get_ns wrapper
392 AC_DEFUN([LIBCFS_KTIME_GET_NS],[
393 LB_CHECK_COMPILE([does function 'ktime_get_ns' exist],
395 #include <linux/hrtimer.h>
396 #include <linux/ktime.h>
400 nanoseconds = ktime_get_ns();
402 AC_DEFINE(NEED_KTIME_GET_NS, 1,
403 ['ktime_get_ns' is not available])
405 ]) # LIBCFS_KTIME_GET_NS
408 # Kernel version 3.17 created ktime_get_real_ns wrapper
410 AC_DEFUN([LIBCFS_KTIME_GET_REAL_NS],[
411 LB_CHECK_COMPILE([does function 'ktime_get_real_ns' exist],
413 #include <linux/hrtimer.h>
414 #include <linux/ktime.h>
418 nanoseconds = ktime_get_real_ns();
420 AC_DEFINE(NEED_KTIME_GET_REAL_NS, 1,
421 ['ktime_get_real_ns' is not available])
423 ]) # LIBCFS_KTIME_GET_REAL_NS
426 # Kernel version 3.17 introduced ktime_to_timespec64
428 AC_DEFUN([LIBCFS_KTIME_TO_TIMESPEC64],[
429 LB_CHECK_COMPILE([does function 'ktime_to_timespec64' exist],
430 ktime_to_timespec64, [
431 #include <linux/hrtimer.h>
432 #include <linux/ktime.h>
434 ktime_t now = ktime_set(0, 0);
435 struct timespec64 ts;
437 ts = ktime_to_timespec64(now);
439 AC_DEFINE(HAVE_KTIME_TO_TIMESPEC64, 1,
440 ['ktime_to_timespec64' is available])
442 ]) # LIBCFS_KTIME_TO_TIMESPEC64
445 # Kernel version 3.17 introduced timespec64_sub
447 AC_DEFUN([LIBCFS_TIMESPEC64_SUB],[
448 LB_CHECK_COMPILE([does function 'timespec64_sub' exist],
450 #include <linux/time.h>
452 struct timespec64 later = { }, earlier = { }, diff;
454 diff = timespec64_sub(later, earlier);
456 AC_DEFINE(HAVE_TIMESPEC64_SUB, 1,
457 ['timespec64_sub' is available])
459 ]) # LIBCFS_TIMESPEC64_SUB
462 # Kernel version 3.17 introduced timespec64_to_ktime
464 AC_DEFUN([LIBCFS_TIMESPEC64_TO_KTIME],[
465 LB_CHECK_COMPILE([does function 'timespec64_to_ktime' exist],
466 timespec64_to_ktime, [
467 #include <linux/ktime.h>
469 struct timespec64 ts;
472 now = timespec64_to_ktime(ts);
474 AC_DEFINE(HAVE_TIMESPEC64_TO_KTIME, 1,
475 ['timespec64_to_ktime' is available])
477 ]) # LIBCFS_TIMESPEC64_TO_KTIME
480 # Kernel version 3.19 introduced ktime_get_seconds
482 AC_DEFUN([LIBCFS_KTIME_GET_SECONDS],[
483 LB_CHECK_COMPILE([does function 'ktime_get_seconds' exist],
485 #include <linux/ktime.h>
489 now = ktime_get_seconds();
491 AC_DEFINE(HAVE_KTIME_GET_SECONDS, 1,
492 ['ktime_get_seconds' is available])
494 ]) # LIBCFS_KTIME_GET_SECONDS
497 # Kernel version 3.19 commit v3.18-rc2-26-g61ada528dea0
498 # introduce wait_woken()
500 AC_DEFUN([LIBCFS_WAIT_WOKEN],[
501 LB_CHECK_COMPILE([does function 'wait_woken' exist],
503 #include <linux/wait.h>
505 wait_woken(NULL, 0, 0);
507 AC_DEFINE(HAVE_WAIT_WOKEN, 1,
508 ['wait_woken, is available'])
510 ]) # LIBCFS_WAIT_WOKEN
513 # Kernel version 4.0 commit 41fbf3b39d5eca01527338b4d0ee15ee1ae1023c
514 # introduced the helper function ktime_ms_delta.
516 AC_DEFUN([LIBCFS_KTIME_MS_DELTA],[
517 LB_CHECK_COMPILE([does function 'ktime_ms_delta' exist],
519 #include <linux/ktime.h>
521 ktime_t start = ktime_set(0, 0);
524 ktime_ms_delta(start, end);
526 AC_DEFINE(HAVE_KTIME_MS_DELTA, 1,
527 ['ktime_ms_delta' is available])
529 ]) # LIBCFS_KTIME_MS_DELTA
532 # Kernel version 4.1 commit b51d23e4e9fea6f264d39535c2a62d1f51e7ccc3
533 # create per module locks which added kernel_param_[un]lock(). Older
534 # kernels you have to use __kernel_param_[un]lock(). In that case its
535 # a global lock for all modules but that is okay since its a rare event.
537 AC_DEFUN([LIBCFS_KERNEL_PARAM_LOCK],[
538 LB_CHECK_COMPILE([does function 'kernel_param_[un]lock' exist],
540 #include <linux/moduleparam.h>
542 kernel_param_lock(NULL);
543 kernel_param_unlock(NULL);
545 AC_DEFINE(HAVE_KERNEL_PARAM_LOCK, 1,
546 ['kernel_param_[un]lock' is available])
548 ]) # LIBCFS_KERNEL_PARAM_LOCK
551 # Kernel version 4.2 changed topology_thread_cpumask
552 # to topology_sibling_cpumask
554 AC_DEFUN([LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK],[
555 LB_CHECK_COMPILE([does function 'topology_sibling_cpumask' exist],
556 topology_sibling_cpumask, [
557 #include <linux/topology.h>
559 const struct cpumask *mask;
561 mask = topology_sibling_cpumask(0);
563 AC_DEFINE(HAVE_TOPOLOGY_SIBLING_CPUMASK, 1,
564 [topology_sibling_cpumask is available])
566 ]) # LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
569 # Kernel version 4.4 commit ef951599074ba4fad2d0efa0a977129b41e6d203
570 # introduced kstrtobool and kstrtobool_from_user.
572 AC_DEFUN([LIBCFS_KSTRTOBOOL_FROM_USER], [
573 LB_CHECK_COMPILE([if Linux kernel has 'kstrtobool_from_user'],
574 kstrtobool_from_user, [
575 #include <linux/kernel.h>
578 return kstrtobool_from_user(NULL, 0, &result);
580 AC_DEFINE(HAVE_KSTRTOBOOL_FROM_USER, 1,
581 [kernel has kstrtobool_from_user])
583 ]) # LIBCFS_KSTRTOBOOL_FROM_USER
586 # LIBCFS_NETLINK_CALLBACK_START
588 # Kernel version 4.4-rc3 commit fc9e50f5a5a4e1fa9ba2756f745a13e693cf6a06
589 # added a start function callback for struct netlink_callback
591 AC_DEFUN([LIBCFS_NETLINK_CALLBACK_START], [
592 LB_CHECK_COMPILE([if struct genl_ops has start callback],
594 #include <net/genetlink.h>
600 AC_DEFINE(HAVE_NETLINK_CALLBACK_START, 1,
601 [struct genl_ops has 'start' callback])
603 ]) # LIBCFS_NETLINK_CALLBACK_START
606 # Kernel version 4.5-rc1 commit d12481bc58fba89427565f8592e88446ec084a24
607 # added crypto hash helpers
609 AC_DEFUN([LIBCFS_CRYPTO_HASH_HELPERS], [
610 LB_CHECK_COMPILE([does crypto hash helper functions exist],
611 crypto_hash_helpers, [
612 #include <crypto/hash.h>
614 crypto_ahash_alg_name(NULL);
615 crypto_ahash_driver_name(NULL);
617 AC_DEFINE(HAVE_CRYPTO_HASH_HELPERS, 1,
618 [crypto hash helper functions are available])
620 ]) # LIBCFS_CRYPTO_HASH_HELPERS
623 # Kernel version 4.5-rc1 commit 3502cad73c4bbf8f6365d539e814159275252c59
624 # introduced rhashtable_replace_fast
626 AC_DEFUN([LIBCFS_RHASHTABLE_REPLACE], [
627 LB_CHECK_COMPILE([if 'rhashtable_replace_fast' exists],
628 rhashtable_replace_fast, [
629 #include <linux/rhashtable.h>
631 const struct rhashtable_params params = { 0 };
633 rhashtable_replace_fast(NULL, NULL, NULL, params);
635 AC_DEFINE(HAVE_RHASHTABLE_REPLACE, 1,
636 [rhashtable_replace_fast() is available])
638 ]) # LIBCFS_RHASHTABLE_REPLACE
641 # Kernel version 4.5-rc3 commit 2fe829aca9d7bed5fd6b49c6a1452e5e486b6cc3dd
642 # made kset_find_obj() exportable to modules
644 AC_DEFUN([LIBCFS_EXPORT_KSET_FIND_OBJ], [
645 LB_CHECK_EXPORT([kset_find_obj], [lib/kobject.c],
646 [AC_DEFINE(HAVE_KSET_FIND_OBJ, 1,
647 [kset_find_obj is exported by the kernel])])
648 ]) # LIBCFS_EXPORT_KSET_FIND_OBJ
651 # Kernel version 4.6+ commit ef703f49a6c5b909a85149bb6625c4ed0d697186
652 # fixed the brokenness of hash_64(). The fix removed GOLDEN_RATIO_PRIME_64
653 # since it was a poor prime value.
655 AC_DEFUN([LIBCFS_BROKEN_HASH_64], [
656 LB_CHECK_COMPILE([kernel has fixed hash_64()],
658 #include <linux/hash.h>
660 int tmp = GOLDEN_RATIO_PRIME_64;
662 AC_DEFINE(HAVE_BROKEN_HASH_64, 1, [kernel hash_64() is broken])
664 ]) # LIBCFS_BROKEN_HASH_64
667 # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
669 # linux 4.6 kernel changed stacktrace_ops address to return an int
671 AC_DEFUN([LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT], [
672 LB_CHECK_COMPILE([if 'struct stacktrace_ops' address function returns an int],
673 stacktrace_ops_address_return_int, [
674 #include <asm/stacktrace.h>
678 rc = ((struct stacktrace_ops *)0)->address(NULL, 0, 0);
680 AC_DEFINE(STACKTRACE_OPS_ADDRESS_RETURN_INT, 1,
681 ['struct stacktrace_ops' address function returns an int])
683 ]) # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
686 # Kernel version 4.6 removed both struct task_struct and struct mm_struct
687 # arguments to get_user_pages
689 AC_DEFUN([LIBCFS_GET_USER_PAGES_6ARG], [
690 LB_CHECK_COMPILE([if 'get_user_pages()' takes 6 arguments],
691 get_user_pages_6arg, [
692 #include <linux/mm.h>
696 rc = get_user_pages(0, 0, 0, 0, NULL, NULL);
698 AC_DEFINE(HAVE_GET_USER_PAGES_6ARG, 1,
699 [get_user_pages takes 6 arguments])
701 ]) # LIBCFS_GET_USER_PAGES_6ARG
706 # 4.6 kernel created stringhash.h which moved stuff out of dcache.h
707 # commit f4bcbe792b8f434e32487cff9d9e30ab45a3ce02
709 AC_DEFUN([LIBCFS_STRINGHASH], [
710 LB_CHECK_LINUX_HEADER([linux/stringhash.h], [
711 AC_DEFINE(HAVE_STRINGHASH, 1,
712 [stringhash.h is present])])
713 ]) # LIBCFS_STRINGHASH
716 # LIBCFS_RHASHTABLE_INSERT_FAST
718 # 4.7+ kernel commit 5ca8cc5bf11faed257c762018aea9106d529232f
719 # changed __rhashtable_insert_fast to support the new function
720 # rhashtable_lookup_get_insert_key().
722 AC_DEFUN([LIBCFS_RHASHTABLE_INSERT_FAST], [
723 tmp_flags="$EXTRA_KCFLAGS"
724 EXTRA_KCFLAGS="-Werror"
725 LB_CHECK_COMPILE([if internal '__rhashtable_insert_fast()' returns int],
726 rhashtable_insert_fast, [
727 #include <linux/rhashtable.h>
729 const struct rhashtable_params params = { 0 };
732 rc = __rhashtable_insert_fast(NULL, NULL, NULL, params);
734 AC_DEFINE(HAVE_HASHTABLE_INSERT_FAST_RETURN_INT, 1,
735 ['__rhashtable_insert_fast()' returns int])
737 EXTRA_KCFLAGS="$tmp_flags"
738 ]) # LIBCFS_RHASHTABLE_INSERT_FAST
741 # Kernel version 4.7-rc1 commit 8f6fd83c6c5ec66a4a70c728535ddcdfef4f3697
742 # added 3rd arg to rhashtable_walk_init
744 AC_DEFUN([LIBCFS_RHASHTABLE_WALK_INIT_3ARG], [
745 LB_CHECK_COMPILE([if 'rhashtable_walk_init' has 3 args],
746 rhashtable_walk_init, [
747 #include <linux/gfp.h>
748 #include <linux/rhashtable.h>
750 rhashtable_walk_init(NULL, NULL, GFP_KERNEL);
752 AC_DEFINE(HAVE_3ARG_RHASHTABLE_WALK_INIT, 1,
753 [rhashtable_walk_init() has 3 args])
755 ]) # LIBCFS_RHASHTABLE_WALK_INIT_3ARG
758 # Kernel version 4.8-rc6 commit ca26893f05e86497a86732768ec53cd38c0819ca
759 # introduced rhashtable_lookup
761 AC_DEFUN([LIBCFS_RHASHTABLE_LOOKUP], [
762 LB_CHECK_COMPILE([if 'rhashtable_lookup' exist],
764 #include <linux/rhashtable.h>
766 const struct rhashtable_params params = { 0 };
769 ret = rhashtable_lookup(NULL, NULL, params);
771 AC_DEFINE(HAVE_RHASHTABLE_LOOKUP, 1,
772 [rhashtable_lookup() is available])
774 ]) # LIBCFS_RHASHTABLE_LOOKUP
778 # Kernel version 4.8-rc6 commit ca26893f05e86497a86732768ec53cd38c0819ca
779 # created the rhlist interface to allow inserting duplicate objects
780 # into the same table.
782 AC_DEFUN([LIBCFS_RHLTABLE], [
783 LB_CHECK_COMPILE([does 'struct rhltable' exist],
785 #include <linux/rhashtable.h>
787 struct rhltable *hlt;
789 rhltable_destroy(hlt);
791 AC_DEFINE(HAVE_RHLTABLE, 1,
792 [struct rhltable exist])
797 # LIBCFS_STACKTRACE_OPS
799 # Kernel version 4.8 commit c8fe4609827aedc9c4b45de80e7cdc8ccfa8541b
800 # removed both struct stacktrace_ops and dump_trace() function
802 AC_DEFUN([LIBCFS_STACKTRACE_OPS], [
803 LB_CHECK_COMPILE([if 'struct stacktrace_ops' exists],
807 #include <asm/stacktrace.h>
809 struct stacktrace_ops ops;
812 AC_DEFINE(HAVE_STACKTRACE_OPS, 1,
813 [struct stacktrace_ops exists])
815 ]) # LIBCFS_STACKTRACE_OPS
818 # Kernel version 4.9-rc1 commit 246779dd090bd1b74d2652b3a6ca7759f593b27a
819 # introduced rhashtable_walk_enter
821 AC_DEFUN([LIBCFS_RHASHTABLE_WALK_ENTER], [
822 LB_CHECK_COMPILE([if 'rhashtable_walk_enter' exists],
823 rhashtable_walk_enter, [
824 #include <linux/rhashtable.h>
826 rhashtable_walk_enter(NULL, NULL);
828 AC_DEFINE(HAVE_RHASHTABLE_WALK_ENTER, 1,
829 [rhashtable_walk_enter() is available])
831 ]) # LIBCFS_RHASHTABLE_WALK_ENTER
834 # Kernel version 4.9 commit 768ae309a96103ed02eb1e111e838c87854d8b51
835 # mm: replace get_user_pages() write/force parameters with gup_flags
837 AC_DEFUN([LIBCFS_GET_USER_PAGES_GUP_FLAGS], [
838 LB_CHECK_COMPILE([if 'get_user_pages()' takes gup_flags in arguments],
839 get_user_pages_gup_flags, [
840 #include <linux/mm.h>
843 rc = get_user_pages(0, 0, FOLL_WRITE, NULL, NULL);
845 AC_DEFINE(HAVE_GET_USER_PAGES_GUP_FLAGS, 1,
846 [get_user_pages takes gup_flags in arguments])
848 ]) # LIBCFS_GET_USER_PAGES_GUP_FLAGS
851 # Kernel version 4.10 commit 7b737965b33188bd3dbb44e938535c4006d97fbb
852 # libcfs: Convert to hotplug state machine
854 AC_DEFUN([LIBCFS_HOTPLUG_STATE_MACHINE], [
855 LB_CHECK_COMPILE([if libcfs supports CPU hotplug state machine],
856 cpu_hotplug_state_machine, [
857 #include <linux/cpuhotplug.h>
859 cpuhp_remove_state(CPUHP_LUSTRE_CFS_DEAD);
861 AC_DEFINE(HAVE_HOTPLUG_STATE_MACHINE, 1,
862 [hotplug state machine is supported])
864 ]) # LIBCFS_HOTPLUG_STATE_MACHINE
867 # Kernel version 4.10-rc3 commit f405df5de3170c00e5c54f8b7cf4766044a032ba
868 # introduced refcount_t which is atomic_t plus over flow guards.
870 AC_DEFUN([LIBCFS_REFCOUNT_T], [
871 tmp_flags="$EXTRA_KCFLAGS"
872 EXTRA_KCFLAGS="-Werror"
873 LB_CHECK_LINUX_HEADER([linux/refcount.h], [
874 AC_DEFINE(HAVE_REFCOUNT_T, 1,
875 [refcount_t is supported])
877 EXTRA_KCFLAGS="$tmp_flags"
878 ]) # LIBCFS_REFCOUNT_T
881 # Kernel version 4.12 commit 499118e966f1d2150bd66647c8932343c4e9a0b8
882 # introduce memalloc_noreclaim_{save,restore}
884 AC_DEFUN([LIBCFS_MEMALLOC_NORECLAIM], [
885 LB_CHECK_COMPILE([if memalloc_noreclaim_{save,restore} exist],
886 memalloc_noreclaim, [
887 #include <linux/sched/mm.h>
889 int flag = memalloc_noreclaim_save();
890 memalloc_noreclaim_restore(flag);
892 AC_DEFINE(HAVE_MEMALLOC_RECLAIM, 1,
893 [memalloc_noreclaim_{save,restore}() is supported])
895 ]) # LIBCFS_MEMALLOC_NORECLAIM
898 # LIBCFS_SCHED_HEADERS
900 # 4.11 has broken up sched.h into more headers.
902 AC_DEFUN([LIBCFS_SCHED_HEADERS], [
903 LB_CHECK_LINUX_HEADER([linux/sched/signal.h], [
904 AC_DEFINE(HAVE_SCHED_HEADERS, 1,
905 [linux/sched header directory exist])])
906 ]) # LIBCFS_SCHED_HEADERS
909 # Kernel version 4.11-rc1 commit 2c935bc57221cc2edc787c72ea0e2d30cdcd3d5e
910 # introduce kref_read
912 AC_DEFUN([LIBCFS_KREF_READ], [
913 LB_CHECK_COMPILE([if 'kref_read' exists],
915 #include <linux/kref.h>
919 AC_DEFINE(HAVE_KREF_READ, 1,
920 [kref_read() is available])
922 ]) # LIBCFS_KREF_READ
925 # Kernel version 4.11-rc1 commit da20420f83ea0fbcf3d03afda08d971ea1d8a356
926 # introduced rht_bucket_var
928 AC_DEFUN([LIBCFS_RHT_BUCKET_VAR], [
929 LB_CHECK_COMPILE([if 'rht_bucket_var' exists],
931 #include <linux/rhashtable.h>
934 rht_bucket_var(NULL, 0);
936 AC_DEFINE(HAVE_RHT_BUCKET_VAR, 1,
937 [rht_bucket_var() is available])
939 ]) # LIBCFS_RHT_BUCKET_VAR
942 # Kernel version 4.11-rc5 commit fceb6435e85298f747fee938415057af837f5a8a
943 # began the enhanchement of Netlink with extended ACK struct for advanced
944 # error handling. By commit 7ab606d1609dd6dfeae9c8ad0a8a4e051d831e46 we
945 # had full support for this new feature.
947 AC_DEFUN([LIBCFS_NL_EXT_ACK], [
948 LB_CHECK_COMPILE([if Netlink supports netlink_ext_ack],
950 #include <net/genetlink.h>
952 struct genl_info info;
956 AC_DEFINE(HAVE_NL_PARSE_WITH_EXT_ACK, 1,
957 [netlink_ext_ack is an argument to nla_parse type function])
959 ]) # LIBCFS_NL_EXT_ACK
962 # Kernel version 4.11 commit f9fe1c12d126f9887441fa5bb165046f30ddd4b5
963 # introduced rhashtable_lookup_get_insert_fast
965 AC_DEFUN([LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST], [
966 LB_CHECK_COMPILE([if 'rhashtable_lookup_get_insert_fast' exist],
967 rhashtable_lookup_get_insert_fast, [
968 #include <linux/rhashtable.h>
970 const struct rhashtable_params params = { 0 };
973 ret = rhashtable_lookup_get_insert_fast(NULL, NULL, params);
975 AC_DEFINE(HAVE_RHASHTABLE_LOOKUP_GET_INSERT_FAST, 1,
976 [rhashtable_lookup_get_insert_fast() is available])
978 ]) # LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST
981 # Kernel version 4.12-rc2 8f553c498e1772cccb39a114da4a498d22992758
982 # provide proper CPU hotplug locking
984 AC_DEFUN([LIBCFS_CPUS_READ_LOCK], [
985 LB_CHECK_COMPILE([if 'cpus_read_[un]lock' exist],
987 #include <linux/cpu.h>
992 AC_DEFINE(HAVE_CPUS_READ_LOCK, 1, ['cpus_read_lock' exist])
994 ]) # LIBCFS_CPUS_READ_LOCK
997 # Kernel version 4.12-rc3 f9727a17db9bab71ddae91f74f11a8a2f9a0ece6
998 # renamed uuid_be to uuid_t
1000 AC_DEFUN([LIBCFS_UUID_T], [
1001 LB_CHECK_COMPILE([if 'uuid_t' exist],
1003 #include <linux/uuid.h>
1007 memset(uuid.b, 0, 16);
1009 AC_DEFINE(HAVE_UUID_T, 1, ['uuid_t' exist])
1014 # Kernel version 4.12-rc3 commit fd851a3cdc196bfc1d229b5f22369069af532bf8
1015 # introduce processor.h
1017 AC_DEFUN([LIBCFS_HAVE_PROCESSOR_HEADER], [
1018 tmp_flags="$EXTRA_KCFLAGS"
1019 EXTRA_KCFLAGS="-Werror"
1020 LB_CHECK_LINUX_HEADER([linux/processor.h], [
1021 AC_DEFINE(HAVE_PROCESSOR_H, 1,
1022 [processor.h is present])
1024 EXTRA_KCFLAGS="$tmp_flags"
1025 ]) # LIBCFS_HAVE_PROCESSOR_HEADER
1028 # Kernel verison 4.12-rc6 commit 5dd43ce2f69d42a71dcacdb13d17d8c0ac1fe8f7
1029 # created wait_bit.h
1031 AC_DEFUN([LIBCFS_HAVE_WAIT_BIT_HEADER], [
1032 LB_CHECK_LINUX_HEADER([linux/wait_bit.h], [
1033 AC_DEFINE(HAVE_WAIT_BIT_HEADER_H, 1,
1034 [wait_bit.h is present])])
1035 ]) # LIBCFS_HAVE_WAIT_BIT_HEADER
1038 # Kernel version 4.12-rc6 commmit 2055da97389a605c8a00d163d40903afbe413921
1040 # struct wait_queue_head::task_list => ::head
1041 # struct wait_queue_entry::task_list => ::entry
1043 AC_DEFUN([LIBCFS_WAIT_QUEUE_TASK_LIST_RENAME], [
1044 LB_CHECK_COMPILE([if linux wait_queue_head list_head is named head],
1045 wait_queue_task_list, [
1046 #include <linux/wait.h>
1048 wait_queue_head_t e;
1050 INIT_LIST_HEAD(&e.head);
1052 AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY_LIST, 1,
1053 [linux wait_queue_head_t list_head is name head])
1055 ]) # LIBCFS_WAIT_QUEUE_TASK_LIST_RENAME
1058 # LIBCFS_WAIT_BIT_QUEUE_ENTRY_EXISTS
1060 # Kernel version v4.12-rc6-23-g76c85ddc4695
1061 # sched/wait: Standardize wait_bit_queue naming
1063 # renamed struct wait_bit_queue => wait_bit_queue_entry
1065 AC_DEFUN([LIBCFS_WAIT_BIT_QUEUE_ENTRY_EXISTS], [
1066 LB_CHECK_COMPILE([if struct wait_bit_queue_entry exists],
1067 struct_wait_bit_queue_entry_exists, [
1068 #include <linux/wait.h>
1069 #if HAVE_WAIT_BIT_HEADER_H
1070 #include <linux/wait_bit.h>
1073 struct wait_bit_queue_entry entry;
1074 memset(&entry, 0, sizeof(entry));
1076 AC_DEFINE(HAVE_WAIT_BIT_QUEUE_ENTRY, 1,
1077 [if struct wait_bit_queue_entry exists])
1079 ]) # LIBCFS_WAIT_BIT_QUEUE_ENTRY_EXISTS
1084 # Kernel version 4.13-rc1 commit 2cf0c8b3e6942ecafe6ebb1a6d0328a81641bf39
1085 # created nla_strdup(). This is needed since push strings can be
1088 AC_DEFUN([LIBCFS_NLA_STRDUP], [
1089 LB_CHECK_COMPILE([if 'nla_strdup()' exists],
1091 #include <net/netlink.h>
1093 char *tmp = nla_strdup(NULL, GFP_KERNEL);
1095 AC_DEFINE(HAVE_NLA_STRDUP, 1,
1096 ['nla_strdup' is available])
1098 ]) # LIBCFS_NLA_STRDUP
1101 # LIBCFS_WAIT_QUEUE_ENTRY
1103 # Kernel version 4.13 ac6424b981bce1c4bc55675c6ce11bfe1bbfa64f
1104 # Rename wait_queue_t => wait_queue_entry_t
1106 AC_DEFUN([LIBCFS_WAIT_QUEUE_ENTRY], [
1107 LB_CHECK_COMPILE([if 'wait_queue_entry_t' exists],
1109 #include <linux/wait.h>
1111 wait_queue_entry_t e;
1115 AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY, 1,
1116 ['wait_queue_entry_t' is available])
1118 ]) # LIBCFS_WAIT_QUEUE_ENTRY
1121 # LIBCFS_NEW_KERNEL_WRITE
1123 # Kernel version 4.14 e13ec939e96b13e664bb6cee361cc976a0ee621a
1124 # changed kernel_write prototype to make is plug compatible
1125 # with the unexported vfs_write()
1127 AC_DEFUN([LIBCFS_NEW_KERNEL_WRITE], [
1128 tmp_flags="$EXTRA_KCFLAGS"
1129 EXTRA_KCFLAGS="-Werror"
1130 LB_CHECK_COMPILE([if 'kernel_write' matches other read/write helpers],
1131 kernel_write_match, [
1132 #include <linux/fs.h>
1134 const void *buf = NULL;
1136 return kernel_write(NULL, buf, 0, &pos);
1138 AC_DEFINE(HAVE_NEW_KERNEL_WRITE, 1,
1139 ['kernel_write' aligns with read/write helpers])
1141 EXTRA_KCFLAGS="$tmp_flags"
1142 ]) # LIBCFS_NEW_KERNEL_WRITE
1145 # LIBCFS_MM_TOTALRAM_PAGES_FUNC
1147 # kernel 5.0 commit ca79b0c211af63fa3276f0e3fd7dd9ada2439839
1148 # mm: convert totalram_pages and totalhigh_pages variables to atomic
1150 AC_DEFUN([LIBCFS_MM_TOTALRAM_PAGES_FUNC], [
1151 tmp_flags="$EXTRA_KCFLAGS"
1152 EXTRA_KCFLAGS="-Werror"
1153 LB_CHECK_COMPILE([if totalram_pages is a function],
1155 #include <linux/mm.h>
1157 totalram_pages_inc();
1159 AC_DEFINE(HAVE_TOTALRAM_PAGES_AS_FUNC, 1,
1160 [if totalram_pages is a function])
1162 EXTRA_KCFLAGS="$tmp_flags"
1163 ]) # LIBCFS_MM_TOTALRAM_PAGES_FUNC
1166 # LIBCFS_NEW_KERNEL_READ
1168 # 4.14 commit bdd1d2d3d251c65b74ac4493e08db18971c09240 changed
1169 # the signature of kernel_read to match other read/write helpers
1170 # and place offset last.
1172 AC_DEFUN([LIBCFS_NEW_KERNEL_READ], [
1173 tmp_flags="$EXTRA_KCFLAGS"
1174 EXTRA_KCFLAGS="-Werror"
1175 LB_CHECK_COMPILE([if 'kernel_read()' has loff_t *pos as last parameter],
1177 #include <linux/fs.h>
1180 kernel_read(NULL, NULL, 0, &pos);
1182 AC_DEFINE(HAVE_KERNEL_READ_LAST_POSP, 1,
1183 [kernel_read() signature ends with loff_t *pos])
1185 EXTRA_KCFLAGS="$tmp_flags"
1186 ]) # LIBCFS_NEW_KERNEL_READ
1189 # LIBCFS_DEFINE_TIMER
1191 # Kernel version 4.14 commit 1d27e3e2252ba9d949ca82fbdb73cde102cb2067
1192 # remove expires and data arguments from DEFINE_TIMER. Also the callback
1193 # when from using unsigned long argument to using struct timer_list pointer.
1195 AC_DEFUN([LIBCFS_DEFINE_TIMER], [
1196 LB_CHECK_COMPILE([if DEFINE_TIMER takes only 2 arguments],
1198 #include <linux/timer.h>
1200 static DEFINE_TIMER(my_timer, NULL);
1202 AC_DEFINE(HAVE_NEW_DEFINE_TIMER, 1,
1203 [DEFINE_TIMER uses only 2 arguements])
1205 ]) # LIBCFS_DEFINE_TIMER
1208 # LIBCFS_EXPORT_SAVE_STACK_TRACE_TSK
1210 # Kernel 2.6.27 commit 8594698ebddeef5443b7da8258ae33b3eaca61d5
1211 # exported save_stack_trace_tsk for x86.
1212 # Kernel 2.6.27 commit 01f4b8b8b8db09b88be7df7e51192e4e678b69d3
1213 # exported save_stack_trace_tsk for powerpc
1214 # Kernel 4.13 commit e27c7fa015d61c8be6a2c32b2144aad2ae6ec975
1215 # exported save_stack_trace_tsk for arm64
1216 # Kernel 4.14 commit 9a3dc3186fc3795e076a4122da9e0258651a9631
1217 # exported save_stack_trace_tsk for arm
1219 AC_DEFUN([LIBCFS_EXPORT_SAVE_STACK_TRACE_TSK], [
1220 LB_CHECK_EXPORT([save_stack_trace_tsk], [arch/$SUBARCH/kernel/stacktrace.c],
1221 [AC_DEFINE(HAVE_SAVE_STACK_TRACE_TSK, 1,
1222 [save_stack_trace_tsk is exported])])
1223 ]) # LIBCFS_EXPORT_SAVE_STACK_TRACE_TSK
1226 # LIBCFS_LOCKDEP_IS_HELD
1228 # Kernel v4.15-rc8-106-g08f36ff64234
1229 # lockdep: Make lockdep checking constant
1231 AC_DEFUN([LIBCFS_LOCKDEP_IS_HELD], [
1232 tmp_flags="$EXTRA_KCFLAGS"
1233 EXTRA_KCFLAGS="-Werror"
1234 LB_CHECK_COMPILE([if 'lockdep_is_held()' uses const argument],
1236 #include <linux/lockdep.h>
1238 #ifdef CONFIG_LOCKDEP
1239 const struct spinlock *lock = NULL;
1241 lockdep_is_held(lock);
1244 AC_DEFINE(NEED_LOCKDEP_IS_HELD_DISCARD_CONST, 1,
1245 [lockdep_is_held() argument is const])
1247 EXTRA_KCFLAGS="$tmp_flags"
1248 ]) # LIBCFS_LOCKDEP_IS_HELD
1251 # LIBCFS_TIMER_SETUP
1253 # Kernel version 4.15 commit e99e88a9d2b067465adaa9c111ada99a041bef9a
1254 # setup_timer() was replaced by timer_setup(), where the callback
1255 # argument is the structure already holding the struct timer_list.
1257 AC_DEFUN([LIBCFS_TIMER_SETUP], [
1258 LB_CHECK_COMPILE([if setup_timer has been replaced with timer_setup],
1260 #include <linux/timer.h>
1262 timer_setup(NULL, NULL, 0);
1264 AC_DEFINE(HAVE_TIMER_SETUP, 1,
1265 [timer_setup has replaced setup_timer])
1267 ]) # LIBCFS_TIMER_SETUP
1270 # LIBCFS_WAIT_VAR_EVENT
1272 # Kernel version 4.16-rc4 commit 6b2bb7265f0b62605e8caee3613449ed0db270b9
1273 # added wait_var_event()
1275 AC_DEFUN([LIBCFS_WAIT_VAR_EVENT], [
1276 LB_CHECK_COMPILE([if 'wait_var_event' exist],
1278 #ifdef HAVE_WAIT_BIT_HEADER_H
1279 #include <linux/wait_bit.h>
1281 #include <linux/wait.h>
1285 AC_DEFINE(HAVE_WAIT_VAR_EVENT, 1,
1286 ['wait_var_event' is available])
1288 ]) # LIBCFS_WAIT_VAR_EVENT
1291 # LIBCFS_BITMAP_ALLOC
1293 # Kernel version 4.17 commit c42b65e363ce97a828f81b59033c3558f8fa7f70
1294 # added bitmap memory allocation handling.
1296 AC_DEFUN([LIBCFS_BITMAP_ALLOC], [
1297 LB_CHECK_COMPILE([if Linux bitmap memory management exist],
1299 #include <linux/bitmap.h>
1301 unsigned long *map = bitmap_alloc(1, GFP_KERNEL);
1303 AC_DEFINE(HAVE_BITMAP_ALLOC, 1,
1304 [Linux bitmap can be allocated])
1306 ]) # LIBCFS_BITMAP_ALLOC
1309 # LIBCFS_CLEAR_AND_WAKE_UP_BIT
1311 # Kernel version 4.17-rc2 commit 8236b0ae31c837d2b3a2565c5f8d77f637e824cc
1312 # added clear_and_wake_up_bit()
1314 AC_DEFUN([LIBCFS_CLEAR_AND_WAKE_UP_BIT], [
1315 LB_CHECK_COMPILE([if 'clear_and_wake_up_bit' exist],
1316 clear_and_wake_up_bit, [
1317 #ifdef HAVE_WAIT_BIT_HEADER_H
1318 #include <linux/wait_bit.h>
1320 #include <linux/wait.h>
1322 clear_and_wake_up_bit(0, NULL);
1324 AC_DEFINE(HAVE_CLEAR_AND_WAKE_UP_BIT, 1,
1325 ['clear_and_wake_up_bit' is available])
1327 ]) # LIBCFS_CLEAR_AND_WAKE_UP_BIT
1330 # LIBCFS_TCP_SOCK_SET_NODELAY
1332 # kernel 4.18.0-293.el8
1333 # tcp_sock_set_nodelay() was added
1334 AC_DEFUN([LIBCFS_TCP_SOCK_SET_NODELAY], [
1335 tmp_flags="$EXTRA_KCFLAGS"
1336 EXTRA_KCFLAGS="-Werror"
1337 LB_CHECK_COMPILE([if 'tcp_sock_set_nodelay()' exists],
1338 tcp_sock_set_nodelay_exists, [
1339 #include <linux/tcp.h>
1341 tcp_sock_set_nodelay(NULL);
1343 AC_DEFINE(HAVE_TCP_SOCK_SET_NODELAY, 1,
1344 ['tcp_sock_set_nodelay()' exists])
1346 EXTRA_KCFLAGS="$tmp_flags"
1347 ]) # LIBCFS_TCP_SOCK_SET_NODELAY
1350 # LIBCFS_TCP_SOCK_SET_KEEPIDLE
1352 # kernel 4.18.0-293.el8
1353 # tcp_sock_set_keepidle() was added
1354 AC_DEFUN([LIBCFS_TCP_SOCK_SET_KEEPIDLE], [
1355 tmp_flags="$EXTRA_KCFLAGS"
1356 EXTRA_KCFLAGS="-Werror"
1357 LB_CHECK_COMPILE([if 'tcp_sock_set_keepidle()' exists],
1358 tcp_sock_set_keepidle_exists, [
1359 #include <linux/tcp.h>
1361 tcp_sock_set_keepidle(NULL, 0);
1363 AC_DEFINE(HAVE_TCP_SOCK_SET_KEEPIDLE, 1,
1364 ['tcp_sock_set_keepidle()' exists])
1366 EXTRA_KCFLAGS="$tmp_flags"
1367 ]) # LIBCFS_TCP_SOCK_SET_KEEPIDLE
1370 # LIBCFS_TCP_SOCK_SET_QUICKACK
1371 # kernel v5.7-rc6-2504-gddd061b8daed
1372 # tcp: add tcp_sock_set_quickack
1374 AC_DEFUN([LIBCFS_TCP_SOCK_SET_QUICKACK], [
1375 tmp_flags="$EXTRA_KCFLAGS"
1376 EXTRA_KCFLAGS="-Werror"
1377 LB_CHECK_COMPILE([if 'tcp_sock_set_quickack()' exists],
1378 tcp_sock_set_quickack_exists, [
1379 #include <linux/tcp.h>
1381 tcp_sock_set_quickack(NULL, 0);
1383 AC_DEFINE(HAVE_TCP_SOCK_SET_QUICKACK, 1,
1384 ['tcp_sock_set_quickack()' exists])
1386 EXTRA_KCFLAGS="$tmp_flags"
1387 ]) # LIBCFS_TCP_SOCK_SET_QUICKACK
1390 # LIBCFS_TCP_SOCK_SET_KEEPINTVL
1391 # v5.7-rc6-2508-gd41ecaac903c
1392 # tcp: add tcp_sock_set_keepintvl
1394 AC_DEFUN([LIBCFS_TCP_SOCK_SET_KEEPINTVL], [
1395 tmp_flags="$EXTRA_KCFLAGS"
1396 EXTRA_KCFLAGS="-Werror"
1397 LB_CHECK_COMPILE([if 'tcp_sock_set_keepintvl()' exists],
1398 tcp_sock_set_keepintvl_exists, [
1399 #include <linux/tcp.h>
1401 tcp_sock_set_keepintvl(NULL, 0);
1403 AC_DEFINE(HAVE_TCP_SOCK_SET_KEEPINTVL, 1,
1404 ['tcp_sock_set_keepintvl()' exists])
1406 EXTRA_KCFLAGS="$tmp_flags"
1407 ]) # LIBCFS_TCP_SOCK_SET_KEEPINTVL
1410 # LIBCFS_TCP_SOCK_SET_KEEPCNT
1411 # v5.7-rc6-2509-g480aeb9639d6
1412 # tcp: add tcp_sock_set_keepcnt
1414 AC_DEFUN([LIBCFS_TCP_SOCK_SET_KEEPCNT], [
1415 tmp_flags="$EXTRA_KCFLAGS"
1416 EXTRA_KCFLAGS="-Werror"
1417 LB_CHECK_COMPILE([if 'tcp_sock_set_keepcnt()' exists],
1418 tcp_sock_set_keepcnt_exists, [
1419 #include <linux/tcp.h>
1421 tcp_sock_set_keepcnt(NULL, 0);
1423 AC_DEFINE(HAVE_TCP_SOCK_SET_KEEPCNT, 1,
1424 ['tcp_sock_set_keepcnt()' exists])
1426 EXTRA_KCFLAGS="$tmp_flags"
1427 ]) # LIBCFS_TCP_SOCK_SET_KEEPCNT
1430 # LIBCFS_XARRAY_SUPPORT
1432 # 4.19-rc5 kernel commit 3159f943aafdbacb2f94c38fdaadabf2bbde2a14
1433 # replaced the radix tree implementation with Xarrays. This change
1434 # introduced functionaly needed for general Xarray support
1436 AC_DEFUN([LIBCFS_XARRAY_SUPPORT], [
1437 tmp_flags="$EXTRA_KCFLAGS"
1438 EXTRA_KCFLAGS="-Werror"
1439 LB_CHECK_COMPILE([if page cache uses Xarray],
1441 #include <linux/xarray.h>
1445 AC_DEFINE(HAVE_XARRAY_SUPPORT, 1,
1446 [kernel Xarray implementation lacks 'xa_is_value'])
1448 EXTRA_KCFLAGS="$tmp_flags"
1449 ]) # LIBCFS_XARRAY_SUPPORT
1452 # Kernel version 4.19-rc6 commit 4a19edb60d0203cd5bf95a8b46ea8f63fd41194c
1453 # added extended ACK handling to Netlink dump handlers
1455 AC_DEFUN([LIBCFS_NL_DUMP_EXT_ACK], [
1456 LB_CHECK_COMPILE([if Netlink dump handlers support ext_ack],
1457 netlink_dump_ext_ack, [
1458 #include <net/netlink.h>
1460 struct netlink_callback *cb = NULL;
1463 AC_DEFINE(HAVE_NL_DUMP_WITH_EXT_ACK, 1,
1464 [netlink_ext_ack is handled for Netlink dump handlers])
1466 ]) # LIBCFS_NL_DUMP_EXT_ACK
1469 # LIBCFS_HAVE_IOV_ITER_TYPE
1471 # kernel 4.20 commit 00e23707442a75b404392cef1405ab4fd498de6b
1472 # iov_iter: Use accessor functions to access an iterator's type and direction.
1474 AC_DEFUN([LIBCFS_HAVE_IOV_ITER_TYPE], [
1475 tmp_flags="$EXTRA_KCFLAGS"
1476 EXTRA_KCFLAGS="-Werror"
1477 LB_CHECK_COMPILE([if iov_iter_type exists],
1478 macro_iov_iter_type_exists, [
1479 #include <linux/uio.h>
1481 struct iov_iter iter = { };
1482 enum iter_type type = iov_iter_type(&iter);
1485 AC_DEFINE(HAVE_IOV_ITER_TYPE, 1,
1486 [if iov_iter_type exists])
1488 EXTRA_KCFLAGS="$tmp_flags"
1489 ]) # LIBCFS_HAVE_IOV_ITER_TYPE
1492 # LIBCFS_GET_REQUEST_KEY_AUTH
1494 # kernel 5.0 commit 822ad64d7e46a8e2c8b8a796738d7b657cbb146d
1495 # keys: Fix dependency loop between construction record and auth key
1497 # Added <keys/request_key_auth-type.h> and get_request_key_auth()
1498 # which was propagated to stable
1500 AC_DEFUN([LIBCFS_GET_REQUEST_KEY_AUTH], [
1501 tmp_flags="$EXTRA_KCFLAGS"
1502 EXTRA_KCFLAGS="-Werror"
1503 LB_CHECK_COMPILE([if get_request_key_auth() is available],
1504 get_request_key_auth_exported, [
1505 #include <linux/key.h>
1506 #include <linux/keyctl.h>
1507 #include <keys/request_key_auth-type.h>
1510 const struct key *key = NULL;
1511 struct request_key_auth *rka = get_request_key_auth(key);
1513 ring = key_get(rka->dest_keyring);
1515 AC_DEFINE(HAVE_GET_REQUEST_KEY_AUTH, 1,
1516 [get_request_key_auth() is available])
1518 EXTRA_KCFLAGS="$tmp_flags"
1519 ]) # LIBCFS_GET_REQUEST_KEY_AUTH
1522 # LIBCFS_LOOKUP_USER_KEY
1524 # kernel 5.3 commit 3cf5d076fb4d48979f382bc9452765bf8b79e740
1525 # signal: Remove task parameter from force_sig
1527 AC_DEFUN([LIBCFS_LOOKUP_USER_KEY], [
1528 tmp_flags="$EXTRA_KCFLAGS"
1529 EXTRA_KCFLAGS="-Werror"
1530 LB_CHECK_COMPILE([if lookup_user_key() is available],
1531 lookup_user_key_exported, [
1532 #include <linux/key.h>
1533 #include <linux/keyctl.h>
1535 lookup_user_key(KEY_SPEC_USER_KEYRING, 0, 0);
1537 AC_DEFINE(HAVE_LOOKUP_USER_KEY, 1,
1538 [lookup_user_key() is available])
1540 EXTRA_KCFLAGS="$tmp_flags"
1541 ]) # LIBCFS_LOOKUP_USER_KEY
1544 # LIBCFS_FORCE_SIG_WITH_TASK
1546 # kernel 5.3 commit 3cf5d076fb4d48979f382bc9452765bf8b79e740
1547 # signal: Remove task parameter from force_sig
1549 AC_DEFUN([LIBCFS_FORCE_SIG_WITH_TASK], [
1550 tmp_flags="$EXTRA_KCFLAGS"
1551 EXTRA_KCFLAGS="-Werror"
1552 LB_CHECK_COMPILE([if force_sig has task parameter],
1553 force_sig_with_task, [
1554 #include <linux/sched/signal.h>
1556 force_sig(SIGINT, NULL);
1558 AC_DEFINE(HAVE_FORCE_SIG_WITH_TASK, 1,
1559 [force_sig() has task parameter])
1561 EXTRA_KCFLAGS="$tmp_flags"
1562 ]) # LIBCFS_FORCE_SIG_WITH_TASK
1565 # LIBCFS_CACHE_DETAIL_WRITERS
1567 # kernel v5.3-rc2-1-g64a38e840ce5
1568 # SUNRPC: Track writers of the 'channel' file to improve cache_listeners_exist
1570 AC_DEFUN([LIBCFS_CACHE_DETAIL_WRITERS], [
1571 tmp_flags="$EXTRA_KCFLAGS"
1572 EXTRA_KCFLAGS="-Werror"
1573 LB_CHECK_COMPILE([if struct cache_detail has writers],
1574 cache_detail_writers_atomic, [
1575 #include <linux/sunrpc/cache.h>
1577 static struct cache_detail rsi_cache;
1579 atomic_set(&rsi_cache.writers, 0);
1581 AC_DEFINE(HAVE_CACHE_DETAIL_WRITERS, 1,
1582 [struct cache_detail has writers])
1584 EXTRA_KCFLAGS="$tmp_flags"
1585 ]) # LIBCFS_CACHE_DETAIL_WRITERS
1588 # LIBCFS_GENL_DUMPIT_INFO
1590 # kernel v5.4-rc1 commit bf813b0afeae2f012f0e527a526c1b78ca21ad82
1591 # expanded struct genl_dumpit_info to include struct genl_family.
1593 AC_DEFUN([LIBCFS_GENL_DUMPIT_INFO], [
1594 tmp_flags="$EXTRA_KCFLAGS"
1595 EXTRA_KCFLAGS="-Werror"
1596 LB_CHECK_COMPILE([if struct genl_dumpit_info has family field],
1598 #include <net/genetlink.h>
1600 static struct genl_dumpit_info info;
1604 AC_DEFINE(HAVE_GENL_DUMPIT_INFO, 1,
1605 [struct genl_dumpit_info has family field])
1607 EXTRA_KCFLAGS="$tmp_flags"
1608 ]) # LIBCFS_GENL_DUMPIT_INFO
1611 # LIBCFS_KALLSYMS_LOOKUP
1613 # kernel v5.6-11591-g0bd476e6c671
1614 # kallsyms: unexport kallsyms_lookup_name() and kallsyms_on_each_symbol()
1615 AC_DEFUN([LIBCFS_KALLSYMS_LOOKUP], [
1616 LB_CHECK_EXPORT([kallsyms_lookup_name], [kernel/kallsyms.c],
1617 [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
1618 [kallsyms_lookup_name is exported by kernel])])
1619 ]) # LIBCFS_KALLSYMS_LOOKUP
1622 # v5.5-8862-gd56c0d45f0e2
1623 # proc: decouple proc from VFS with "struct proc_ops"
1625 AC_DEFUN([LIBCFS_SRC_HAVE_PROC_OPS], [
1626 LB2_LINUX_TEST_SRC([proc_ops], [
1627 #include <linux/proc_fs.h>
1629 static struct proc_ops *my_proc;
1631 my_proc->proc_lseek = NULL;
1633 ]) # LIBCFS_SRC_HAVE_PROC_OPS
1634 AC_DEFUN([LIBCFS_HAVE_PROC_OPS], [
1635 AC_MSG_CHECKING([if struct proc_ops exists])
1636 LB2_LINUX_TEST_RESULT([proc_ops], [
1637 AC_DEFINE(HAVE_PROC_OPS, 1,
1638 [struct proc_ops exists])
1643 ]) # LIBCFS_HAVE_PROC_OPS
1646 # LIBCFS_VMALLOC_2ARGS
1648 # kernel v5.8-rc1~201^2~19
1649 # mm: remove the pgprot argument to __vmalloc
1650 AC_DEFUN([LIBCFS_VMALLOC_2ARGS], [
1651 LB_CHECK_COMPILE([if __vmalloc has 2 args],
1653 #include <linux/vmalloc.h>
1657 AC_DEFINE(HAVE_VMALLOC_2ARGS, 1,
1658 [__vmalloc only takes 2 args.])
1660 ]) # LIBCFS_VMALLOC_2ARGS
1663 # LIBCFS_HAVE_NR_UNSTABLE_NFS
1665 # kernel v5.8-rc1~201^2~75
1666 # mm/writeback: discard NR_UNSTABLE_NFS, use NR_WRITEBACK instead
1668 AC_DEFUN([LIBCFS_HAVE_NR_UNSTABLE_NFS], [
1669 tmp_flags="$EXTRA_KCFLAGS"
1670 EXTRA_KCFLAGS="-Werror"
1671 LB_CHECK_COMPILE([if NR_UNSTABLE_NFS still in use],
1672 nr_unstable_nfs_exists, [
1673 #include <linux/mm.h>
1677 i = NR_UNSTABLE_NFS;
1679 AC_DEFINE(HAVE_NR_UNSTABLE_NFS, 1,
1680 [NR_UNSTABLE_NFS is still in use.])
1682 EXTRA_KCFLAGS="$tmp_flags"
1683 ]) # LIBCFS_HAVE_NR_UNSTABLE_NFS
1686 # LIBCFS_HAVE_MMAP_LOCK
1688 # kernel v5.8-rc1~83^2~24
1689 # mmap locking API: rename mmap_sem to mmap_lock
1691 AC_DEFUN([LIBCFS_HAVE_MMAP_LOCK], [
1692 LB_CHECK_COMPILE([if mmap_lock API is available],
1694 #include <linux/mm.h>
1696 mmap_write_lock(NULL);
1698 AC_DEFINE(HAVE_MMAP_LOCK, 1,
1699 [mmap_lock API is available.])
1701 ]) # LIBCFS_HAVE_MMAP_LOCK
1704 # LIBCFS_KERNEL_SETSOCKOPT
1706 # kernel v5.8-rc1~165^2~59^2
1707 # net: remove kernel_setsockopt
1708 AC_DEFUN([LIBCFS_KERNEL_SETSOCKOPT], [
1709 tmp_flags="$EXTRA_KCFLAGS"
1710 EXTRA_KCFLAGS="-Werror"
1711 LB_CHECK_COMPILE([if kernel_setsockopt still in use],
1712 kernel_setsockopt_exists, [
1713 #include <linux/net.h>
1715 kernel_setsockopt(NULL, 0, 0, NULL, 0);
1717 AC_DEFINE(HAVE_KERNEL_SETSOCKOPT, 1,
1718 [kernel_setsockopt still in use])
1720 EXTRA_KCFLAGS="$tmp_flags"
1721 ]) # LIBCFS_KERNEL_SETSOCKOPT
1724 # LIBCFS_SEC_RELEASE_SECCTX
1726 # kernel linux-hwe-5.8 (5.8.0-22.23~20.04.1)
1727 # LSM: Use lsmcontext in security_release_secctx
1728 AC_DEFUN([LIBCFS_SEC_RELEASE_SECCTX], [
1729 LB_CHECK_COMPILE([if security_release_secctx has 1 arg],
1730 security_release_secctx_1arg, [
1731 #include <linux/security.h>
1733 security_release_secctx(NULL);
1735 AC_DEFINE(HAVE_SEC_RELEASE_SECCTX_1ARG, 1,
1736 [security_release_secctx has 1 arg.])
1738 ]) # LIBCFS_SEC_RELEASE_SECCTX
1741 # LIBCFS_HAVE_KFREE_SENSITIVE
1743 # kernel v5.10-rc1~3
1744 # mm: remove kzfree() compatibility definition
1746 AC_DEFUN([LIBCFS_HAVE_KFREE_SENSITIVE], [
1747 LB_CHECK_COMPILE([if kfree_sensitive() is available],
1748 kfree_sensitive_exists, [
1749 #include <linux/slab.h>
1752 kfree_sensitive(NULL);
1754 AC_DEFINE(HAVE_KFREE_SENSITIVE, 1,
1755 [kfree_sensitive() is available.])
1757 EXTRA_KCFLAGS="$tmp_flags"
1758 ]) # LIBCFS_HAVE_KFREE_SENSITIVE
1761 # LIBCFS_HAVE_CRYPTO_SHA2_HEADER
1763 # Kernel v5.10-rc1-114-ga24d22b225ce
1764 # crypto: sha - split sha.h into sha1.h and sha2.h
1766 AC_DEFUN([LIBCFS_HAVE_CRYPTO_SHA2_HEADER], [
1767 LB_CHECK_LINUX_HEADER([crypto/sha2.h], [
1768 AC_DEFINE(HAVE_CRYPTO_SHA2_HEADER, 1,
1769 [crypto/sha2.h is present])])
1770 ]) # LIBCFS_HAVE_CRYPTO_SHA2_HEADER
1773 # LIBCFS_HAVE_LIST_CMP_FUNC_T
1775 # kernel 5.10.70 commit 4f0f586bf0c898233d8f316f471a21db2abd522d
1776 # treewide: Change list_sort to use const pointers
1777 AC_DEFUN([LIBCFS_HAVE_LIST_CMP_FUNC_T], [
1778 tmp_flags="$EXTRA_KCFLAGS"
1779 EXTRA_KCFLAGS="-Werror -Wno-unused-variable"
1780 LB_CHECK_COMPILE([if list_cmp_func_t type is defined],
1782 #include <linux/list_sort.h>
1784 list_cmp_func_t cmp;
1786 AC_DEFINE(HAVE_LIST_CMP_FUNC_T, 1,
1787 [list_cmp_func_t type is defined])
1789 EXTRA_KCFLAGS="$tmp_flags"
1790 ]) # LIBCFS_HAVE_LIST_CMP_FUNC_T
1793 # LIBCFS_NLA_STRLCPY
1795 # Kernel version 5.10-rc3 commit 872f690341948b502c93318f806d821c56772c42
1796 # replaced nla_strlcpy() with nla_strscpy().
1798 AC_DEFUN([LIBCFS_NLA_STRLCPY], [
1799 LB_CHECK_COMPILE([if 'nla_strlcpy()' still exists],
1801 #include <net/netlink.h>
1803 if (nla_strlcpy(NULL, NULL, 0) == 0)
1806 AC_DEFINE(HAVE_NLA_STRLCPY, 1,
1807 ['nla_strlcpy' is available])
1809 ]) # LIBCFS_NLA_STRLCPY
1812 # LIBCFS_HAVE_CIPHER_HEADER
1814 # Kernel 5.12 commit 0eb76ba29d16df2951d37c54ca279c4e5630b071
1815 # crypto: remove cipher routines from public crypto API
1817 AC_DEFUN([LIBCFS_HAVE_CIPHER_HEADER], [
1818 tmp_flags="$EXTRA_KCFLAGS"
1819 EXTRA_KCFLAGS="-Werror"
1820 LB_CHECK_LINUX_HEADER([crypto/internal/cipher.h], [
1821 AC_DEFINE(HAVE_CIPHER_H, 1,
1822 [crypto/internal/cipher.h is present])
1824 EXTRA_KCFLAGS="$tmp_flags"
1825 ]) # LIBCFS_HAVE_CIPHER_HEADER
1828 # LIBCFS_HAVE_TASK_RUNNING
1830 # Kernel 5.13-rc6 commit b03fbd4ff24c5f075e58eb19261d5f8b3e40d
1831 # introduced task_is_running() macro.
1833 AC_DEFUN([LIBCFS_HAVE_TASK_IS_RUNNING], [
1834 tmp_flags="$EXTRA_KCFLAGS"
1835 EXTRA_KCFLAGS="-Werror"
1836 LB_CHECK_COMPILE([if task_is_running() is defined],
1838 #include <linux/sched.h>
1840 if (task_is_running(current))
1843 AC_DEFINE(HAVE_TASK_IS_RUNNING, 1,
1844 [task_is_running() is defined])
1846 EXTRA_KCFLAGS="$tmp_flags"
1847 ]) # LIBCFS_HAVE_TASK_IS_RUNNING
1850 # LIBCFS_LINUX_STDARG_HEADER
1852 # Kernel 5.14-rc5 commit c0891ac15f0428ffa81b2e818d416bdf3cb74ab6
1853 # isystem: ship and use stdarg.h
1855 AC_DEFUN([LIBCFS_LINUX_STDARG_HEADER], [
1856 tmp_flags="$EXTRA_KCFLAGS"
1857 EXTRA_KCFLAGS="-Werror"
1858 LB_CHECK_LINUX_HEADER([linux/stdarg.h], [
1859 AC_DEFINE(HAVE_LINUX_STDARG_HEADER, 1, [linux/stdarg.h is present])
1861 EXTRA_KCFLAGS="$tmp_flags"
1862 ]) # LIBCFS_LINUX_STDARG_HEADER
1865 # LIBCFS_HAVE_PANIC_NOTIFIER_HEADER
1867 # Kernel 5.14 commit f39650de687e35766572ac89dbcd16a5911e2f0a
1868 # kernel.h: split out panic and oops helpers
1870 AC_DEFUN([LIBCFS_HAVE_PANIC_NOTIFIER_HEADER], [
1871 tmp_flags="$EXTRA_KCFLAGS"
1872 EXTRA_KCFLAGS="-Werror"
1873 LB_CHECK_LINUX_HEADER([linux/panic_notifier.h], [
1874 AC_DEFINE(HAVE_PANIC_NOTIFIER_H, 1,
1875 [linux/panic_notifier.h is present])
1877 EXTRA_KCFLAGS="$tmp_flags"
1878 ]) # LIBCFS_HAVE_PANIC_NOTIFIER_HEADER
1881 # LIBCFS_PARAM_SET_UINT_MINMAX
1883 # Kernel 5.15-rc1 commit 2a14c9ae15a38148484a128b84bff7e9ffd90d68
1884 # moved param_set_uint_minmax to common code
1886 AC_DEFUN([LIBCFS_PARAM_SET_UINT_MINMAX],[
1887 LB_CHECK_COMPILE([does function 'param_set_uint_minmax' exist],
1888 param_set_uint_minmax, [
1889 #include <linux/moduleparam.h>
1891 param_set_uint_minmax(NULL, NULL, 0, 0);
1893 AC_DEFINE(HAVE_PARAM_SET_UINT_MINMAX, 1,
1894 ['param_set_uint_minmax' is available])
1896 ]) # LIBCFS_PARAM_SET_UINT_MINMAX
1898 AC_DEFUN([LIBCFS_PROG_LINUX_SRC], [
1900 LIBCFS_SRC_HAVE_PROC_OPS
1902 AC_MSG_CHECKING([for available kernel interfaces to libcfs])
1903 LB2_LINUX_TEST_COMPILE_ALL([libcfs])
1904 AC_MSG_RESULT([done])
1906 AC_DEFUN([LIBCFS_PROG_LINUX_RESULTS], [
1908 LIBCFS_HAVE_PROC_OPS
1912 # LIBCFS_LINUX_BLK_INTEGRITY_HEADER
1914 # Kernel 5.15-rc6 commit fe45e630a1035aea94c29016f2598bbde149bbe3
1915 # block: move integrity handling out of <linux/blkdev.h>
1917 AC_DEFUN([LIBCFS_LINUX_BLK_INTEGRITY_HEADER], [
1918 tmp_flags="$EXTRA_KCFLAGS"
1919 EXTRA_KCFLAGS="-Werror"
1920 LB_CHECK_LINUX_HEADER([linux/blk-integrity.h], [
1921 AC_DEFINE(HAVE_LINUX_BLK_INTEGRITY_HEADER, 1,
1922 [linux/blk-integrity.h is present])
1924 EXTRA_KCFLAGS="$tmp_flags"
1925 ]) # LIBCFS_LINUX_BLK_INTEGRITY_HEADER
1930 # LibCFS linux kernel checks
1932 AC_DEFUN([LIBCFS_PROG_LINUX], [
1933 AC_MSG_NOTICE([LibCFS kernel checks
1934 ==============================================================================])
1935 LIBCFS_CONFIG_PANIC_DUMPLOG
1938 LIBCFS_KTIME_GET_TS64
1940 LIBCFS_PREPARE_TO_WAIT_EVENT
1941 LIBCFS_KERNEL_PARAM_OPS
1945 LIBCFS_KTIME_COMPARE
1946 LIBCFS_SHRINKER_COUNT
1948 LIBCFS_MATCH_WILDCARD
1950 LIBCFS_HAVE_MAPPING_AS_EXITING_FLAG
1951 LIBCFS_IOV_ITER_HAS_TYPE
1954 LIBCFS_HAVE_NS_TO_TIMESPEC64
1956 LIBCFS_HLIST_ADD_AFTER
1959 LIBCFS_KTIME_GET_REAL_TS64
1960 LIBCFS_KTIME_GET_REAL_SECONDS
1961 LIBCFS_KTIME_GET_REAL_NS
1962 LIBCFS_KTIME_TO_TIMESPEC64
1963 LIBCFS_TIMESPEC64_SUB
1964 LIBCFS_TIMESPEC64_TO_KTIME
1966 LIBCFS_KTIME_GET_SECONDS
1969 LIBCFS_KTIME_MS_DELTA
1971 LIBCFS_KERNEL_PARAM_LOCK
1973 LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
1975 LIBCFS_KSTRTOBOOL_FROM_USER
1976 LIBCFS_NETLINK_CALLBACK_START
1978 LIBCFS_CRYPTO_HASH_HELPERS
1979 LIBCFS_EXPORT_KSET_FIND_OBJ
1980 LIBCFS_RHASHTABLE_REPLACE
1982 LIBCFS_BROKEN_HASH_64
1983 LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
1984 LIBCFS_GET_USER_PAGES_6ARG
1987 LIBCFS_RHASHTABLE_INSERT_FAST
1988 LIBCFS_RHASHTABLE_WALK_INIT_3ARG
1990 LIBCFS_RHASHTABLE_LOOKUP
1992 LIBCFS_STACKTRACE_OPS
1994 LIBCFS_GET_USER_PAGES_GUP_FLAGS
1995 LIBCFS_RHASHTABLE_WALK_ENTER
1997 LIBCFS_HOTPLUG_STATE_MACHINE
2000 LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST
2001 LIBCFS_SCHED_HEADERS
2003 LIBCFS_RHT_BUCKET_VAR
2005 LIBCFS_HAVE_PROCESSOR_HEADER
2006 LIBCFS_HAVE_WAIT_BIT_HEADER
2007 LIBCFS_MEMALLOC_NORECLAIM
2009 LIBCFS_WAIT_QUEUE_TASK_LIST_RENAME
2010 LIBCFS_CPUS_READ_LOCK
2014 LIBCFS_WAIT_QUEUE_ENTRY
2015 LIBCFS_WAIT_BIT_QUEUE_ENTRY_EXISTS
2018 LIBCFS_NEW_KERNEL_WRITE
2019 LIBCFS_NEW_KERNEL_READ
2020 LIBCFS_EXPORT_SAVE_STACK_TRACE_TSK
2022 LIBCFS_LOCKDEP_IS_HELD
2025 LIBCFS_WAIT_VAR_EVENT
2028 LIBCFS_CLEAR_AND_WAKE_UP_BIT
2030 LIBCFS_TCP_SOCK_SET_NODELAY
2031 LIBCFS_TCP_SOCK_SET_KEEPIDLE
2033 LIBCFS_XARRAY_SUPPORT
2034 LIBCFS_NL_DUMP_EXT_ACK
2036 LIBCFS_HAVE_IOV_ITER_TYPE
2038 LIBCFS_MM_TOTALRAM_PAGES_FUNC
2039 LIBCFS_GET_REQUEST_KEY_AUTH
2041 LIBCFS_LOOKUP_USER_KEY
2042 LIBCFS_FORCE_SIG_WITH_TASK
2043 LIBCFS_CACHE_DETAIL_WRITERS
2045 LIBCFS_GENL_DUMPIT_INFO
2047 LIBCFS_KALLSYMS_LOOKUP
2048 LIBCFS_TCP_SOCK_SET_QUICKACK
2049 LIBCFS_TCP_SOCK_SET_KEEPINTVL
2050 LIBCFS_TCP_SOCK_SET_KEEPCNT
2052 LIBCFS_HAVE_MMAP_LOCK
2053 LIBCFS_KERNEL_SETSOCKOPT
2054 LIBCFS_VMALLOC_2ARGS
2055 LIBCFS_HAVE_NR_UNSTABLE_NFS
2056 LIBCFS_SEC_RELEASE_SECCTX
2058 LIBCFS_HAVE_KFREE_SENSITIVE
2059 LIBCFS_HAVE_CRYPTO_SHA2_HEADER
2060 LIBCFS_HAVE_LIST_CMP_FUNC_T
2063 LIBCFS_HAVE_CIPHER_HEADER
2065 LIBCFS_HAVE_TASK_IS_RUNNING
2067 LIBCFS_LINUX_STDARG_HEADER
2068 LIBCFS_HAVE_PANIC_NOTIFIER_HEADER
2070 LIBCFS_PARAM_SET_UINT_MINMAX
2071 LIBCFS_LINUX_BLK_INTEGRITY_HEADER
2072 ]) # LIBCFS_PROG_LINUX
2075 # LIBCFS_PATH_DEFAULTS
2077 # default paths for installed files
2079 AC_DEFUN([LIBCFS_PATH_DEFAULTS], [
2080 ]) # LIBCFS_PATH_DEFAULTS
2085 # other configure checks
2087 AC_DEFUN([LIBCFS_CONFIGURE], [
2088 AC_MSG_NOTICE([LibCFS core checks
2089 ==============================================================================])
2091 # libcfs/libcfs/util/nidstrings.c
2092 AC_CHECK_HEADERS([netdb.h asm/types.h endian.h])
2093 AC_CHECK_FUNCS([gethostbyname])
2095 # -------- Check for required packages --------------
2097 AC_MSG_NOTICE([LibCFS required packages checks
2098 ==============================================================================])
2100 AC_MSG_CHECKING([whether to enable readline support])
2101 AC_ARG_ENABLE(readline,
2102 AS_HELP_STRING([--disable-readline],
2103 [disable readline support]),
2104 [], [enable_readline="yes"])
2105 AC_MSG_RESULT([$enable_readline])
2108 AS_IF([test "x$enable_readline" = xyes], [
2109 AC_CHECK_LIB([readline], [readline], [
2110 LIBREADLINE="-lreadline"
2111 AC_DEFINE(HAVE_LIBREADLINE, 1,
2112 [readline library is available])
2115 AC_SUBST(LIBREADLINE)
2117 AC_MSG_CHECKING([whether to use libpthread for libcfs library])
2118 AC_ARG_ENABLE([libpthread],
2119 AS_HELP_STRING([--disable-libpthread],
2120 [disable libpthread]),
2121 [], [enable_libpthread="yes"])
2122 AC_MSG_RESULT([$enable_libpthread])
2125 AS_IF([test "x$enable_libpthread" = xyes], [
2126 AC_CHECK_LIB([pthread], [pthread_create], [
2127 PTHREAD_LIBS="-lpthread"
2128 AC_DEFINE([HAVE_LIBPTHREAD], 1,
2129 [use libpthread for libcfs library])
2132 AC_MSG_WARN([Using libpthread for libcfs library is disabled explicitly])
2134 AC_SUBST(PTHREAD_LIBS)
2135 ]) # LIBCFS_CONFIGURE
2138 # LIBCFS_CONFIG_FILES
2140 # files that should be generated with AC_OUTPUT
2142 AC_DEFUN([LIBCFS_CONFIG_FILES], [
2146 libcfs/autoconf/Makefile
2147 libcfs/include/Makefile
2148 libcfs/include/libcfs/Makefile
2149 libcfs/include/uapi/Makefile
2150 libcfs/include/libcfs/linux/Makefile
2151 libcfs/include/libcfs/util/Makefile
2152 libcfs/include/libcfs/crypto/Makefile
2153 libcfs/include/uapi/linux/Makefile
2154 libcfs/libcfs/Makefile
2155 libcfs/libcfs/autoMakefile
2156 libcfs/libcfs/linux/Makefile
2157 libcfs/libcfs/util/Makefile
2158 libcfs/libcfs/crypto/Makefile
2160 ]) # LIBCFS_CONFIG_FILES