Skip to content

Commit

Permalink
Refactor zfs_context.h to build on FreeBSD
Browse files Browse the repository at this point in the history
- on Linux move Linux specific headers to zfs_context_os.h
- on FreeBSD move FreeBSD specific definitions to zfs_context_os.h
- remove duplicate tsd_ definitions
- remove unused AT_TYPE

Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
  • Loading branch information
mattmacy committed Dec 3, 2019
1 parent 5142032 commit d2cbc2b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
1 change: 1 addition & 0 deletions include/os/linux/zfs/sys/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ KERNEL_H = \
$(top_srcdir)/include/os/linux/zfs/sys/trace_zil.h \
$(top_srcdir)/include/os/linux/zfs/sys/trace_zio.h \
$(top_srcdir)/include/os/linux/zfs/sys/trace_zrlock.h \
$(top_srcdir)/include/os/linux/zfs/sys/zfs_context_os.h \
$(top_srcdir)/include/os/linux/zfs/sys/zfs_ctldir.h \
$(top_srcdir)/include/os/linux/zfs/sys/zfs_dir.h \
$(top_srcdir)/include/os/linux/zfs/sys/zfs_vfsops.h \
Expand Down
3 changes: 3 additions & 0 deletions include/os/linux/zfs/sys/zfs_context_os.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <sys/uio_impl.h>
#include <linux/dcache_compat.h>
#include <linux/utsname_compat.h>
22 changes: 4 additions & 18 deletions include/sys/zfs_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#define _SYS_ZFS_CONTEXT_H

#ifdef __KERNEL__

#include <sys/note.h>
#include <sys/types.h>
#include <sys/atomic.h>
Expand All @@ -48,7 +47,6 @@
#include <sys/strings.h>
#include <sys/byteorder.h>
#include <sys/list.h>
#include <sys/uio_impl.h>
#include <sys/time.h>
#include <sys/zone.h>
#include <sys/kstat.h>
Expand All @@ -61,11 +59,8 @@
#include <sys/disp.h>
#include <sys/trace.h>
#include <sys/procfs_list.h>
#include <linux/dcache_compat.h>
#include <linux/utsname_compat.h>
#include <sys/mod.h>
#include <sys/sysmacros.h>

#include <sys/zfs_context_os.h>
#else /* _KERNEL */

#define _SYS_MUTEX_H
Expand All @@ -88,7 +83,6 @@
#include <pthread.h>
#include <setjmp.h>
#include <assert.h>
#include <alloca.h>
#include <umem.h>
#include <limits.h>
#include <atomic.h>
Expand All @@ -101,7 +95,6 @@
#include <sys/types.h>
#include <sys/cred.h>
#include <sys/sysmacros.h>
#include <sys/bitmap.h>
#include <sys/resource.h>
#include <sys/byteorder.h>
#include <sys/list.h>
Expand All @@ -117,6 +110,8 @@
#include <sys/utsname.h>
#include <sys/trace_zfs.h>

#include <sys/zfs_context_os.h>

/*
* Stack
*/
Expand Down Expand Up @@ -333,15 +328,7 @@ extern void cv_broadcast(kcondvar_t *cv);
*/
#define tsd_get(k) pthread_getspecific(k)
#define tsd_set(k, v) pthread_setspecific(k, v)
#define tsd_create(kp, d) pthread_key_create(kp, d)
#define tsd_destroy(kp) /* nothing */

/*
* Thread-specific data
*/
#define tsd_get(k) pthread_getspecific(k)
#define tsd_set(k, v) pthread_setspecific(k, v)
#define tsd_create(kp, d) pthread_key_create(kp, d)
#define tsd_create(kp, d) pthread_key_create((pthread_key_t *)kp, d)
#define tsd_destroy(kp) /* nothing */

/*
Expand Down Expand Up @@ -562,7 +549,6 @@ typedef struct vsecattr {
size_t vsa_aclentsz; /* ACE size in bytes of vsa_aclentp */
} vsecattr_t;

#define AT_TYPE 0x00001
#define AT_MODE 0x00002
#define AT_UID 0x00004
#define AT_GID 0x00008
Expand Down
3 changes: 2 additions & 1 deletion lib/libspl/include/os/linux/sys/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ libspl_HEADERS = \
$(top_srcdir)/lib/libspl/include/os/linux/sys/param.h \
$(top_srcdir)/lib/libspl/include/os/linux/sys/stat.h \
$(top_srcdir)/lib/libspl/include/os/linux/sys/sysmacros.h \
$(top_srcdir)/lib/libspl/include/os/linux/sys/uio.h
$(top_srcdir)/lib/libspl/include/os/linux/sys/uio.h \
$(top_srcdir)/lib/libspl/include/os/linux/sys/zfs_context_os.h
2 changes: 2 additions & 0 deletions lib/libspl/include/os/linux/sys/zfs_context_os.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <alloca.h>
#include <sys/bitmap.h>

0 comments on commit d2cbc2b

Please sign in to comment.