Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix config issues: frame size and headers
1. With various (debug and/or tracing?) kernel options enabled it's possible for 'struct inode' and 'struct super_block' to exceed the default frame size, leaving errors like this in config.log: build/conftest.c:116:1: error: the frame size of 1048 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] Fix this by removing the frame size warning for config checks 2. Without the correct headers included, it's possible for declarations to be missed, leaving errors like this in the config.log: build/conftest.c:131:14: error: ‘struct nameidata’ declared inside parameter list [-Werror] Fix this by adding appropriate headers. Note: Both these issues can result in silent config failures because the compile failure is taken to mean "this option is not supported by this kernel" rather than "there's something wrong with the config test". This can lead to something merely annoying (compile failures) to something potentially serious (miscompiled or misused kernel primitives or functions). E.g. the fixes included here resulted in these additional defines in zfs_config.h with linux v4.14.19: Also, drive-by whitespace fixes in config/* files which don't mention "GNU" (those ones look to be imported from elsewhere so leave them alone). Signed-off-by: Chris Dunlop <chris@onthe.net.au> diff --git a/config/kernel-acl.m4 b/config/kernel-acl.m4 index 3114843..02cc020 100644 --- a/config/kernel-acl.m4 +++ b/config/kernel-acl.m4 @@ -184,6 +184,7 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [ AC_MSG_CHECKING([whether iops->permission() wants nameidata]) ZFS_LINUX_TRY_COMPILE([ #include <linux/fs.h> + #include <linux/sched.h> int permission_fn(struct inode *inode, int mask, struct nameidata *nd) { return 0; } diff --git a/config/kernel-create-nameidata.m4 b/config/kernel-create-nameidata.m4 index a71490a..d4c155c 100644 --- a/config/kernel-create-nameidata.m4 +++ b/config/kernel-create-nameidata.m4 @@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [ AC_MSG_CHECKING([whether iops->create() passes nameidata]) ZFS_LINUX_TRY_COMPILE([ #include <linux/fs.h> + #include <linux/sched.h> #ifdef HAVE_MKDIR_UMODE_T int inode_create(struct inode *inode ,struct dentry *dentry, diff --git a/config/kernel-current-time.m4 b/config/kernel-current-time.m4 index 2ede9ff..aec6a5b 100644 --- a/config/kernel-current-time.m4 +++ b/config/kernel-current-time.m4 @@ -5,8 +5,8 @@ AC_DEFUN([ZFS_AC_KERNEL_CURRENT_TIME], [AC_MSG_CHECKING([whether current_time() exists]) ZFS_LINUX_TRY_COMPILE_SYMBOL([ #include <linux/fs.h> - ], [ struct inode ip; + ], [ struct timespec now __attribute__ ((unused)); now = current_time(&ip); diff --git a/config/kernel-dentry-operations.m4 b/config/kernel-dentry-operations.m4 index 3182490..61f5a27 100644 --- a/config/kernel-dentry-operations.m4 +++ b/config/kernel-dentry-operations.m4 @@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA], [ AC_MSG_CHECKING([whether dops->d_revalidate() takes struct nameidata]) ZFS_LINUX_TRY_COMPILE([ #include <linux/dcache.h> + #include <linux/sched.h> int revalidate (struct dentry *dentry, struct nameidata *nidata) { return 0; } diff --git a/config/kernel-inode-set-flags.m4 b/config/kernel-inode-set-flags.m4 index e0ad267..287317b 100644 --- a/config/kernel-inode-set-flags.m4 +++ b/config/kernel-inode-set-flags.m4 @@ -6,8 +6,8 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_SET_FLAGS], [ AC_MSG_CHECKING([whether inode_set_flags() exists]) ZFS_LINUX_TRY_COMPILE([ #include <linux/fs.h> - ],[ struct inode inode; + ],[ inode_set_flags(&inode, S_IMMUTABLE, S_IMMUTABLE); ],[ AC_MSG_RESULT(yes) diff --git a/config/kernel-lookup-nameidata.m4 b/config/kernel-lookup-nameidata.m4 index 43f5fb4..5453be5 100644 --- a/config/kernel-lookup-nameidata.m4 +++ b/config/kernel-lookup-nameidata.m4 @@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [ AC_MSG_CHECKING([whether iops->lookup() passes nameidata]) ZFS_LINUX_TRY_COMPILE([ #include <linux/fs.h> + #include <linux/sched.h> struct dentry *inode_lookup(struct inode *inode, struct dentry *dentry, struct nameidata *nidata) diff --git a/config/kernel-set-nlink.m4 b/config/kernel-set-nlink.m4 index f7ffc0d..07a2ac8 100644 --- a/config/kernel-set-nlink.m4 +++ b/config/kernel-set-nlink.m4 @@ -6,8 +6,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SET_NLINK], [ AC_MSG_CHECKING([whether set_nlink() is available]) ZFS_LINUX_TRY_COMPILE([ #include <linux/fs.h> - ],[ struct inode node; + ],[ unsigned int link = 0; (void) set_nlink(&node, link); ],[ diff --git a/config/kernel-shrink.m4 b/config/kernel-shrink.m4 index a57c2af..4feb499 100644 --- a/config/kernel-shrink.m4 +++ b/config/kernel-shrink.m4 @@ -54,8 +54,8 @@ AC_DEFUN([ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD], [ AC_MSG_CHECKING([whether super_block has s_instances list_head]) ZFS_LINUX_TRY_COMPILE([ #include <linux/fs.h> - ],[ struct super_block sb __attribute__ ((unused)); + ],[ INIT_LIST_HEAD(&sb.s_instances); ],[
- Loading branch information