Whamcloud - gitweb
LU-11803 obd: replace class_uuid with linux kernel version.
[fs/lustre-release.git] / libcfs / autoconf / lustre-libcfs.m4
index d437331..82a4ebc 100644 (file)
@@ -85,22 +85,6 @@ stacktrace_ops_warning, [
 ]) # LIBCFS_STACKTRACE_WARNING
 
 #
-# LIBCFS_REINIT_COMPLETION
-#
-AC_DEFUN([LIBCFS_REINIT_COMPLETION], [
-LB_CHECK_COMPILE([if 'reinit_completion' exists],
-reinit_completion, [
-       #include <linux/completion.h>
-],[
-       struct completion x;
-       reinit_completion(&x);
-],[
-       AC_DEFINE(HAVE_REINIT_COMPLETION, 1,
-               [reinit_completion is exist])
-])
-]) # LIBCFS_REINIT_COMPLETION
-
-#
 # LC_SHRINKER_WANT_SHRINK_PTR
 #
 # RHEL6/2.6.32 want to have pointer to shrinker self pointer in handler function
@@ -581,27 +565,6 @@ ktime_get_seconds, [
 ]) # LIBCFS_KTIME_GET_SECONDS
 
 #
-# Kernel version 3.19 commit 5aaba36318e5995e8c95d077a46d9a4d00fcc1cd
-# This patch creates a new helper function cpumap_print_to_pagebuf in
-# cpumask.h using newly added bitmap_print_to_pagebuf and consolidates
-# most of those sysfs functions using the new helper function.
-#
-AC_DEFUN([LIBCFS_HAVE_CPUMASK_PRINT_TO_PAGEBUF],[
-LB_CHECK_COMPILE([does function 'cpumap_print_to_pagebuf' exist],
-cpumap_print_to_pagebuf, [
-       #include <linux/topology.h>
-],[
-       int n;
-       char *buf = NULL;
-       const struct cpumask *mask = NULL;
-       n = cpumap_print_to_pagebuf(true, buf, mask);
-],[
-       AC_DEFINE(HAVE_CPUMASK_PRINT_TO_PAGEBUF, 1,
-               [cpumap_print_to_pagebuf is available])
-])
-]) # LIBCFS_HAVE_CPUMASK_PRINT_TO_PAGEBUF
-
-#
 # Kernel version 4.0 commit 41fbf3b39d5eca01527338b4d0ee15ee1ae1023c
 # introduced the helper function ktime_ms_delta.
 #
@@ -712,6 +675,22 @@ LB_CHECK_EXPORT([kset_find_obj], [lib/kobject.c],
 ]) # LIBCFS_EXPORT_KSET_FIND_OBJ
 
 #
+# Kernel version 4.6+ commit ef703f49a6c5b909a85149bb6625c4ed0d697186
+# fixed the brokenness of hash_64(). The fix removed GOLDEN_RATIO_PRIME_64
+# since it was a poor prime value.
+#
+AC_DEFUN([LIBCFS_BROKEN_HASH_64], [
+LB_CHECK_COMPILE([kernel has fixed hash_64()],
+broken_hash_64, [
+       #include <linux/hash.h>
+],[
+       int tmp = GOLDEN_RATIO_PRIME_64;
+],[
+       AC_DEFINE(HAVE_BROKEN_HASH_64, 1, [kernel hash_64() is broken])
+])
+]) # LIBCFS_BROKEN_HASH_64
+
+#
 # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
 #
 # linux 4.6 kernel changed stacktrace_ops address to return an int
@@ -761,6 +740,70 @@ LB_CHECK_LINUX_HEADER([linux/stringhash.h], [
 ]) # LIBCFS_STRINGHASH
 
 #
