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 <rkitover@gmail.com>
Reviewed-by: Coleman Kane <ckane@colemankane.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #11387
Closes #11390
This commit is contained in:
Brian Behlendorf 2020-12-23 11:40:02 -08:00
parent 8fbd31d761
commit c347fac586
6 changed files with 28 additions and 17 deletions

View File

@ -11,7 +11,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE], [
], [ ], [
struct posix_acl *tmp = posix_acl_alloc(1, 0); struct posix_acl *tmp = posix_acl_alloc(1, 0);
posix_acl_release(tmp); posix_acl_release(tmp);
], [], [$ZFS_META_LICENSE]) ], [], [ZFS_META_LICENSE])
]) ])
AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_RELEASE], [ 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); struct posix_acl *acl = posix_acl_alloc(1, 0);
set_cached_acl(ip, ACL_TYPE_ACCESS, acl); set_cached_acl(ip, ACL_TYPE_ACCESS, acl);
forget_cached_acl(ip, ACL_TYPE_ACCESS); forget_cached_acl(ip, ACL_TYPE_ACCESS);
], [], [$ZFS_META_LICENSE]) ], [], [ZFS_META_LICENSE])
]) ])
AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [ AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [

View File

@ -188,7 +188,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_SET_DEV], [
struct block_device *bdev = NULL; struct block_device *bdev = NULL;
struct bio *bio = NULL; struct bio *bio = NULL;
bio_set_dev(bio, bdev); bio_set_dev(bio, bdev);
], [], [$ZFS_META_LICENSE]) ], [], [ZFS_META_LICENSE])
]) ])
AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [ 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)) = {}; struct blkcg_gq blkg __attribute__ ((unused)) = {};
bool rc __attribute__ ((unused)); bool rc __attribute__ ((unused));
rc = blkg_tryget(&blkg); rc = blkg_tryget(&blkg);
], [], [$ZFS_META_LICENSE]) ], [], [ZFS_META_LICENSE])
]) ])
AC_DEFUN([ZFS_AC_KERNEL_BLKG_TRYGET], [ AC_DEFUN([ZFS_AC_KERNEL_BLKG_TRYGET], [

View File

@ -179,7 +179,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [
], [ ], [
struct request_queue *q = NULL; struct request_queue *q = NULL;
(void) blk_queue_flush(q, REQ_FLUSH); (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], [ ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [
#include <linux/kernel.h> #include <linux/kernel.h>
@ -187,7 +187,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [
], [ ], [
struct request_queue *q = NULL; struct request_queue *q = NULL;
blk_queue_write_cache(q, true, true); 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], [ AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [

View File

@ -86,7 +86,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC], [
mutex_init(&lock); mutex_init(&lock);
mutex_lock(&lock); mutex_lock(&lock);
mutex_unlock(&lock); mutex_unlock(&lock);
], [], [$ZFS_META_LICENSE]) ], [], [ZFS_META_LICENSE])
]) ])
AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [ AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [

View File

@ -42,7 +42,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
], [ ], [
kernel_fpu_begin(); kernel_fpu_begin();
kernel_fpu_end(); kernel_fpu_end();
], [], [$ZFS_META_LICENSE]) ], [], [ZFS_META_LICENSE])
ZFS_LINUX_TEST_SRC([__kernel_fpu], [ ZFS_LINUX_TEST_SRC([__kernel_fpu], [
#include <linux/types.h> #include <linux/types.h>
@ -55,7 +55,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_FPU], [
], [ ], [
__kernel_fpu_begin(); __kernel_fpu_begin();
__kernel_fpu_end(); __kernel_fpu_end();
], [], [$ZFS_META_LICENSE]) ], [], [ZFS_META_LICENSE])
ZFS_LINUX_TEST_SRC([fpu_internal], [ ZFS_LINUX_TEST_SRC([fpu_internal], [
#if defined(__x86_64) || defined(__x86_64__) || \ #if defined(__x86_64) || defined(__x86_64__) || \

View File

@ -543,7 +543,9 @@ dnl #
dnl # ZFS_LINUX_TEST_PROGRAM(C)([PROLOGUE], [BODY]) dnl # ZFS_LINUX_TEST_PROGRAM(C)([PROLOGUE], [BODY])
dnl # dnl #
m4_define([ZFS_LINUX_TEST_PROGRAM], [ m4_define([ZFS_LINUX_TEST_PROGRAM], [
#include <linux/module.h>
$1 $1
int int
main (void) main (void)
{ {
@ -551,6 +553,11 @@ $2
; ;
return 0; return 0;
} }
MODULE_DESCRIPTION("conftest");
MODULE_AUTHOR(ZFS_META_AUTHOR);
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
MODULE_LICENSE($3);
]) ])
dnl # dnl #
@ -690,19 +697,21 @@ dnl # $3 - source
dnl # $4 - extra cflags dnl # $4 - extra cflags
dnl # $5 - check license-compatibility dnl # $5 - check license-compatibility
dnl # 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 # 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 # must never depend on the results of previous tests. Each test
dnl # needs to be entirely independent. dnl # needs to be entirely independent.
dnl # dnl #
AC_DEFUN([ZFS_LINUX_TEST_SRC], [ 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]) ZFS_LINUX_CONFTEST_MAKEFILE([$1], [yes], [$4])
AS_IF([ test -n "$5" ], [ AS_IF([ test -n "$5" ], [
ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM([[ ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM(
#include <linux/module.h> [[$2]], [[$3]], [[$5]])], [$1_license])
MODULE_LICENSE("$5");
$2]], [[$3]])], [$1_license])
ZFS_LINUX_CONFTEST_MAKEFILE([$1_license], [yes], [$4]) ZFS_LINUX_CONFTEST_MAKEFILE([$1_license], [yes], [$4])
]) ])
]) ])
@ -792,11 +801,13 @@ dnl #
AC_DEFUN([ZFS_LINUX_TRY_COMPILE], [ AC_DEFUN([ZFS_LINUX_TRY_COMPILE], [
AS_IF([test "x$enable_linux_builtin" = "xyes"], [ AS_IF([test "x$enable_linux_builtin" = "xyes"], [
ZFS_LINUX_COMPILE_IFELSE( 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]) [test -f build/conftest/conftest.o], [$3], [$4])
], [ ], [
ZFS_LINUX_COMPILE_IFELSE( 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]) [test -f build/conftest/conftest.ko], [$3], [$4])
]) ])
]) ])
@ -862,7 +873,7 @@ dnl # provided via the fifth parameter
dnl # dnl #
AC_DEFUN([ZFS_LINUX_TRY_COMPILE_HEADER], [ AC_DEFUN([ZFS_LINUX_TRY_COMPILE_HEADER], [
ZFS_LINUX_COMPILE_IFELSE( 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], [test -f build/conftest/conftest.ko],
[$3], [$4], [$5]) [$3], [$4], [$5])
]) ])