From f28d7ed454d6abcd776aed1c84013fbf3055651e Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 14 Dec 2018 15:43:41 -0700 Subject: [PATCH] LU-8130 libcfs: don't include rhashtable if unavailable Don't include if it is not available. Lustre-change: https://review.whamcloud.com/34020 Lustre-commit: 29d627f860bc1963f2103ea441577dbd18d71344 Fixes: ac8d93c9f6f9 ("LU-8130 libcfs: support latest rhashtable API") Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I80b2ee63fb2a438399359f8052a5063429254035 Reviewed-by: Ben Evans Reviewed-by: Patrick Farrell Reviewed-on: https://review.whamcloud.com/35565 Tested-by: Maloo Tested-by: jenkins Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- libcfs/autoconf/lustre-libcfs.m4 | 12 ++++++++++++ libcfs/include/libcfs/linux/linux-hash.h | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index 807e683..06b6502 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -389,6 +389,16 @@ shrinker_count_objects, [ ]) # LIBCFS_SHRINKER_COUNT # +# Kernel version 3.16 added rhashtable.h in 7e1e77636e36075eb +# +AC_DEFUN([LIBCFS_LINUX_RHASHTABLE_H],[ +LB_CHECK_LINUX_HEADER([linux/rhashtable.h], [ + AC_DEFINE(HAVE_LINUX_RHASHTABLE_H, 1, + [linux/rhashtable.h is present]) +]) +]) # LIBCFS_LINUX_RHASHTABLE_H + +# # Kernel version 3.17 changed hlist_add_after to # hlist_add_behind # @@ -1013,6 +1023,8 @@ LIBCFS_KTIME_AFTER LIBCFS_KTIME_BEFORE LIBCFS_KTIME_COMPARE LIBCFS_SHRINKER_COUNT +# 3.16 +LIBCFS_LINUX_RHASHTABLE_H # 3.17 LIBCFS_HLIST_ADD_AFTER LIBCFS_TIMESPEC64 diff --git a/libcfs/include/libcfs/linux/linux-hash.h b/libcfs/include/libcfs/linux/linux-hash.h index c38d561..ea4ecbe 100644 --- a/libcfs/include/libcfs/linux/linux-hash.h +++ b/libcfs/include/libcfs/linux/linux-hash.h @@ -24,7 +24,6 @@ #define __LIBCFS_LINUX_HASH_H__ #include -#include u64 cfs_hashlen_string(const void *salt, const char *name); @@ -38,6 +37,9 @@ u64 cfs_hashlen_string(const void *salt, const char *name); #endif #endif /* !HAVE_STRINGHASH */ +#ifdef HAVE_LINUX_RHASHTABLE_H +#include + #ifndef HAVE_RHLTABLE struct rhlist_head { struct rhash_head rhead; @@ -209,5 +211,9 @@ restart: return NULL; } #endif /* !HAVE_RHASHTABLE_LOOKUP */ +#else +#define rhashtable_init(ht, param) 0 +#define rhashtable_destroy(ht) do {} while (0) +#endif /* HAVE_LINUX_RHASHTABLE_H */ #endif /* __LIBCFS_LINUX_HASH_H__ */ -- 1.8.3.1