+# LIBCFS_RHASHTABLE_INSERT_FAST
+#
+# 4.7+ kernel commit 5ca8cc5bf11faed257c762018aea9106d529232f
+# changed __rhashtable_insert_fast to support the new function
+# rhashtable_lookup_get_insert_key().
+#
+AC_DEFUN([LIBCFS_RHASHTABLE_INSERT_FAST], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if internal '__rhashtable_insert_fast()' returns int],
+rhashtable_insert_fast, [
+       #include <linux/rhashtable.h>
+],[
+       const struct rhashtable_params params = { 0 };
+       int rc;
+
+       rc = __rhashtable_insert_fast(NULL, NULL, NULL, params);
+],[
+       AC_DEFINE(HAVE_HASHTABLE_INSERT_FAST_RETURN_INT, 1,
+                 ['__rhashtable_insert_fast()' returns int])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LIBCFS_RHASHTABLE_INSERT_FAST
+
+#
+# Kernel version 4.8-rc6 commit ca26893f05e86497a86732768ec53cd38c0819ca
+# introduced rhashtable_lookup
+#
+AC_DEFUN([LIBCFS_RHASHTABLE_LOOKUP], [
+LB_CHECK_COMPILE([if 'rhashtable_lookup' exist],
+rhashtable_lookup, [
+       #include <linux/rhashtable.h>
+],[
+       const struct rhashtable_params params = { 0 };
+       void *ret;
+
+       ret = rhashtable_lookup(NULL, NULL, params);
+],[
+       AC_DEFINE(HAVE_RHASHTABLE_LOOKUP, 1,
+               [rhashtable_lookup() is available])
+])
+]) # LIBCFS_RHASHTABLE_LOOKUP
+
+#
+# LIBCFS_RHLTABLE
+# Kernel version 4.8-rc6 commit ca26893f05e86497a86732768ec53cd38c0819ca
+# created the rhlist interface to allow inserting duplicate objects
+# into the same table.
+#
+AC_DEFUN([LIBCFS_RHLTABLE], [
+LB_CHECK_COMPILE([does 'struct rhltable' exist],
+rhtable, [
+       #include <linux/rhashtable.h>
+],[
+       struct rhltable *hlt;
+
+       rhltable_destroy(hlt);
+],[
+       AC_DEFINE(HAVE_RHLTABLE, 1,
+                 [struct rhltable exist])
+])
+]) # LIBCFS_RHLTABLE
+
+#
 # LIBCFS_STACKTRACE_OPS
 #
 # Kernel version 4.8 commit c8fe4609827aedc9c4b45de80e7cdc8ccfa8541b
@@ -845,6 +888,23 @@ rhashtable_lookup_get_insert_fast, [
 ]) # LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST
 
 #
+# Kernel version 4.12-rc3 f9727a17db9bab71ddae91f74f11a8a2f9a0ece6
+# renamed uuid_be to uuid_t
+#
+AC_DEFUN([LIBCFS_UUID_T], [
+LB_CHECK_COMPILE([if 'uuid_t' exist],
+uuid_t, [
+       #include <linux/uuid.h>
+],[
+       uuid_t uuid;
+
+       memset(uuid.b, 0, 16);
+],[
+       AC_DEFINE(HAVE_UUID_T, 1, ['uuid_t' exist])
+])
+]) # LIBCFS_UUID_T
+
+#
 # LIBCFS_WAIT_QUEUE_ENTRY
 #
 # Kernel version 4.13 ac6424b981bce1c4bc55675c6ce11bfe1bbfa64f
@@ -951,7 +1011,6 @@ LIBCFS_DUMP_TRACE_ADDRESS
 LC_SHRINK_CONTROL
 # 3.0
 LIBCFS_STACKTRACE_WARNING
-LIBCFS_REINIT_COMPLETION
 # 3.5
 LIBCFS_PROCESS_NAMESPACE
 LIBCFS_I_UID_READ
@@ -981,7 +1040,6 @@ LIBCFS_TIMESPEC64_SUB
 LIBCFS_TIMESPEC64_TO_KTIME
 # 3.19
 LIBCFS_KTIME_GET_SECONDS
-LIBCFS_HAVE_CPUMASK_PRINT_TO_PAGEBUF
 # 4.0
 LIBCFS_KTIME_MS_DELTA
 # 4.1
@@ -995,10 +1053,15 @@ LIBCFS_KSTRTOBOOL_FROM_USER
 LIBCFS_CRYPTO_HASH_HELPERS
 LIBCFS_EXPORT_KSET_FIND_OBJ
 # 4.6
+LIBCFS_BROKEN_HASH_64
 LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT
 LIBCFS_GET_USER_PAGES_6ARG
 LIBCFS_STRINGHASH
+# 4.7
+LIBCFS_RHASHTABLE_INSERT_FAST
 # 4.8
+LIBCFS_RHASHTABLE_LOOKUP
+LIBCFS_RHLTABLE
 LIBCFS_STACKTRACE_OPS
 # 4.9
 LIBCFS_GET_USER_PAGES_GUP_FLAGS
@@ -1007,6 +1070,8 @@ LIBCFS_HOTPLUG_STATE_MACHINE
 # 4.11
 LIBCFS_RHASHTABLE_LOOKUP_GET_INSERT_FAST
 LIBCFS_SCHED_HEADERS
+# 4.12
+LIBCFS_UUID_T
 # 4.13
 LIBCFS_WAIT_QUEUE_ENTRY
 # 4.14