From 725ea49d8bd42e5acad2045acb3b6f72969c08ff Mon Sep 17 00:00:00 2001 From: James Simmons Date: Sun, 28 Aug 2016 14:59:46 -0400 Subject: [PATCH] LU-8560 libcfs: add autoconf test for crypto changes For linux 4.5 kernels the simple ifdef test in linux-crypto.c worked but with linux 4.6+ kernels we need to add a proper crypto api test for the new inline functions crypto_ahash_alg_name() and crypto_ahash_driver_name(). Test-Parameters: trivial Change-Id: Ic18808b622d374cf6dc2417220ed83adc43ea692 Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/22205 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- libcfs/autoconf/lustre-libcfs.m4 | 19 +++++++++++++++++++ libcfs/libcfs/linux/linux-crypto.c | 4 +--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index cc0e184..d7e1a45 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -322,6 +322,23 @@ LB_CHECK_LINUX_HEADER([asm/fpu/api.h], [ ]) # LIBCFS_FPU_API # +# Kernel version 4.5-rc1 commit d12481bc58fba89427565f8592e88446ec084a24 +# added crypto hash helpers +# +AC_DEFUN([LIBCFS_CRYPTO_HASH_HELPERS], [ +LB_CHECK_COMPILE([does crypto hash helper functions exist], +crypto_hash_helpers, [ + #include +],[ + crypto_ahash_alg_name(NULL); + crypto_ahash_driver_name(NULL); +],[ + AC_DEFINE(HAVE_CRYPTO_HASH_HELPERS, 1, + [crypto hash helper functions are available]) +]) +]) # LIBCFS_CRYPTO_HASH_HELPERS + +# # LIBCFS_PROG_LINUX # # LibCFS linux kernel checks @@ -361,6 +378,8 @@ LIBCFS_HLIST_ADD_AFTER # 4.2 LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK LIBCFS_FPU_API +# 4.5 +LIBCFS_CRYPTO_HASH_HELPERS ]) # LIBCFS_PROG_LINUX # diff --git a/libcfs/libcfs/linux/linux-crypto.c b/libcfs/libcfs/linux/linux-crypto.c index 6d01de3..a8c2ccd 100644 --- a/libcfs/libcfs/linux/linux-crypto.c +++ b/libcfs/libcfs/linux/linux-crypto.c @@ -33,14 +33,12 @@ #include #include -#ifndef crypto_ahash_alg_name +#ifndef HAVE_CRYPTO_HASH_HELPERS static inline const char *crypto_ahash_alg_name(struct crypto_ahash *tfm) { return crypto_tfm_alg_name(crypto_ahash_tfm(tfm)); } -#endif -#ifndef crypto_ahash_driver_name static inline const char *crypto_ahash_driver_name(struct crypto_ahash *tfm) { return crypto_tfm_alg_driver_name(crypto_ahash_tfm(tfm)); -- 1.8.3.1