From 52479ecf58fa89190e384edcf838fecccc786af5 Mon Sep 17 00:00:00 2001 From: Ned Bass Date: Fri, 14 Nov 2014 10:18:05 -0800 Subject: [PATCH] Remove compat includes from sys/types.h Don't include the compatibility code in linux/*_compat.h in the public header sys/types.h. This causes problems when an external code base includes the ZFS headers and has its own conflicting compatibility code. Lustre, in particular, defined SHRINK_STOP for compatibility with pre-3.12 kernels in a way that conflicted with the SPL's definition. Because Lustre ZFS OSD includes ZFS headers it fails to build due to a '"SHRINK_STOP" redefined' compiler warning. To avoid such conflicts only include the compat headers from .c files or private headers. Also, for consistency, include sys/*.h before linux/*.h then sort by header name. Signed-off-by: Ned Bass Signed-off-by: Brian Behlendorf Closes #411 --- include/linux/wait_compat.h | 1 + include/sys/types.h | 12 ------------ module/spl/spl-generic.c | 1 + module/spl/spl-kmem.c | 2 ++ module/spl/spl-vnode.c | 1 + module/spl/spl-zlib.c | 1 + module/splat/splat-atomic.c | 1 + module/splat/splat-ctl.c | 17 +++++++++-------- module/splat/splat-generic.c | 1 + module/splat/splat-linux.c | 1 + module/splat/splat-mutex.c | 2 ++ module/splat/splat-rwlock.c | 4 +++- module/splat/splat-taskq.c | 5 +++-- module/splat/splat-thread.c | 2 ++ module/splat/splat-time.c | 1 + 15 files changed, 29 insertions(+), 23 deletions(-) diff --git a/include/linux/wait_compat.h b/include/linux/wait_compat.h index 66f9a9a613..d8cd09b9eb 100644 --- a/include/linux/wait_compat.h +++ b/include/linux/wait_compat.h @@ -25,6 +25,7 @@ #ifndef _SPL_WAIT_COMPAT_H #define _SPL_WAIT_COMPAT_H +#include #ifndef HAVE_WAIT_ON_BIT_ACTION # define spl_wait_on_bit(word, bit, mode) wait_on_bit(word, bit, mode) diff --git a/include/sys/types.h b/include/sys/types.h index b7b8b7bfc3..3b3a42edeb 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -28,18 +28,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #ifndef ULLONG_MAX #define ULLONG_MAX (~0ULL) #endif diff --git a/module/spl/spl-generic.c b/module/spl/spl-generic.c index ecfb663de5..803f03a859 100644 --- a/module/spl/spl-generic.c +++ b/module/spl/spl-generic.c @@ -39,6 +39,7 @@ #include #include #include +#include #include char spl_version[32] = "SPL v" SPL_META_VERSION "-" SPL_META_RELEASE; diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c index 37849f504e..502f5365b6 100644 --- a/module/spl/spl-kmem.c +++ b/module/spl/spl-kmem.c @@ -25,6 +25,8 @@ \*****************************************************************************/ #include +#include +#include /* * Within the scope of spl-kmem.c file the kmem_cache_* definitions diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index cac0aaf292..e5db0ec2cc 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -27,6 +27,7 @@ #include #include #include +#include vnode_t *rootdir = (vnode_t *)0xabcd1234; EXPORT_SYMBOL(rootdir); diff --git a/module/spl/spl-zlib.c b/module/spl/spl-zlib.c index 2b8aab8656..2967b03cea 100644 --- a/module/spl/spl-zlib.c +++ b/module/spl/spl-zlib.c @@ -55,6 +55,7 @@ #include #include +#include static spl_kmem_cache_t *zlib_workspace_cache; diff --git a/module/splat/splat-atomic.c b/module/splat/splat-atomic.c index 7a1bd859d8..a270dc42f9 100644 --- a/module/splat/splat-atomic.c +++ b/module/splat/splat-atomic.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include "splat-internal.h" diff --git a/module/splat/splat-ctl.c b/module/splat/splat-ctl.c index 46bc6d1a68..bedf5d2d87 100644 --- a/module/splat/splat-ctl.c +++ b/module/splat/splat-ctl.c @@ -43,16 +43,17 @@ * of regression tests or particular tests. \*****************************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "splat-internal.h" static struct list_head splat_module_list; diff --git a/module/splat/splat-generic.c b/module/splat/splat-generic.c index ad03651d00..3f8119b1ee 100644 --- a/module/splat/splat-generic.c +++ b/module/splat/splat-generic.c @@ -25,6 +25,7 @@ \*****************************************************************************/ #include +#include #include "splat-internal.h" #define SPLAT_GENERIC_NAME "generic" diff --git a/module/splat/splat-linux.c b/module/splat/splat-linux.c index 880b301525..3652267f94 100644 --- a/module/splat/splat-linux.c +++ b/module/splat/splat-linux.c @@ -24,6 +24,7 @@ \*****************************************************************************/ #include +#include #include "splat-internal.h" #define SPLAT_LINUX_NAME "linux" diff --git a/module/splat/splat-mutex.c b/module/splat/splat-mutex.c index cc1d368696..909d730cb0 100644 --- a/module/splat/splat-mutex.c +++ b/module/splat/splat-mutex.c @@ -26,6 +26,8 @@ #include #include +#include +#include #include "splat-internal.h" #define SPLAT_MUTEX_NAME "mutex" diff --git a/module/splat/splat-rwlock.c b/module/splat/splat-rwlock.c index 6faf7d24e2..6c623792e6 100644 --- a/module/splat/splat-rwlock.c +++ b/module/splat/splat-rwlock.c @@ -24,9 +24,11 @@ * Solaris Porting LAyer Tests (SPLAT) Read/Writer Lock Tests. \*****************************************************************************/ +#include #include #include -#include +#include +#include #include "splat-internal.h" #define SPLAT_RWLOCK_NAME "rwlock" diff --git a/module/splat/splat-taskq.c b/module/splat/splat-taskq.c index 33e49b2f12..6c2b435798 100644 --- a/module/splat/splat-taskq.c +++ b/module/splat/splat-taskq.c @@ -24,9 +24,10 @@ * Solaris Porting LAyer Tests (SPLAT) Task Queue Tests. \*****************************************************************************/ -#include -#include #include +#include +#include +#include #include "splat-internal.h" #define SPLAT_TASKQ_NAME "taskq" diff --git a/module/splat/splat-thread.c b/module/splat/splat-thread.c index e55acd0c8c..3255e37e5b 100644 --- a/module/splat/splat-thread.c +++ b/module/splat/splat-thread.c @@ -26,6 +26,8 @@ #include #include +#include +#include #include #include "splat-internal.h" diff --git a/module/splat/splat-time.c b/module/splat/splat-time.c index cd513c93f9..b4e94c8662 100644 --- a/module/splat/splat-time.c +++ b/module/splat/splat-time.c @@ -25,6 +25,7 @@ \*****************************************************************************/ #include +#include #include #include "splat-internal.h"