From 944180ab50dd883d9efc2efbdaee787ca8ac9607 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 23 Dec 2020 11:40:02 -0800 Subject: [PATCH] Linux 5.11 compat: conftest Update the ZFS_LINUX_TEST_PROGRAM macro to always set the module license. As of the 5.11 kernel not setting a license has been converted from a warning to an error. Reviewed-by: Rafael Kitover Reviewed-by: Coleman Kane Signed-off-by: Brian Behlendorf Closes #11387 Closes #11390 --- config/kernel-acl.m4 | 4 ++-- config/kernel-bio.m4 | 4 ++-- config/kernel-blk-queue.m4 | 4 ++-- config/kernel-config-defined.m4 | 2 +- config/kernel-fpu.m4 | 4 ++-- config/kernel.m4 | 27 +++++++++++++++++++-------- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/config/kernel-acl.m4 b/config/kernel-acl.m4 index 0f1c24656730..e02ce665323f 100644 --- a/config/kernel-acl.m4 +++ b/config/kernel-acl.m4 @@ -11,7 +11,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE], [ ], [ struct posix_acl *tmp = posix_acl_alloc(1, 0); posix_acl_release(tmp); - ], [], [$ZFS_META_LICENSE]) + ], [], [ZFS_META_LICENSE]) ]) AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_RELEASE], [ @@ -50,7 +50,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE], [ struct posix_acl *acl = posix_acl_alloc(1, 0); set_cached_acl(ip, ACL_TYPE_ACCESS, acl); forget_cached_acl(ip, ACL_TYPE_ACCESS); - ], [], [$ZFS_META_LICENSE]) + ], [], [ZFS_META_LICENSE]) ]) AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [ diff --git a/config/kernel-bio.m4 b/config/kernel-bio.m4 index 534282780d3e..0c533531dceb 100644 --- a/config/kernel-bio.m4 +++ b/config/kernel-bio.m4 @@ -188,7 +188,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_SET_DEV], [ struct block_device *bdev = NULL; struct bio *bio = NULL; bio_set_dev(bio, bdev); - ], [], [$ZFS_META_LICENSE]) + ], [], [ZFS_META_LICENSE]) ]) AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [ @@ -347,7 +347,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKG_TRYGET], [ struct blkcg_gq blkg __attribute__ ((unused)) = {}; bool rc __attribute__ ((unused)); rc = blkg_tryget(&blkg); - ], [], [$ZFS_META_LICENSE]) + ], [], [ZFS_META_LICENSE]) ]) AC_DEFUN([ZFS_AC_KERNEL_BLKG_TRYGET], [ diff --git a/config/kernel-blk-queue.m4 b/config/kernel-blk-queue.m4 index 382ebefd34a3..ff2da92e9ee1 100644 --- a/config/kernel-blk-queue.m4 +++ b/config/kernel-blk-queue.m4 @@ -179,7 +179,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [ ], [ struct request_queue *q = NULL; (void) blk_queue_flush(q, REQ_FLUSH); - ], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE]) + ], [$NO_UNUSED_BUT_SET_VARIABLE], [ZFS_META_LICENSE]) ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [ #include @@ -187,7 +187,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [ ], [ struct request_queue *q = NULL; blk_queue_write_cache(q, true, true); - ], [$NO_UNUSED_BUT_SET_VARIABLE], [$ZFS_META_LICENSE]) + ], [$NO_UNUSED_BUT_SET_VARIABLE], [ZFS_META_LICENSE]) ]) AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [ diff --git a/config/kernel-config-defined.m4 b/config/kernel-config-defined.m4 index fe778e649454..9b9468269ca3 100644 --- a/config/kernel-config-defined.m4 +++ b/config/kernel-config-defined.m4 @@ -86,7 +86,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC], [ mutex_init(&lock); mutex_lock(&lock); mutex_unlock(&lock); - ], [], [$ZFS_META_LICENSE]) + ], [], [ZFS_META_LICENSE]) ]) AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [ diff --git a/config/kernel-fpu.m4 b/config/kernel-fpu.m4 index 3c7933413d18..4d6fe052289c 100644 --- a/config/kernel-fpu.m4 +++ b/config/kernel-fpu.m4 @@ -42,7 +42,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [ ], [ kernel_fpu_begin(); kernel_fpu_end(); - ], [], [$ZFS_META_LICENSE]) + ], [], [ZFS_META_LICENSE]) ZFS_LINUX_TEST_SRC([__kernel_fpu], [ #include @@ -55,7 +55,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [ ], [ __kernel_fpu_begin(); __kernel_fpu_end(); - ], [], [$ZFS_META_LICENSE]) + ], [], [ZFS_META_LICENSE]) ZFS_LINUX_TEST_SRC([fpu_internal], [ #if defined(__x86_64) || defined(__x86_64__) || \ diff --git a/config/kernel.m4 b/config/kernel.m4 index 296af2cb3d77..002ba2eea559 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -541,7 +541,9 @@ dnl # dnl # ZFS_LINUX_TEST_PROGRAM(C)([PROLOGUE], [BODY]) dnl # m4_define([ZFS_LINUX_TEST_PROGRAM], [ +#include $1 + int main (void) { @@ -549,6 +551,11 @@ $2 ; return 0; } + +MODULE_DESCRIPTION("conftest"); +MODULE_AUTHOR(ZFS_META_AUTHOR); +MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE); +MODULE_LICENSE($3); ]) dnl # @@ -688,19 +695,21 @@ dnl # $3 - source dnl # $4 - extra cflags dnl # $5 - check license-compatibility dnl # +dnl # Check if the test source is buildable at all and then if it is +dnl # license compatible. +dnl # dnl # N.B because all of the test cases are compiled in parallel they dnl # must never depend on the results of previous tests. Each test dnl # needs to be entirely independent. dnl # AC_DEFUN([ZFS_LINUX_TEST_SRC], [ - ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM([[$2]], [[$3]])], [$1]) + ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM([[$2]], [[$3]], + [["Dual BSD/GPL"]])], [$1]) ZFS_LINUX_CONFTEST_MAKEFILE([$1], [yes], [$4]) AS_IF([ test -n "$5" ], [ - ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM([[ - #include - MODULE_LICENSE("$5"); - $2]], [[$3]])], [$1_license]) + ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM( + [[$2]], [[$3]], [[$5]])], [$1_license]) ZFS_LINUX_CONFTEST_MAKEFILE([$1_license], [yes], [$4]) ]) ]) @@ -790,11 +799,13 @@ dnl # AC_DEFUN([ZFS_LINUX_TRY_COMPILE], [ AS_IF([test "x$enable_linux_builtin" = "xyes"], [ ZFS_LINUX_COMPILE_IFELSE( - [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]])], + [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]], + [[ZFS_META_LICENSE]])], [test -f build/conftest/conftest.o], [$3], [$4]) ], [ ZFS_LINUX_COMPILE_IFELSE( - [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]])], + [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]], + [[ZFS_META_LICENSE]])], [test -f build/conftest/conftest.ko], [$3], [$4]) ]) ]) @@ -860,7 +871,7 @@ dnl # provided via the fifth parameter dnl # AC_DEFUN([ZFS_LINUX_TRY_COMPILE_HEADER], [ ZFS_LINUX_COMPILE_IFELSE( - [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]])], + [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]], [[ZFS_META_LICENSE]])], [test -f build/conftest/conftest.ko], [$3], [$4], [$5]) ])