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 AC_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 AC_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 AC_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 AC_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 # LIBCFS_HAVE_MAPPING_AS_EXITING_FLAG
202 # v3.14-7405-g91b0abe36a7b added AS_EXITING flag with
203 # mapping_exiting() and mapping_set_exiting()
205 AC_DEFUN([LIBCFS_HAVE_MAPPING_AS_EXITING_FLAG], [
206 m4_pattern_allow([AS_EXITING])
207 tmp_flags="$EXTRA_KCFLAGS"
208 EXTRA_KCFLAGS="-Werror"
209 LB_CHECK_COMPILE([if enum mapping_flags has AS_EXITING flag],
210 mapping_exiting_exists, [
211 #include <linux/pagemap.h>
213 enum mapping_flags flag = AS_EXITING;
216 AC_DEFINE(HAVE_MAPPING_AS_EXITING_FLAG, 1,
217 [enum mapping_flags has AS_EXITING flag])
219 EXTRA_KCFLAGS="$tmp_flags"
220 ]) # LIBCFS_HAVE_MAPPING_AS_EXITING_FLAG
223 # LIBCFS_IOV_ITER_HAS_TYPE
225 # kernel 3.15-rc4 commit 71d8e532b1549a478e6a6a8a44f309d050294d00
226 # start adding the tag to iov_iter
228 AC_DEFUN([LIBCFS_IOV_ITER_HAS_TYPE], [
229 tmp_flags="$EXTRA_KCFLAGS"
230 EXTRA_KCFLAGS="-Werror"
231 LB_CHECK_COMPILE([if iov_iter has member type],
232 iov_iter_has_type_member, [
233 #include <linux/uio.h>
235 struct iov_iter iter = { .type = ITER_KVEC };
238 AC_DEFINE(HAVE_IOV_ITER_HAS_TYPE_MEMBER, 1,
239 [if iov_iter has member type])
241 EXTRA_KCFLAGS="$tmp_flags"
242 ]) # LIBCFS_IOV_ITER_HAS_TYPE
245 # LIBCFS_HAVE_NS_TO_TIMESPEC64
247 # Kernel version 4.16-rc3 commit a84d1169164b274f13b97a23ff235c000efe3b49
248 # introduced struct __kernel_old_timeval
250 AC_DEFUN([LIBCFS_HAVE_NS_TO_TIMESPEC64],[
251 LB_CHECK_COMPILE([does 'ns_to_timespec64()' exist],
252 kernel_old_timeval, [
253 #include <linux/time.h>
255 struct timespec64 kts;
257 kts = ns_to_timespec64(0);
259 AC_DEFINE(HAVE_NS_TO_TIMESPEC64, 1,
260 [ns_to_timespec64() is available])
262 ]) # LIBCFS_HAVE_NS_TO_TIMESPEC64
265 # Kernel version 3.17 changed hlist_add_after to
268 AC_DEFUN([LIBCFS_HLIST_ADD_AFTER],[
269 LB_CHECK_COMPILE([does function 'hlist_add_after' exist],
271 #include <linux/list.h>
273 hlist_add_after(NULL, NULL);
275 AC_DEFINE(HAVE_HLIST_ADD_AFTER, 1,
276 [hlist_add_after is available])
278 ]) # LIBCFS_HLIST_ADD_AFTER
281 # Kernel version 3.17 introduced struct timespec64
283 AC_DEFUN([LIBCFS_TIMESPEC64],[
284 LB_CHECK_COMPILE([does 'struct timespec64' exist],
286 #include <linux/time.h>
288 struct timespec64 ts;
293 AC_DEFINE(HAVE_TIMESPEC64, 1,
294 ['struct timespec64' is available])
296 ]) # LIBCFS_TIMESPEC64
299 # Kernel version 3.17 introduced ktime_get_real_ts64
301 AC_DEFUN([LIBCFS_KTIME_GET_REAL_TS64],[
302 LB_CHECK_COMPILE([does function 'ktime_get_real_ts64' exist],
303 ktime_get_real_ts64, [
304 #include <linux/ktime.h>
306 struct timespec64 *ts = NULL;
308 ktime_get_real_ts64(ts);
310 AC_DEFINE(HAVE_KTIME_GET_REAL_TS64, 1,
311 ['ktime_get_real_ts64' is available])
313 ]) # LIBCFS_KTIME_GET_REAL_TS64
316 # Kernel version 3.17 introduced ktime_get_real_seconds
318 AC_DEFUN([LIBCFS_KTIME_GET_REAL_SECONDS],[
319 LB_CHECK_COMPILE([does function 'ktime_get_real_seconds' exist],
320 ktime_get_real_seconds, [
321 #include <linux/hrtimer.h>
322 #include <linux/ktime.h>
326 now = ktime_get_real_seconds();
328 AC_DEFINE(HAVE_KTIME_GET_REAL_SECONDS, 1,
329 ['ktime_get_real_seconds' is available])
331 ]) # LIBCFS_KTIME_GET_REAL_SECONDS
334 # Kernel version 3.17 created ktime_get_ns wrapper
336 AC_DEFUN([LIBCFS_KTIME_GET_NS],[
337 LB_CHECK_COMPILE([does function 'ktime_get_ns' exist],
339 #include <linux/hrtimer.h>
340 #include <linux/ktime.h>
344 nanoseconds = ktime_get_ns();
346 AC_DEFINE(NEED_KTIME_GET_NS, 1,
347 ['ktime_get_ns' is not available])
349 ]) # LIBCFS_KTIME_GET_NS
352 # Kernel version 3.17 created ktime_get_real_ns wrapper
354 AC_DEFUN([LIBCFS_KTIME_GET_REAL_NS],[
355 LB_CHECK_COMPILE([does function 'ktime_get_real_ns' exist],
357 #include <linux/hrtimer.h>
358 #include <linux/ktime.h>
362 nanoseconds = ktime_get_real_ns();
364 AC_DEFINE(NEED_KTIME_GET_REAL_NS, 1,
365 ['ktime_get_real_ns' is not available])
367 ]) # LIBCFS_KTIME_GET_REAL_NS
370 # Kernel version 3.17 introduced ktime_to_timespec64
372 AC_DEFUN([LIBCFS_KTIME_TO_TIMESPEC64],[
373 LB_CHECK_COMPILE([does function 'ktime_to_timespec64' exist],
374 ktime_to_timespec64, [
375 #include <linux/hrtimer.h>
376 #include <linux/ktime.h>
378 ktime_t now = ktime_set(0, 0);
379 struct timespec64 ts;
381 ts = ktime_to_timespec64(now);
383 AC_DEFINE(HAVE_KTIME_TO_TIMESPEC64, 1,
384 ['ktime_to_timespec64' is available])
386 ]) # LIBCFS_KTIME_TO_TIMESPEC64
389 # Kernel version 3.17 introduced timespec64_sub
391 AC_DEFUN([LIBCFS_TIMESPEC64_SUB],[
392 LB_CHECK_COMPILE([does function 'timespec64_sub' exist],
394 #include <linux/time.h>
396 struct timespec64 later = { }, earlier = { }, diff;
398 diff = timespec64_sub(later, earlier);
400 AC_DEFINE(HAVE_TIMESPEC64_SUB, 1,
401 ['timespec64_sub' is available])
403 ]) # LIBCFS_TIMESPEC64_SUB
406 # Kernel version 3.17 introduced timespec64_to_ktime
408 AC_DEFUN([LIBCFS_TIMESPEC64_TO_KTIME],[
409 LB_CHECK_COMPILE([does function 'timespec64_to_ktime' exist],
410 timespec64_to_ktime, [
411 #include <linux/ktime.h>
413 struct timespec64 ts;
416 now = timespec64_to_ktime(ts);
418 AC_DEFINE(HAVE_TIMESPEC64_TO_KTIME, 1,
419 ['timespec64_to_ktime' is available])
421 ]) # LIBCFS_TIMESPEC64_TO_KTIME
424 # Kernel version 3.19 introduced ktime_get_seconds
426 AC_DEFUN([LIBCFS_KTIME_GET_SECONDS],[
427 LB_CHECK_COMPILE([does function 'ktime_get_seconds' exist],
429 #include <linux/ktime.h>
433 now = ktime_get_seconds();
435 AC_DEFINE(HAVE_KTIME_GET_SECONDS, 1,
436 ['ktime_get_seconds' is available])
438 ]) # LIBCFS_KTIME_GET_SECONDS
441 # Kernel version 3.19 commit v3.18-rc2-26-g61ada528dea0
442 # introduce wait_woken()
444 AC_DEFUN([LIBCFS_WAIT_WOKEN],[
445 LB_CHECK_COMPILE([does function 'wait_woken' exist],
447 #include <linux/wait.h>
449 wait_woken(NULL, 0, 0);
451 AC_DEFINE(HAVE_WAIT_WOKEN, 1,
452 ['wait_woken, is available'])
454 ]) # LIBCFS_WAIT_WOKEN
457 # Kernel version 4.0 commit 41fbf3b39d5eca01527338b4d0ee15ee1ae1023c
458 # introduced the helper function ktime_ms_delta.
460 AC_DEFUN([LIBCFS_KTIME_MS_DELTA],[
461 LB_CHECK_COMPILE([does function 'ktime_ms_delta' exist],
463 #include <linux/ktime.h>
465 ktime_t start = ktime_set(0, 0);
468 ktime_ms_delta(start, end);
470 AC_DEFINE(HAVE_KTIME_MS_DELTA, 1,
471 ['ktime_ms_delta' is available])
473 ]) # LIBCFS_KTIME_MS_DELTA
476 # Kernel version 4.1 commit b51d23e4e9fea6f264d39535c2a62d1f51e7ccc3
477 # create per module locks which added kernel_param_[un]lock(). Older
478 # kernels you have to use __kernel_param_[un]lock(). In that case its
479 # a global lock for all modules but that is okay since its a rare event.
481 AC_DEFUN([LIBCFS_KERNEL_PARAM_LOCK],[
482 LB_CHECK_COMPILE([does function 'kernel_param_[un]lock' exist],
484 #include <linux/moduleparam.h>
486 kernel_param_lock(NULL);
487 kernel_param_unlock(NULL);
489 AC_DEFINE(HAVE_KERNEL_PARAM_LOCK, 1,
490 ['kernel_param_[un]lock' is available])
492 ]) # LIBCFS_KERNEL_PARAM_LOCK
495 # Kernel version 4.2 changed topology_thread_cpumask
496 # to topology_sibling_cpumask
498 AC_DEFUN([LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK],[
499 LB_CHECK_COMPILE([does function 'topology_sibling_cpumask' exist],
500 topology_sibling_cpumask, [
501 #include <linux/topology.h>
503 const struct cpumask *mask;
505 mask = topology_sibling_cpumask(0);
507 AC_DEFINE(HAVE_TOPOLOGY_SIBLING_CPUMASK, 1,
508 [topology_sibling_cpumask is available])
510 ]) # LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
513 # Kernel version 4.4 commit ef951599074ba4fad2d0efa0a977129b41e6d203
514 # introduced kstrtobool and kstrtobool_from_user.
516 AC_DEFUN([LIBCFS_KSTRTOBOOL_FROM_USER], [
517 LB_CHECK_COMPILE([if Linux kernel has 'kstrtobool_from_user'],
518 kstrtobool_from_user, [
519 #include <linux/kernel.h>
522 return kstrtobool_from_user(NULL, 0, &result);
524 AC_DEFINE(HAVE_KSTRTOBOOL_FROM_USER, 1,
525 [kernel has kstrtobool_from_user])
527 ]) # LIBCFS_KSTRTOBOOL_FROM_USER
530 # LIBCFS_NETLINK_CALLBACK_START
532 # Kernel version 4.4-rc3 commit fc9e50f5a5a4e1fa9ba2756f745a13e693cf6a06
533 # added a start function callback for struct netlink_callback
535 AC_DEFUN([LIBCFS_NETLINK_CALLBACK_START], [
536 LB_CHECK_COMPILE([if struct genl_ops has start callback],
538 #include <net/genetlink.h>
544 AC_DEFINE(HAVE_NETLINK_CALLBACK_START, 1,
545 [struct genl_ops has 'start' callback])
547 ]) # LIBCFS_NETLINK_CALLBACK_START
550 # Kernel version 4.5-rc1 commit d12481bc58fba89427565f8592e88446ec084a24
551 # added crypto hash helpers
553 AC_DEFUN([LIBCFS_CRYPTO_HASH_HELPERS], [
554 LB_CHECK_COMPILE([does crypto hash helper functions exist],
555 crypto_hash_helpers, [
556 #include <crypto/hash.h>
558 crypto_ahash_alg_name(NULL);
559 crypto_ahash_driver_name(NULL);
561 AC_DEFINE(HAVE_CRYPTO_HASH_HELPERS, 1,
562 [crypto hash helper functions are available])
564 ]) # LIBCFS_CRYPTO_HASH_HELPERS
567 # Kernel version 4.5-rc1 commit 3502cad73c4bbf8f6365d539e814159275252c59
568 # introduced rhashtable_replace_fast
570 AC_DEFUN([LIBCFS_RHASHTABLE_REPLACE], [
571 LB_CHECK_COMPILE([if 'rhashtable_replace_fast' exists],
572 rhashtable_replace_fast, [
573 #include <linux/rhashtable.h>
575 const struct rhashtable_params params = { 0 };
577 rhashtable_replace_fast(NULL, NULL, NULL, params);
579 AC_DEFINE(HAVE_RHASHTABLE_REPLACE, 1,
580 [rhashtable_replace_fast() is available])
582 ]) # LIBCFS_RHASHTABLE_REPLACE
585 # Kernel version 4.5-rc3 commit 2fe829aca9d7bed5fd6b49c6a1452e5e486b6cc3dd
586 # made kset_find_obj() exportable to modules
588 AC_DEFUN([LIBCFS_EXPORT_KSET_FIND_OBJ], [
589 LB_CHECK_EXPORT([kset_find_obj], [lib/kobject.c],
590 [AC_DEFINE(HAVE_KSET_FIND_OBJ, 1,
591 [kset_find_obj is exported by the kernel])])
592 ]) # LIBCFS_EXPORT_KSET_FIND_OBJ
595 # Kernel version 4.6+ commit ef703f49a6c5b909a85149bb6625c4ed0d697186
596 # fixed the brokenness of hash_64(). The fix removed GOLDEN_RATIO_PRIME_64
597 # since it was a poor prime value.
599 AC_DEFUN([LIBCFS_BROKEN_HASH_64], [
600 LB_CHECK_COMPILE([kernel has fixed hash_64()],
602 #include <linux/hash.h>
604 int tmp = GOLDEN_RATIO_PRIME_64;
606 AC_DEFINE(HAVE_BROKEN_HASH_64, 1, [kernel hash_64() is broken])
608 ]) # LIBCFS_BROKEN_HASH_64
611 # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
613 # linux 4.6 kernel changed stacktrace_ops address to return an int
615 AC_DEFUN([LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT], [
616 LB_CHECK_COMPILE([if 'struct stacktrace_ops' address function returns an int],
617 stacktrace_ops_address_return_int, [
618 #include <asm/stacktrace.h>
622 rc = ((struct stacktrace_ops *)0)->address(NULL, 0, 0);
624 AC_DEFINE(STACKTRACE_OPS_ADDRESS_RETURN_INT, 1,
625 ['struct stacktrace_ops' address function returns an int])
627 ]) # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
630 # Kernel version 4.6 removed both struct task_struct and struct mm_struct
631 # arguments to get_user_pages
633 AC_DEFUN([LIBCFS_GET_USER_PAGES_6ARG], [
634 LB_CHECK_COMPILE([if 'get_user_pages()' takes 6 arguments],
635 get_user_pages_6arg, [
636 #include <linux/mm.h>
640 rc = get_user_pages(0, 0, 0, 0, NULL, NULL);
642 AC_DEFINE(HAVE_GET_USER_PAGES_6ARG, 1,
643 [get_user_pages takes 6 arguments])
645 ]) # LIBCFS_GET_USER_PAGES_6ARG
650 # 4.6 kernel created stringhash.h which moved stuff out of dcache.h
651 # commit f4bcbe792b8f434e32487cff9d9e30ab45a3ce02
653 AC_DEFUN([LIBCFS_STRINGHASH], [
654 LB_CHECK_LINUX_HEADER([linux/stringhash.h], [
655 AC_DEFINE(HAVE_STRINGHASH, 1,
656 [stringhash.h is present])])
657 ]) # LIBCFS_STRINGHASH
660 # LIBCFS_RHASHTABLE_INSERT_FAST
662 # 4.7+ kernel commit 5ca8cc5bf11faed257c762018aea9106d529232f
663 # changed __rhashtable_insert_fast to support the new function
664 # rhashtable_lookup_get_insert_key().
666 AC_DEFUN([LIBCFS_RHASHTABLE_INSERT_FAST], [
667 tmp_flags="$EXTRA_KCFLAGS"
668 EXTRA_KCFLAGS="-Werror"
669 LB_CHECK_COMPILE([if internal '__rhashtable_insert_fast()' returns int],
670 rhashtable_insert_fast, [
671 #include <linux/rhashtable.h>
673 const struct rhashtable_params params = { 0 };
676 rc = __rhashtable_insert_fast(NULL, NULL, NULL, params);
678 AC_DEFINE(HAVE_HASHTABLE_INSERT_FAST_RETURN_INT, 1,
679 ['__rhashtable_insert_fast()' returns int])
681 EXTRA_KCFLAGS="$tmp_flags"
682 ]) # LIBCFS_RHASHTABLE_INSERT_FAST
685 # Kernel version 4.7-rc1 commit 8f6fd83c6c5ec66a4a70c728535ddcdfef4f3697
686 # added 3rd arg to rhashtable_walk_init
688 AC_DEFUN([LIBCFS_RHASHTABLE_WALK_INIT_3ARG], [
689 LB_CHECK_COMPILE([if 'rhashtable_walk_init' has 3 args],
690 rhashtable_walk_init, [
691 #include <linux/gfp.h>
692 #include <linux/rhashtable.h>
694 rhashtable_walk_init(NULL, NULL, GFP_KERNEL);
696 AC_DEFINE(HAVE_3ARG_RHASHTABLE_WALK_INIT, 1,
697 [rhashtable_walk_init() has 3 args])
699 ]) # LIBCFS_RHASHTABLE_WALK_INIT_3ARG
702 # Kernel version 4.8-rc6 commit ca26893f05e86497a86732768ec53cd38c0819ca
703 # introduced rhashtable_lookup
705 AC_DEFUN([LIBCFS_RHASHTABLE_LOOKUP], [
706 LB_CHECK_COMPILE([if 'rhashtable_lookup' exist],
708 #include <linux/rhashtable.h>
710 const struct rhashtable_params params = { 0 };
713 ret = rhashtable_lookup(NULL, NULL, params);
715 AC_DEFINE(HAVE_RHASHTABLE_LOOKUP, 1,
716 [rhashtable_lookup() is available])
718 ]) # LIBCFS_RHASHTABLE_LOOKUP
722 # Kernel version 4.8-rc6 commit ca26893f05e86497a86732768ec53cd38c0819ca
723 # created the rhlist interface to allow inserting duplicate objects
724 # into the same table.
726 AC_DEFUN([LIBCFS_RHLTABLE], [
727 LB_CHECK_COMPILE([does 'struct rhltable' exist],
729 #include <linux/rhashtable.h>
731 struct rhltable *hlt;
733 rhltable_destroy(hlt);
735 AC_DEFINE(HAVE_RHLTABLE, 1,
736 [struct rhltable exist])
741 # LIBCFS_STACKTRACE_OPS
743 # Kernel version 4.8 commit c8fe4609827aedc9c4b45de80e7cdc8ccfa8541b
744 # removed both struct stacktrace_ops and dump_trace() function
746 AC_DEFUN([LIBCFS_STACKTRACE_OPS], [
747 LB_CHECK_COMPILE([if 'struct stacktrace_ops' exists],
751 #include <asm/stacktrace.h>
753 struct stacktrace_ops ops;
756 AC_DEFINE(HAVE_STACKTRACE_OPS, 1,
757 [struct stacktrace_ops exists])
759 ]) # LIBCFS_STACKTRACE_OPS
762 # Kernel version 4.9-rc1 commit 246779dd090bd1b74d2652b3a6ca7759f593b27a
763 # introduced rhashtable_walk_enter
765 AC_DEFUN([LIBCFS_RHASHTABLE_WALK_ENTER], [
766 LB_CHECK_COMPILE([if 'rhashtable_walk_enter' exists],
767 rhashtable_walk_enter, [
768 #include <linux/rhashtable.h>
770 rhashtable_walk_enter(NULL, NULL);
772 AC_DEFINE(HAVE_RHASHTABLE_WALK_ENTER, 1,
773 [rhashtable_walk_enter() is available])
775 ]) # LIBCFS_RHASHTABLE_WALK_ENTER
778 # Kernel version 4.9 commit 768ae309a96103ed02eb1e111e838c87854d8b51
779 # mm: replace get_user_pages() write/force parameters with gup_flags
781 AC_DEFUN([LIBCFS_GET_USER_PAGES_GUP_FLAGS], [
782 LB_CHECK_COMPILE([if 'get_user_pages()' takes gup_flags in arguments],
783 get_user_pages_gup_flags, [
784 #include <linux/mm.h>
787 rc = get_user_pages(0, 0, FOLL_WRITE, NULL, NULL);
789 AC_DEFINE(HAVE_GET_USER_PAGES_GUP_FLAGS, 1,
790 [get_user_pages takes gup_flags in arguments])
792 ]) # LIBCFS_GET_USER_PAGES_GUP_FLAGS
795 # Kernel version 4.10 commit 7b737965b33188bd3dbb44e938535c4006d97fbb
796 # libcfs: Convert to hotplug state machine
798 AC_DEFUN([LIBCFS_HOTPLUG_STATE_MACHINE], [
799 LB_CHECK_COMPILE([if libcfs supports CPU hotplug state machine],
800 cpu_hotplug_state_machine, [
801 #include <linux/cpuhotplug.h>
803 cpuhp_remove_state(CPUHP_LUSTRE_CFS_DEAD);
805 AC_DEFINE(HAVE_HOTPLUG_STATE_MACHINE, 1,
806 [hotplug state machine is supported])
808 ]) # LIBCFS_HOTPLUG_STATE_MACHINE
811 # Kernel version 4.10-rc3 commit f405df5de3170c00e5c54f8b7cf4766044a032ba
812 # introduced refcount_t which is atomic_t plus over flow guards.
814 AC_DEFUN([LIBCFS_REFCOUNT_T], [
815 tmp_flags="$EXTRA_KCFLAGS"
816 EXTRA_KCFLAGS="-Werror"
817 LB_CHECK_LINUX_HEADER([linux/refcount.h], [
818 AC_DEFINE(HAVE_REFCOUNT_T, 1,
819 [refcount_t is supported])
821 EXTRA_KCFLAGS="$tmp_flags"
822 ]) # LIBCFS_REFCOUNT_T
825 # Kernel version 4.12 commit 499118e966f1d2150bd66647c8932343c4e9a0b8
826 # introduce memalloc_noreclaim_{save,restore}
828 AC_DEFUN([LIBCFS_MEMALLOC_NORECLAIM], [
829 LB_CHECK_COMPILE([if memalloc_noreclaim_{save,restore} exist],
830 memalloc_noreclaim, [
831 #include <linux/sched/mm.h>
833 int flag = memalloc_noreclaim_save();
834 memalloc_noreclaim_restore(flag);
836 AC_DEFINE(HAVE_MEMALLOC_RECLAIM, 1,
837 [memalloc_noreclaim_{save,restore}() is supported])
839 ]) # LIBCFS_MEMALLOC_NORECLAIM
842 # LIBCFS_SCHED_HEADERS
844 # 4.11 has broken up sched.h into more headers.
846 AC_DEFUN([LIBCFS_SCHED_HEADERS], [
847 LB_CHECK_LINUX_HEADER([linux/sched/signal.h], [
848 AC_DEFINE(HAVE_SCHED_HEADERS, 1,
849 [linux/sched header directory exist])])
850 ]) # LIBCFS_SCHED_HEADERS
853 # Kernel version 4.11-rc1 commit 2c935bc57221cc2edc787c72ea0e2d30cdcd3d5e
854 # introduce kref_read
856 AC_DEFUN([LIBCFS_KREF_READ], [
857 LB_CHECK_COMPILE([if 'kref_read' exists],
859 #include <linux/kref.h>
863 AC_DEFINE(HAVE_KREF_READ, 1,
864 [kref_read() is available])
866 ]) # LIBCFS_KREF_READ
869 # Kernel version 4.11-rc1 commit da20420f83ea0fbcf3d03afda08d971ea1d8a356
870 # introduced rht_bucket_var
872 AC_DEFUN([LIBCFS_RHT_BUCKET_VAR], [
873 LB_CHECK_COMPILE([if 'rht_bucket_var' exists],
875 #include <linux/rhashtable.h>
878 rht_bucket_var(NULL, 0);
880 AC_DEFINE(HAVE_RHT_BUCKET_VAR, 1,
881 [rht_bucket_var() is available])
883 ]) # LIBCFS_RHT_BUCKET_VAR
886 # Kernel version 4.11-rc5 commit fceb6435e85298f747fee938415057af837f5a8a
887 # began the enhanchement of Netlink with extended ACK struct for advanced
888 # error handling. By commit 7ab606d1609dd6dfeae9c8ad0a8a4e051d831e46 we
889 # had full support for this new feature.
891 AC_DEFUN([LIBCFS_NL_EXT_ACK], [
892 LB_CHECK_COMPILE([if Netlink supports netlink_ext_ack],
894 #include <net/genetlink.h>
896 struct genl_info info;
900 AC_DEFINE(HAVE_NL_PARSE_WITH_EXT_ACK, 1,
901 [netlink_ext_ack is an argument to nla_parse type function])
903 ]) # LIBCFS_NL_EXT_ACK
906 # Kernel version 4.11 commit f9fe1c12d126f9887441fa5bb165046f30ddd4b5
907 # introduced rhashtable_lookup_get_insert_fast
909 AC_DEFUN([LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST], [
910 LB_CHECK_COMPILE([if 'rhashtable_lookup_get_insert_fast' exist],
911 rhashtable_lookup_get_insert_fast, [
912 #include <linux/rhashtable.h>
914 const struct rhashtable_params params = { 0 };
917 ret = rhashtable_lookup_get_insert_fast(NULL, NULL, params);
919 AC_DEFINE(HAVE_RHASHTABLE_LOOKUP_GET_INSERT_FAST, 1,
920 [rhashtable_lookup_get_insert_fast() is available])
922 ]) # LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST
925 # Kernel version 4.12-rc2 8f553c498e1772cccb39a114da4a498d22992758
926 # provide proper CPU hotplug locking
928 AC_DEFUN([LIBCFS_CPUS_READ_LOCK], [
929 LB_CHECK_COMPILE([if 'cpus_read_[un]lock' exist],
931 #include <linux/cpu.h>
936 AC_DEFINE(HAVE_CPUS_READ_LOCK, 1, ['cpus_read_lock' exist])
938 ]) # LIBCFS_CPUS_READ_LOCK
941 # Kernel version 4.12-rc3 f9727a17db9bab71ddae91f74f11a8a2f9a0ece6
942 # renamed uuid_be to uuid_t
944 AC_DEFUN([LIBCFS_UUID_T], [
945 LB_CHECK_COMPILE([if 'uuid_t' exist],
947 #include <linux/uuid.h>
951 memset(uuid.b, 0, 16);
953 AC_DEFINE(HAVE_UUID_T, 1, ['uuid_t' exist])
958 # Kernel version 4.12-rc3 commit fd851a3cdc196bfc1d229b5f22369069af532bf8
959 # introduce processor.h
961 AC_DEFUN([LIBCFS_HAVE_PROCESSOR_HEADER], [
962 tmp_flags="$EXTRA_KCFLAGS"
963 EXTRA_KCFLAGS="-Werror"
964 LB_CHECK_LINUX_HEADER([linux/processor.h], [
965 AC_DEFINE(HAVE_PROCESSOR_H, 1,
966 [processor.h is present])
968 EXTRA_KCFLAGS="$tmp_flags"
969 ]) # LIBCFS_HAVE_PROCESSOR_HEADER
972 # Kernel verison 4.12-rc6 commit 5dd43ce2f69d42a71dcacdb13d17d8c0ac1fe8f7
975 AC_DEFUN([LIBCFS_HAVE_WAIT_BIT_HEADER], [
976 LB_CHECK_LINUX_HEADER([linux/wait_bit.h], [
977 AC_DEFINE(HAVE_WAIT_BIT_HEADER_H, 1,
978 [wait_bit.h is present])])
979 ]) # LIBCFS_HAVE_WAIT_BIT_HEADER
982 # Kernel version 4.12-rc6 commmit 2055da97389a605c8a00d163d40903afbe413921
984 # struct wait_queue_head::task_list => ::head
985 # struct wait_queue_entry::task_list => ::entry
987 AC_DEFUN([LIBCFS_WAIT_QUEUE_TASK_LIST_RENAME], [
988 LB_CHECK_COMPILE([if linux wait_queue_head list_head is named head],
989 wait_queue_task_list, [
990 #include <linux/wait.h>
994 INIT_LIST_HEAD(&e.head);
996 AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY_LIST, 1,
997 [linux wait_queue_head_t list_head is name head])
999 ]) # LIBCFS_WAIT_QUEUE_TASK_LIST_RENAME
1004 # Kernel version 4.13-rc1 commit 2cf0c8b3e6942ecafe6ebb1a6d0328a81641bf39
1005 # created nla_strdup(). This is needed since push strings can be
1008 AC_DEFUN([LIBCFS_NLA_STRDUP], [
1009 LB_CHECK_COMPILE([if 'nla_strdup()' exists],
1011 #include <net/netlink.h>
1013 char *tmp = nla_strdup(NULL, GFP_KERNEL);
1015 AC_DEFINE(HAVE_NLA_STRDUP, 1,
1016 ['nla_strdup' is available])
1018 ]) # LIBCFS_NLA_STRDUP
1021 # LIBCFS_WAIT_QUEUE_ENTRY
1023 # Kernel version 4.13 ac6424b981bce1c4bc55675c6ce11bfe1bbfa64f
1024 # Rename wait_queue_t => wait_queue_entry_t
1026 AC_DEFUN([LIBCFS_WAIT_QUEUE_ENTRY], [
1027 LB_CHECK_COMPILE([if 'wait_queue_entry_t' exists],
1029 #include <linux/wait.h>
1031 wait_queue_entry_t e;
1035 AC_DEFINE(HAVE_WAIT_QUEUE_ENTRY, 1,
1036 ['wait_queue_entry_t' is available])
1038 ]) # LIBCFS_WAIT_QUEUE_ENTRY
1041 # LIBCFS_NEW_KERNEL_WRITE
1043 # Kernel version 4.14 e13ec939e96b13e664bb6cee361cc976a0ee621a
1044 # changed kernel_write prototype to make is plug compatible
1045 # with the unexported vfs_write()
1047 AC_DEFUN([LIBCFS_NEW_KERNEL_WRITE], [
1048 tmp_flags="$EXTRA_KCFLAGS"
1049 EXTRA_KCFLAGS="-Werror"
1050 LB_CHECK_COMPILE([if 'kernel_write' matches other read/write helpers],
1051 kernel_write_match, [
1052 #include <linux/fs.h>
1054 const void *buf = NULL;
1056 return kernel_write(NULL, buf, 0, &pos);
1058 AC_DEFINE(HAVE_NEW_KERNEL_WRITE, 1,
1059 ['kernel_write' aligns with read/write helpers])
1061 EXTRA_KCFLAGS="$tmp_flags"
1062 ]) # LIBCFS_NEW_KERNEL_WRITE
1065 # LIBCFS_MM_TOTALRAM_PAGES_FUNC
1067 # kernel 5.0 commit ca79b0c211af63fa3276f0e3fd7dd9ada2439839
1068 # mm: convert totalram_pages and totalhigh_pages variables to atomic
1070 AC_DEFUN([LIBCFS_MM_TOTALRAM_PAGES_FUNC], [
1071 tmp_flags="$EXTRA_KCFLAGS"
1072 EXTRA_KCFLAGS="-Werror"
1073 LB_CHECK_COMPILE([if totalram_pages is a function],
1075 #include <linux/mm.h>
1077 totalram_pages_inc();
1079 AC_DEFINE(HAVE_TOTALRAM_PAGES_AS_FUNC, 1,
1080 [if totalram_pages is a function])
1082 EXTRA_KCFLAGS="$tmp_flags"
1083 ]) # LIBCFS_MM_TOTALRAM_PAGES_FUNC
1086 # LIBCFS_NEW_KERNEL_READ
1088 # 4.14 commit bdd1d2d3d251c65b74ac4493e08db18971c09240 changed
1089 # the signature of kernel_read to match other read/write helpers
1090 # and place offset last.
1092 AC_DEFUN([LIBCFS_NEW_KERNEL_READ], [
1093 tmp_flags="$EXTRA_KCFLAGS"
1094 EXTRA_KCFLAGS="-Werror"
1095 LB_CHECK_COMPILE([if 'kernel_read()' has loff_t *pos as last parameter],
1097 #include <linux/fs.h>
1100 kernel_read(NULL, NULL, 0, &pos);
1102 AC_DEFINE(HAVE_KERNEL_READ_LAST_POSP, 1,
1103 [kernel_read() signature ends with loff_t *pos])
1105 EXTRA_KCFLAGS="$tmp_flags"
1106 ]) # LIBCFS_NEW_KERNEL_READ
1109 # LIBCFS_DEFINE_TIMER
1111 # Kernel version 4.14 commit 1d27e3e2252ba9d949ca82fbdb73cde102cb2067
1112 # remove expires and data arguments from DEFINE_TIMER. Also the callback
1113 # when from using unsigned long argument to using struct timer_list pointer.
1115 AC_DEFUN([LIBCFS_DEFINE_TIMER], [
1116 LB_CHECK_COMPILE([if DEFINE_TIMER takes only 2 arguments],
1118 #include <linux/timer.h>
1120 static DEFINE_TIMER(my_timer, NULL);
1122 AC_DEFINE(HAVE_NEW_DEFINE_TIMER, 1,
1123 [DEFINE_TIMER uses only 2 arguements])
1125 ]) # LIBCFS_DEFINE_TIMER
1128 # LIBCFS_EXPORT_SAVE_STACK_TRACE_TSK
1130 # Kernel 2.6.27 commit 8594698ebddeef5443b7da8258ae33b3eaca61d5
1131 # exported save_stack_trace_tsk for x86.
1132 # Kernel 2.6.27 commit 01f4b8b8b8db09b88be7df7e51192e4e678b69d3
1133 # exported save_stack_trace_tsk for powerpc
1134 # Kernel 4.13 commit e27c7fa015d61c8be6a2c32b2144aad2ae6ec975
1135 # exported save_stack_trace_tsk for arm64
1136 # Kernel 4.14 commit 9a3dc3186fc3795e076a4122da9e0258651a9631
1137 # exported save_stack_trace_tsk for arm
1139 AC_DEFUN([LIBCFS_EXPORT_SAVE_STACK_TRACE_TSK], [
1140 LB_CHECK_EXPORT([save_stack_trace_tsk], [arch/$SUBARCH/kernel/stacktrace.c],
1141 [AC_DEFINE(HAVE_SAVE_STACK_TRACE_TSK, 1,
1142 [save_stack_trace_tsk is exported])])
1143 ]) # LIBCFS_EXPORT_SAVE_STACK_TRACE_TSK
1146 # LIBCFS_LOCKDEP_IS_HELD
1148 # Kernel v4.15-rc8-106-g08f36ff64234
1149 # lockdep: Make lockdep checking constant
1151 AC_DEFUN([LIBCFS_LOCKDEP_IS_HELD], [
1152 tmp_flags="$EXTRA_KCFLAGS"
1153 EXTRA_KCFLAGS="-Werror"
1154 LB_CHECK_COMPILE([if 'lockdep_is_held()' uses const argument],
1156 #include <linux/lockdep.h>
1158 #ifdef CONFIG_LOCKDEP
1159 const struct spinlock *lock = NULL;
1161 lockdep_is_held(lock);
1164 AC_DEFINE(NEED_LOCKDEP_IS_HELD_DISCARD_CONST, 1,
1165 [lockdep_is_held() argument is const])
1167 EXTRA_KCFLAGS="$tmp_flags"
1168 ]) # LIBCFS_LOCKDEP_IS_HELD
1171 # LIBCFS_TIMER_SETUP
1173 # Kernel version 4.15 commit e99e88a9d2b067465adaa9c111ada99a041bef9a
1174 # setup_timer() was replaced by timer_setup(), where the callback
1175 # argument is the structure already holding the struct timer_list.
1177 AC_DEFUN([LIBCFS_TIMER_SETUP], [
1178 LB_CHECK_COMPILE([if setup_timer has been replaced with timer_setup],
1180 #include <linux/timer.h>
1182 timer_setup(NULL, NULL, 0);
1184 AC_DEFINE(HAVE_TIMER_SETUP, 1,
1185 [timer_setup has replaced setup_timer])
1187 ]) # LIBCFS_TIMER_SETUP
1190 # LIBCFS_WAIT_VAR_EVENT
1192 # Kernel version 4.16-rc4 commit 6b2bb7265f0b62605e8caee3613449ed0db270b9
1193 # added wait_var_event()
1195 AC_DEFUN([LIBCFS_WAIT_VAR_EVENT], [
1196 LB_CHECK_COMPILE([if 'wait_var_event' exist],
1198 #ifdef HAVE_WAIT_BIT_HEADER_H
1199 #include <linux/wait_bit.h>
1201 #include <linux/wait.h>
1205 AC_DEFINE(HAVE_WAIT_VAR_EVENT, 1,
1206 ['wait_var_event' is available])
1208 ]) # LIBCFS_WAIT_VAR_EVENT
1211 # LIBCFS_BITMAP_ALLOC
1213 # Kernel version 4.17 commit c42b65e363ce97a828f81b59033c3558f8fa7f70
1214 # added bitmap memory allocation handling.
1216 AC_DEFUN([LIBCFS_BITMAP_ALLOC], [
1217 LB_CHECK_COMPILE([if Linux bitmap memory management exist],
1219 #include <linux/bitmap.h>
1221 unsigned long *map = bitmap_alloc(1, GFP_KERNEL);
1223 AC_DEFINE(HAVE_BITMAP_ALLOC, 1,
1224 [Linux bitmap can be allocated])
1226 ]) # LIBCFS_BITMAP_ALLOC
1229 # LIBCFS_CLEAR_AND_WAKE_UP_BIT
1231 # Kernel version 4.17-rc2 commit 8236b0ae31c837d2b3a2565c5f8d77f637e824cc
1232 # added clear_and_wake_up_bit()
1234 AC_DEFUN([LIBCFS_CLEAR_AND_WAKE_UP_BIT], [
1235 LB_CHECK_COMPILE([if 'clear_and_wake_up_bit' exist],
1236 clear_and_wake_up_bit, [
1237 #ifdef HAVE_WAIT_BIT_HEADER_H
1238 #include <linux/wait_bit.h>
1240 #include <linux/wait.h>
1242 clear_and_wake_up_bit(0, NULL);
1244 AC_DEFINE(HAVE_CLEAR_AND_WAKE_UP_BIT, 1,
1245 ['clear_and_wake_up_bit' is available])
1247 ]) # LIBCFS_CLEAR_AND_WAKE_UP_BIT
1250 # LIBCFS_TCP_SOCK_SET_NODELAY
1252 # kernel 4.18.0-293.el8
1253 # tcp_sock_set_nodelay() was added
1254 AC_DEFUN([LIBCFS_TCP_SOCK_SET_NODELAY], [
1255 tmp_flags="$EXTRA_KCFLAGS"
1256 EXTRA_KCFLAGS="-Werror"
1257 LB_CHECK_COMPILE([if 'tcp_sock_set_nodelay()' exists],
1258 tcp_sock_set_nodelay_exists, [
1259 #include <linux/tcp.h>
1261 tcp_sock_set_nodelay(NULL);
1263 AC_DEFINE(HAVE_TCP_SOCK_SET_NODELAY, 1,
1264 ['tcp_sock_set_nodelay()' exists])
1266 EXTRA_KCFLAGS="$tmp_flags"
1267 ]) # LIBCFS_TCP_SOCK_SET_NODELAY
1270 # LIBCFS_TCP_SOCK_SET_KEEPIDLE
1272 # kernel 4.18.0-293.el8
1273 # tcp_sock_set_keepidle() was added
1274 AC_DEFUN([LIBCFS_TCP_SOCK_SET_KEEPIDLE], [
1275 tmp_flags="$EXTRA_KCFLAGS"
1276 EXTRA_KCFLAGS="-Werror"
1277 LB_CHECK_COMPILE([if 'tcp_sock_set_keepidle()' exists],
1278 tcp_sock_set_keepidle_exists, [
1279 #include <linux/tcp.h>
1281 tcp_sock_set_keepidle(NULL, 0);
1283 AC_DEFINE(HAVE_TCP_SOCK_SET_KEEPIDLE, 1,
1284 ['tcp_sock_set_keepidle()' exists])
1286 EXTRA_KCFLAGS="$tmp_flags"
1287 ]) # LIBCFS_TCP_SOCK_SET_KEEPIDLE
1290 # LIBCFS_TCP_SOCK_SET_QUICKACK
1291 # kernel v5.7-rc6-2504-gddd061b8daed
1292 # tcp: add tcp_sock_set_quickack
1294 AC_DEFUN([LIBCFS_TCP_SOCK_SET_QUICKACK], [
1295 tmp_flags="$EXTRA_KCFLAGS"
1296 EXTRA_KCFLAGS="-Werror"
1297 LB_CHECK_COMPILE([if 'tcp_sock_set_quickack()' exists],
1298 tcp_sock_set_quickack_exists, [
1299 #include <linux/tcp.h>
1301 tcp_sock_set_quickack(NULL, 0);
1303 AC_DEFINE(HAVE_TCP_SOCK_SET_QUICKACK, 1,
1304 ['tcp_sock_set_quickack()' exists])
1306 EXTRA_KCFLAGS="$tmp_flags"
1307 ]) # LIBCFS_TCP_SOCK_SET_QUICKACK
1310 # LIBCFS_TCP_SOCK_SET_KEEPINTVL
1311 # v5.7-rc6-2508-gd41ecaac903c
1312 # tcp: add tcp_sock_set_keepintvl
1314 AC_DEFUN([LIBCFS_TCP_SOCK_SET_KEEPINTVL], [
1315 tmp_flags="$EXTRA_KCFLAGS"
1316 EXTRA_KCFLAGS="-Werror"
1317 LB_CHECK_COMPILE([if 'tcp_sock_set_keepintvl()' exists],
1318 tcp_sock_set_keepintvl_exists, [
1319 #include <linux/tcp.h>
1321 tcp_sock_set_keepintvl(NULL, 0);
1323 AC_DEFINE(HAVE_TCP_SOCK_SET_KEEPINTVL, 1,
1324 ['tcp_sock_set_keepintvl()' exists])
1326 EXTRA_KCFLAGS="$tmp_flags"
1327 ]) # LIBCFS_TCP_SOCK_SET_KEEPINTVL
1330 # LIBCFS_TCP_SOCK_SET_KEEPCNT
1331 # v5.7-rc6-2509-g480aeb9639d6
1332 # tcp: add tcp_sock_set_keepcnt
1334 AC_DEFUN([LIBCFS_TCP_SOCK_SET_KEEPCNT], [
1335 tmp_flags="$EXTRA_KCFLAGS"
1336 EXTRA_KCFLAGS="-Werror"
1337 LB_CHECK_COMPILE([if 'tcp_sock_set_keepcnt()' exists],
1338 tcp_sock_set_keepcnt_exists, [
1339 #include <linux/tcp.h>
1341 tcp_sock_set_keepcnt(NULL, 0);
1343 AC_DEFINE(HAVE_TCP_SOCK_SET_KEEPCNT, 1,
1344 ['tcp_sock_set_keepcnt()' exists])
1346 EXTRA_KCFLAGS="$tmp_flags"
1347 ]) # LIBCFS_TCP_SOCK_SET_KEEPCNT
1350 # LIBCFS_XARRAY_SUPPORT
1352 # 4.19-rc5 kernel commit 3159f943aafdbacb2f94c38fdaadabf2bbde2a14
1353 # replaced the radix tree implementation with Xarrays. This change
1354 # introduced functionaly needed for general Xarray support
1356 AC_DEFUN([LIBCFS_XARRAY_SUPPORT], [
1357 tmp_flags="$EXTRA_KCFLAGS"
1358 EXTRA_KCFLAGS="-Werror"
1359 LB_CHECK_COMPILE([if page cache uses Xarray],
1361 #include <linux/xarray.h>
1365 AC_DEFINE(HAVE_XARRAY_SUPPORT, 1,
1366 [kernel Xarray implementation lacks 'xa_is_value'])
1368 EXTRA_KCFLAGS="$tmp_flags"
1369 ]) # LIBCFS_XARRAY_SUPPORT
1372 # Kernel version 4.19-rc6 commit 4a19edb60d0203cd5bf95a8b46ea8f63fd41194c
1373 # added extended ACK handling to Netlink dump handlers
1375 AC_DEFUN([LIBCFS_NL_DUMP_EXT_ACK], [
1376 LB_CHECK_COMPILE([if Netlink dump handlers support ext_ack],
1377 netlink_dump_ext_ack, [
1378 #include <net/netlink.h>
1380 struct netlink_callback *cb = NULL;
1383 AC_DEFINE(HAVE_NL_DUMP_WITH_EXT_ACK, 1,
1384 [netlink_ext_ack is handled for Netlink dump handlers])
1386 ]) # LIBCFS_NL_DUMP_EXT_ACK
1389 # LIBCFS_HAVE_IOV_ITER_TYPE
1391 # kernel 4.20 commit 00e23707442a75b404392cef1405ab4fd498de6b
1392 # iov_iter: Use accessor functions to access an iterator's type and direction.
1394 AC_DEFUN([LIBCFS_HAVE_IOV_ITER_TYPE], [
1395 tmp_flags="$EXTRA_KCFLAGS"
1396 EXTRA_KCFLAGS="-Werror"
1397 LB_CHECK_COMPILE([if iov_iter_type exists],
1398 macro_iov_iter_type_exists, [
1399 #include <linux/uio.h>
1401 struct iov_iter iter = { .type = ITER_KVEC };
1402 enum iter_type type = iov_iter_type(&iter);
1405 AC_DEFINE(HAVE_IOV_ITER_TYPE, 1,
1406 [if iov_iter_type exists])
1408 EXTRA_KCFLAGS="$tmp_flags"
1409 ]) # LIBCFS_HAVE_IOV_ITER_TYPE
1412 # LIBCFS_GET_REQUEST_KEY_AUTH
1414 # kernel 5.0 commit 822ad64d7e46a8e2c8b8a796738d7b657cbb146d
1415 # keys: Fix dependency loop between construction record and auth key
1417 # Added <keys/request_key_auth-type.h> and get_request_key_auth()
1418 # which was propagated to stable
1420 AC_DEFUN([LIBCFS_GET_REQUEST_KEY_AUTH], [
1421 tmp_flags="$EXTRA_KCFLAGS"
1422 EXTRA_KCFLAGS="-Werror"
1423 LB_CHECK_COMPILE([if get_request_key_auth() is available],
1424 get_request_key_auth_exported, [
1425 #include <linux/key.h>
1426 #include <linux/keyctl.h>
1427 #include <keys/request_key_auth-type.h>
1430 const struct key *key = NULL;
1431 struct request_key_auth *rka = get_request_key_auth(key);
1433 ring = key_get(rka->dest_keyring);
1435 AC_DEFINE(HAVE_GET_REQUEST_KEY_AUTH, 1,
1436 [get_request_key_auth() is available])
1438 EXTRA_KCFLAGS="$tmp_flags"
1439 ]) # LIBCFS_GET_REQUEST_KEY_AUTH
1442 # LIBCFS_LOOKUP_USER_KEY
1444 # kernel 5.3 commit 3cf5d076fb4d48979f382bc9452765bf8b79e740
1445 # signal: Remove task parameter from force_sig
1447 AC_DEFUN([LIBCFS_LOOKUP_USER_KEY], [
1448 tmp_flags="$EXTRA_KCFLAGS"
1449 EXTRA_KCFLAGS="-Werror"
1450 LB_CHECK_COMPILE([if lookup_user_key() is available],
1451 lookup_user_key_exported, [
1452 #include <linux/key.h>
1453 #include <linux/keyctl.h>
1455 lookup_user_key(KEY_SPEC_USER_KEYRING, 0, 0);
1457 AC_DEFINE(HAVE_LOOKUP_USER_KEY, 1,
1458 [lookup_user_key() is available])
1460 EXTRA_KCFLAGS="$tmp_flags"
1461 ]) # LIBCFS_LOOKUP_USER_KEY
1464 # LIBCFS_FORCE_SIG_WITH_TASK
1466 # kernel 5.3 commit 3cf5d076fb4d48979f382bc9452765bf8b79e740
1467 # signal: Remove task parameter from force_sig
1469 AC_DEFUN([LIBCFS_FORCE_SIG_WITH_TASK], [
1470 tmp_flags="$EXTRA_KCFLAGS"
1471 EXTRA_KCFLAGS="-Werror"
1472 LB_CHECK_COMPILE([if force_sig has task parameter],
1473 force_sig_with_task, [
1474 #include <linux/sched/signal.h>
1476 force_sig(SIGINT, NULL);
1478 AC_DEFINE(HAVE_FORCE_SIG_WITH_TASK, 1,
1479 [force_sig() has task parameter])
1481 EXTRA_KCFLAGS="$tmp_flags"
1482 ]) # LIBCFS_FORCE_SIG_WITH_TASK
1485 # LIBCFS_CACHE_DETAIL_WRITERS
1487 # kernel v5.3-rc2-1-g64a38e840ce5
1488 # SUNRPC: Track writers of the 'channel' file to improve cache_listeners_exist
1490 AC_DEFUN([LIBCFS_CACHE_DETAIL_WRITERS], [
1491 tmp_flags="$EXTRA_KCFLAGS"
1492 EXTRA_KCFLAGS="-Werror"
1493 LB_CHECK_COMPILE([if struct cache_detail has writers],
1494 cache_detail_writers_atomic, [
1495 #include <linux/sunrpc/cache.h>
1497 static struct cache_detail rsi_cache;
1499 atomic_set(&rsi_cache.writers, 0);
1501 AC_DEFINE(HAVE_CACHE_DETAIL_WRITERS, 1,
1502 [struct cache_detail has writers])
1504 EXTRA_KCFLAGS="$tmp_flags"
1505 ]) # LIBCFS_CACHE_DETAIL_WRITERS
1508 # LIBCFS_KALLSYMS_LOOKUP
1510 # kernel v5.6-11591-g0bd476e6c671
1511 # kallsyms: unexport kallsyms_lookup_name() and kallsyms_on_each_symbol()
1512 AC_DEFUN([LIBCFS_KALLSYMS_LOOKUP], [
1513 LB_CHECK_EXPORT([kallsyms_lookup_name], [kernel/kallsyms.c],
1514 [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
1515 [kallsyms_lookup_name is exported by kernel])])
1516 ]) # LIBCFS_KALLSYMS_LOOKUP
1519 # v5.5-8862-gd56c0d45f0e2
1520 # proc: decouple proc from VFS with "struct proc_ops"
1522 AC_DEFUN([LIBCFS_SRC_HAVE_PROC_OPS], [
1523 LB2_LINUX_TEST_SRC([proc_ops], [
1524 #include <linux/proc_fs.h>
1526 static struct proc_ops *my_proc;
1528 my_proc->proc_lseek = NULL;
1530 ]) # LIBCFS_SRC_HAVE_PROC_OPS
1531 AC_DEFUN([LIBCFS_HAVE_PROC_OPS], [
1532 AC_MSG_CHECKING([if struct proc_ops exists])
1533 LB2_LINUX_TEST_RESULT([proc_ops], [
1534 AC_DEFINE(HAVE_PROC_OPS, 1,
1535 [struct proc_ops exists])
1540 ]) # LIBCFS_HAVE_PROC_OPS
1543 # LIBCFS_VMALLOC_2ARGS
1545 # kernel v5.8-rc1~201^2~19
1546 # mm: remove the pgprot argument to __vmalloc
1547 AC_DEFUN([LIBCFS_VMALLOC_2ARGS], [
1548 LB_CHECK_COMPILE([if __vmalloc has 2 args],
1550 #include <linux/vmalloc.h>
1554 AC_DEFINE(HAVE_VMALLOC_2ARGS, 1,
1555 [__vmalloc only takes 2 args.])
1557 ]) # LIBCFS_VMALLOC_2ARGS
1560 # LIBCFS_HAVE_NR_UNSTABLE_NFS
1562 # kernel v5.8-rc1~201^2~75
1563 # mm/writeback: discard NR_UNSTABLE_NFS, use NR_WRITEBACK instead
1565 AC_DEFUN([LIBCFS_HAVE_NR_UNSTABLE_NFS], [
1566 tmp_flags="$EXTRA_KCFLAGS"
1567 EXTRA_KCFLAGS="-Werror"
1568 LB_CHECK_COMPILE([if NR_UNSTABLE_NFS still in use],
1569 nr_unstable_nfs_exists, [
1570 #include <linux/mm.h>
1574 i = NR_UNSTABLE_NFS;
1576 AC_DEFINE(HAVE_NR_UNSTABLE_NFS, 1,
1577 [NR_UNSTABLE_NFS is still in use.])
1579 EXTRA_KCFLAGS="$tmp_flags"
1580 ]) # LIBCFS_HAVE_NR_UNSTABLE_NFS
1583 # LIBCFS_HAVE_MMAP_LOCK
1585 # kernel v5.8-rc1~83^2~24
1586 # mmap locking API: rename mmap_sem to mmap_lock
1588 AC_DEFUN([LIBCFS_HAVE_MMAP_LOCK], [
1589 LB_CHECK_COMPILE([if mmap_lock API is available],
1591 #include <linux/mm.h>
1593 mmap_write_lock(NULL);
1595 AC_DEFINE(HAVE_MMAP_LOCK, 1,
1596 [mmap_lock API is available.])
1598 ]) # LIBCFS_HAVE_MMAP_LOCK
1601 # LIBCFS_KERNEL_SETSOCKOPT
1603 # kernel v5.8-rc1~165^2~59^2
1604 # net: remove kernel_setsockopt
1605 AC_DEFUN([LIBCFS_KERNEL_SETSOCKOPT], [
1606 tmp_flags="$EXTRA_KCFLAGS"
1607 EXTRA_KCFLAGS="-Werror"
1608 LB_CHECK_COMPILE([if kernel_setsockopt still in use],
1609 kernel_setsockopt_exists, [
1610 #include <linux/net.h>
1612 kernel_setsockopt(NULL, 0, 0, NULL, 0);
1614 AC_DEFINE(HAVE_KERNEL_SETSOCKOPT, 1,
1615 [kernel_setsockopt still in use])
1617 EXTRA_KCFLAGS="$tmp_flags"
1618 ]) # LIBCFS_KERNEL_SETSOCKOPT
1621 # LIBCFS_SEC_RELEASE_SECCTX
1623 # kernel linux-hwe-5.8 (5.8.0-22.23~20.04.1)
1624 # LSM: Use lsmcontext in security_release_secctx
1625 AC_DEFUN([LIBCFS_SEC_RELEASE_SECCTX], [
1626 LB_CHECK_COMPILE([if security_release_secctx has 1 arg],
1627 security_release_secctx_1arg, [
1628 #include <linux/security.h>
1630 security_release_secctx(NULL);
1632 AC_DEFINE(HAVE_SEC_RELEASE_SECCTX_1ARG, 1,
1633 [security_release_secctx has 1 arg.])
1635 ]) # LIBCFS_SEC_RELEASE_SECCTX
1638 # LIBCFS_HAVE_KFREE_SENSITIVE
1640 # kernel v5.10-rc1~3
1641 # mm: remove kzfree() compatibility definition
1643 AC_DEFUN([LIBCFS_HAVE_KFREE_SENSITIVE], [
1644 LB_CHECK_COMPILE([if kfree_sensitive() is available],
1645 kfree_sensitive_exists, [
1646 #include <linux/slab.h>
1649 kfree_sensitive(NULL);
1651 AC_DEFINE(HAVE_KFREE_SENSITIVE, 1,
1652 [kfree_sensitive() is available.])
1654 EXTRA_KCFLAGS="$tmp_flags"
1655 ]) # LIBCFS_HAVE_KFREE_SENSITIVE
1658 # LIBCFS_HAVE_CRYPTO_SHA2_HEADER
1660 # Kernel v5.10-rc1-114-ga24d22b225ce
1661 # crypto: sha - split sha.h into sha1.h and sha2.h
1663 AC_DEFUN([LIBCFS_HAVE_CRYPTO_SHA2_HEADER], [
1664 LB_CHECK_LINUX_HEADER([crypto/sha2.h], [
1665 AC_DEFINE(HAVE_CRYPTO_SHA2_HEADER, 1,
1666 [crypto/sha2.h is present])])
1667 ]) # LIBCFS_HAVE_CRYPTO_SHA2_HEADER
1669 AC_DEFUN([LIBCFS_PROG_LINUX_SRC], [
1670 LIBCFS_SRC_HAVE_PROC_OPS
1672 AC_MSG_CHECKING([for available kernel interfaces to libcfs])
1673 LB2_LINUX_TEST_COMPILE_ALL([libcfs])
1674 AC_MSG_RESULT([done])
1676 AC_DEFUN([LIBCFS_PROG_LINUX_RESULTS], [
1678 LIBCFS_HAVE_PROC_OPS
1684 # LibCFS linux kernel checks
1686 AC_DEFUN([LIBCFS_PROG_LINUX], [
1687 AC_MSG_NOTICE([LibCFS kernel checks
1688 ==============================================================================])
1689 LIBCFS_CONFIG_PANIC_DUMPLOG
1692 LIBCFS_KTIME_GET_TS64
1694 LIBCFS_PREPARE_TO_WAIT_EVENT
1695 LIBCFS_KERNEL_PARAM_OPS
1699 LIBCFS_KTIME_COMPARE
1700 LIBCFS_SHRINKER_COUNT
1702 LIBCFS_HAVE_MAPPING_AS_EXITING_FLAG
1703 LIBCFS_IOV_ITER_HAS_TYPE
1705 LIBCFS_HAVE_NS_TO_TIMESPEC64
1707 LIBCFS_HLIST_ADD_AFTER
1710 LIBCFS_KTIME_GET_REAL_TS64
1711 LIBCFS_KTIME_GET_REAL_SECONDS
1712 LIBCFS_KTIME_GET_REAL_NS
1713 LIBCFS_KTIME_TO_TIMESPEC64
1714 LIBCFS_TIMESPEC64_SUB
1715 LIBCFS_TIMESPEC64_TO_KTIME
1717 LIBCFS_KTIME_GET_SECONDS
1720 LIBCFS_KTIME_MS_DELTA
1722 LIBCFS_KERNEL_PARAM_LOCK
1724 LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
1726 LIBCFS_KSTRTOBOOL_FROM_USER
1727 LIBCFS_NETLINK_CALLBACK_START
1729 LIBCFS_CRYPTO_HASH_HELPERS
1730 LIBCFS_EXPORT_KSET_FIND_OBJ
1731 LIBCFS_RHASHTABLE_REPLACE
1733 LIBCFS_BROKEN_HASH_64
1734 LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
1735 LIBCFS_GET_USER_PAGES_6ARG
1738 LIBCFS_RHASHTABLE_INSERT_FAST
1739 LIBCFS_RHASHTABLE_WALK_INIT_3ARG
1741 LIBCFS_RHASHTABLE_LOOKUP
1743 LIBCFS_STACKTRACE_OPS
1745 LIBCFS_GET_USER_PAGES_GUP_FLAGS
1746 LIBCFS_RHASHTABLE_WALK_ENTER
1748 LIBCFS_HOTPLUG_STATE_MACHINE
1751 LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST
1752 LIBCFS_SCHED_HEADERS
1754 LIBCFS_RHT_BUCKET_VAR
1756 LIBCFS_HAVE_PROCESSOR_HEADER
1757 LIBCFS_HAVE_WAIT_BIT_HEADER
1758 LIBCFS_MEMALLOC_NORECLAIM
1760 LIBCFS_WAIT_QUEUE_TASK_LIST_RENAME
1761 LIBCFS_CPUS_READ_LOCK
1765 LIBCFS_WAIT_QUEUE_ENTRY
1768 LIBCFS_NEW_KERNEL_WRITE
1769 LIBCFS_NEW_KERNEL_READ
1770 LIBCFS_EXPORT_SAVE_STACK_TRACE_TSK
1772 LIBCFS_LOCKDEP_IS_HELD
1775 LIBCFS_WAIT_VAR_EVENT
1778 LIBCFS_CLEAR_AND_WAKE_UP_BIT
1780 LIBCFS_TCP_SOCK_SET_NODELAY
1781 LIBCFS_TCP_SOCK_SET_KEEPIDLE
1783 LIBCFS_XARRAY_SUPPORT
1784 LIBCFS_NL_DUMP_EXT_ACK
1786 LIBCFS_HAVE_IOV_ITER_TYPE
1788 LIBCFS_MM_TOTALRAM_PAGES_FUNC
1789 LIBCFS_GET_REQUEST_KEY_AUTH
1791 LIBCFS_LOOKUP_USER_KEY
1792 LIBCFS_FORCE_SIG_WITH_TASK
1793 LIBCFS_CACHE_DETAIL_WRITERS
1794 LIBCFS_HAVE_NR_UNSTABLE_NFS
1796 LIBCFS_KALLSYMS_LOOKUP
1797 LIBCFS_TCP_SOCK_SET_QUICKACK
1798 LIBCFS_TCP_SOCK_SET_KEEPINTVL
1799 LIBCFS_TCP_SOCK_SET_KEEPCNT
1801 LIBCFS_HAVE_MMAP_LOCK
1802 LIBCFS_KERNEL_SETSOCKOPT
1803 LIBCFS_VMALLOC_2ARGS
1804 LIBCFS_SEC_RELEASE_SECCTX
1806 LIBCFS_HAVE_KFREE_SENSITIVE
1807 LIBCFS_HAVE_CRYPTO_SHA2_HEADER
1808 ]) # LIBCFS_PROG_LINUX
1811 # LIBCFS_PATH_DEFAULTS
1813 # default paths for installed files
1815 AC_DEFUN([LIBCFS_PATH_DEFAULTS], [
1816 ]) # LIBCFS_PATH_DEFAULTS
1821 # other configure checks
1823 AC_DEFUN([LIBCFS_CONFIGURE], [
1824 AC_MSG_NOTICE([LibCFS core checks
1825 ==============================================================================])
1827 # libcfs/libcfs/util/nidstrings.c
1828 AC_CHECK_HEADERS([netdb.h asm/types.h endian.h])
1829 AC_CHECK_FUNCS([gethostbyname])
1831 # -------- Check for required packages --------------
1833 AC_MSG_NOTICE([LibCFS required packages checks
1834 ==============================================================================])
1836 AC_MSG_CHECKING([whether to enable readline support])
1837 AC_ARG_ENABLE(readline,
1838 AC_HELP_STRING([--disable-readline],
1839 [disable readline support]),
1840 [], [enable_readline="yes"])
1841 AC_MSG_RESULT([$enable_readline])
1844 AS_IF([test "x$enable_readline" = xyes], [
1845 AC_CHECK_LIB([readline], [readline], [
1846 LIBREADLINE="-lreadline"
1847 AC_DEFINE(HAVE_LIBREADLINE, 1,
1848 [readline library is available])
1851 AC_SUBST(LIBREADLINE)
1853 AC_MSG_CHECKING([whether to use libpthread for libcfs library])
1854 AC_ARG_ENABLE([libpthread],
1855 AC_HELP_STRING([--disable-libpthread],
1856 [disable libpthread]),
1857 [], [enable_libpthread="yes"])
1858 AC_MSG_RESULT([$enable_libpthread])
1861 AS_IF([test "x$enable_libpthread" = xyes], [
1862 AC_CHECK_LIB([pthread], [pthread_create], [
1863 PTHREAD_LIBS="-lpthread"
1864 AC_DEFINE([HAVE_LIBPTHREAD], 1,
1865 [use libpthread for libcfs library])
1868 AC_MSG_WARN([Using libpthread for libcfs library is disabled explicitly])
1870 AC_SUBST(PTHREAD_LIBS)
1871 ]) # LIBCFS_CONFIGURE
1874 # LIBCFS_CONFIG_FILES
1876 # files that should be generated with AC_OUTPUT
1878 AC_DEFUN([LIBCFS_CONFIG_FILES], [
1882 libcfs/autoconf/Makefile
1883 libcfs/include/Makefile
1884 libcfs/include/libcfs/Makefile
1885 libcfs/include/uapi/Makefile
1886 libcfs/include/libcfs/linux/Makefile
1887 libcfs/include/libcfs/util/Makefile
1888 libcfs/include/libcfs/crypto/Makefile
1889 libcfs/include/uapi/linux/Makefile
1890 libcfs/libcfs/Makefile
1891 libcfs/libcfs/autoMakefile
1892 libcfs/libcfs/linux/Makefile
1893 libcfs/libcfs/util/Makefile
1894 libcfs/libcfs/crypto/Makefile
1896 ]) # LIBCFS_CONFIG_FILES