Skip to content

Commit

Permalink
Remove compat includes from sys/types.h
Browse files Browse the repository at this point in the history
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 <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#411
  • Loading branch information
nedbass authored and behlendorf committed Nov 19, 2014
1 parent 8d9a23e commit 52479ec
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 22 deletions.
1 change: 1 addition & 0 deletions include/linux/wait_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#ifndef _SPL_WAIT_COMPAT_H
#define _SPL_WAIT_COMPAT_H

#include <linux/sched.h>

#ifndef HAVE_WAIT_ON_BIT_ACTION
# define spl_wait_on_bit(word, bit, mode) wait_on_bit(word, bit, mode)
Expand Down
12 changes: 0 additions & 12 deletions include/sys/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@
#include <linux/types.h>
#include <sys/sysmacros.h>

#include <linux/file_compat.h>
#include <linux/list_compat.h>
#include <linux/bitops_compat.h>
#include <linux/module_compat.h>
#include <linux/proc_compat.h>
#include <linux/math64_compat.h>
#include <linux/zlib_compat.h>
#include <linux/mm_compat.h>
#include <linux/delay.h>
#include <linux/wait_compat.h>
#include <linux/uaccess.h>

#ifndef ULLONG_MAX
#define ULLONG_MAX (~0ULL)
#endif
Expand Down
1 change: 1 addition & 0 deletions module/spl/spl-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <sys/kstat.h>
#include <sys/file.h>
#include <linux/kmod.h>
#include <linux/math64_compat.h>
#include <linux/proc_compat.h>

char spl_version[32] = "SPL v" SPL_META_VERSION "-" SPL_META_RELEASE;
Expand Down
2 changes: 2 additions & 0 deletions module/spl/spl-kmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
\*****************************************************************************/

#include <sys/kmem.h>
#include <linux/mm_compat.h>
#include <linux/wait_compat.h>

/*
* Within the scope of spl-kmem.c file the kmem_cache_* definitions
Expand Down
1 change: 1 addition & 0 deletions module/spl/spl-vnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <sys/cred.h>
#include <sys/vnode.h>
#include <linux/falloc.h>
#include <linux/file_compat.h>

vnode_t *rootdir = (vnode_t *)0xabcd1234;
EXPORT_SYMBOL(rootdir);
Expand Down
1 change: 1 addition & 0 deletions module/spl/spl-zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

#include <sys/kmem.h>
#include <sys/zmod.h>
#include <linux/zlib_compat.h>

static spl_kmem_cache_t *zlib_workspace_cache;

Expand Down
1 change: 1 addition & 0 deletions module/splat/splat-atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <sys/atomic.h>
#include <sys/thread.h>
#include <sys/mutex.h>
#include <linux/mm_compat.h>
#include <linux/slab.h>
#include "splat-internal.h"

Expand Down
15 changes: 8 additions & 7 deletions module/splat/splat-ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,17 @@
* of regression tests or particular tests.
\*****************************************************************************/

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <sys/debug.h>
#include <sys/mutex.h>
#include <sys/types.h>
#include <linux/cdev.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/miscdevice.h>
#include <sys/types.h>
#include <sys/debug.h>
#include <sys/mutex.h>
#include <linux/module.h>
#include <linux/module_compat.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/vmalloc.h>
#include "splat-internal.h"

static struct list_head splat_module_list;
Expand Down
1 change: 1 addition & 0 deletions module/splat/splat-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
\*****************************************************************************/

#include <sys/sunddi.h>
#include <linux/math64_compat.h>
#include "splat-internal.h"

#define SPLAT_GENERIC_NAME "generic"
Expand Down
1 change: 1 addition & 0 deletions module/splat/splat-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
\*****************************************************************************/

#include <sys/kmem.h>
#include <linux/mm_compat.h>
#include "splat-internal.h"

#define SPLAT_LINUX_NAME "linux"
Expand Down
2 changes: 2 additions & 0 deletions module/splat/splat-mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#include <sys/mutex.h>
#include <sys/taskq.h>
#include <linux/delay.h>
#include <linux/mm_compat.h>
#include "splat-internal.h"

#define SPLAT_MUTEX_NAME "mutex"
Expand Down
4 changes: 3 additions & 1 deletion module/splat/splat-rwlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
* Solaris Porting LAyer Tests (SPLAT) Read/Writer Lock Tests.
\*****************************************************************************/

#include <sys/random.h>
#include <sys/rwlock.h>
#include <sys/taskq.h>
#include <sys/random.h>
#include <linux/delay.h>
#include <linux/mm_compat.h>
#include "splat-internal.h"

#define SPLAT_RWLOCK_NAME "rwlock"
Expand Down
5 changes: 3 additions & 2 deletions module/splat/splat-taskq.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
* Solaris Porting LAyer Tests (SPLAT) Task Queue Tests.
\*****************************************************************************/

#include <sys/taskq.h>
#include <sys/random.h>
#include <sys/kmem.h>
#include <sys/random.h>
#include <sys/taskq.h>
#include <linux/delay.h>
#include "splat-internal.h"

#define SPLAT_TASKQ_NAME "taskq"
Expand Down
2 changes: 2 additions & 0 deletions module/splat/splat-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#include <sys/thread.h>
#include <sys/random.h>
#include <linux/delay.h>
#include <linux/mm_compat.h>
#include <linux/slab.h>
#include "splat-internal.h"

Expand Down
1 change: 1 addition & 0 deletions module/splat/splat-time.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
\*****************************************************************************/

#include <sys/time.h>
#include <linux/mm_compat.h>
#include <linux/slab.h>
#include "splat-internal.h"

Expand Down

0 comments on commit 52479ec

Please sign in to comment.