diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index da16f4cee..08c0b58a5 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -145,29 +145,8 @@ extern "C" { typedef off_t loff_t; #endif -/* - * Random stuff - */ -#define max_ncpus 64 -#define boot_ncpus (sysconf(_SC_NPROCESSORS_ONLN)) - -/* - * Process priorities as defined by setpriority(2) and getpriority(2). - */ -#define minclsyspri 19 -#define defclsyspri 0 -/* Write issue taskq priority. */ -#define wtqclsyspri -19 -#define maxclsyspri -20 - -#define CPU_SEQID ((uintptr_t)pthread_self() & (max_ncpus - 1)) -#define CPU_SEQID_UNSTABLE CPU_SEQID - #define NN_NUMBUF_SZ (6) -extern int highbit64(uint64_t i); -extern int lowbit64(uint64_t i); - /* * Kernel modules */ diff --git a/lib/libspl/include/Makefile.am b/lib/libspl/include/Makefile.am index 73c29cca5..202f15944 100644 --- a/lib/libspl/include/Makefile.am +++ b/lib/libspl/include/Makefile.am @@ -61,6 +61,7 @@ libspl_sys_HEADERS = \ %D%/sys/stdtypes.h \ %D%/sys/string.h \ %D%/sys/sunddi.h \ + %D%/sys/sysmacros.h \ %D%/sys/systeminfo.h \ %D%/sys/systm.h \ %D%/sys/thread.h \ @@ -88,8 +89,7 @@ libspl_sys_HEADERS += \ %D%/os/linux/sys/mount.h \ %D%/os/linux/sys/param.h \ %D%/os/linux/sys/stat.h \ - %D%/os/linux/sys/sysmacros.h \ - %D%/os/linux/sys/vfs.h \ + %D%/os/linux/sys/vfs.h libspl_ia32_HEADERS = \ %D%/os/linux/sys/ia32/asm_linkage.h @@ -104,7 +104,6 @@ libspl_sys_HEADERS += \ %D%/os/freebsd/sys/mount.h \ %D%/os/freebsd/sys/param.h \ %D%/os/freebsd/sys/stat.h \ - %D%/os/freebsd/sys/sysmacros.h \ %D%/os/freebsd/sys/vfs.h libspl_ia32_HEADERS = \ diff --git a/lib/libspl/include/os/freebsd/sys/sysmacros.h b/lib/libspl/include/os/freebsd/sys/sysmacros.h deleted file mode 100644 index d9639d27b..000000000 --- a/lib/libspl/include/os/freebsd/sys/sysmacros.h +++ /dev/null @@ -1 +0,0 @@ -/* keep me */ diff --git a/lib/libspl/include/os/linux/sys/sysmacros.h b/lib/libspl/include/sys/sysmacros.h similarity index 72% rename from lib/libspl/include/os/linux/sys/sysmacros.h rename to lib/libspl/include/sys/sysmacros.h index 66e0da6b5..e33915c8d 100644 --- a/lib/libspl/include/os/linux/sys/sysmacros.h +++ b/lib/libspl/include/sys/sysmacros.h @@ -3,9 +3,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or https://opensource.org/licenses/CDDL-1.0. @@ -21,14 +20,26 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. + * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ #ifndef _LIBSPL_SYS_SYSMACROS_H #define _LIBSPL_SYS_SYSMACROS_H +#include + +#ifdef __linux__ +/* + * On Linux, we need the system-provided sysmacros.h to get the makedev(), + * major() and minor() definitions for makedevice() below. FreeBSD does not + * have this header, so include_next won't find it and will abort. So, we + * protect it with a platform check. + */ #include_next +#endif /* common macros */ #ifndef MIN @@ -94,10 +105,22 @@ #define P2SAMEHIGHBIT_TYPED(x, y, type) \ (((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y))) +#define max_ncpus 64 +#define boot_ncpus (sysconf(_SC_NPROCESSORS_ONLN)) -/* avoid any possibility of clashing with version */ -#if defined(_KERNEL) && !defined(_KMEMUSER) && !defined(offsetof) -#define offsetof(s, m) ((size_t)(&(((s *)0)->m))) -#endif +/* + * Process priorities as defined by setpriority(2) and getpriority(2). + */ +#define minclsyspri 19 +#define defclsyspri 0 +/* Write issue taskq priority. */ +#define wtqclsyspri -19 +#define maxclsyspri -20 -#endif /* _LIBSPL_SYS_SYSMACROS_H */ +#define CPU_SEQID ((uintptr_t)pthread_self() & (max_ncpus - 1)) +#define CPU_SEQID_UNSTABLE CPU_SEQID + +extern int lowbit64(uint64_t i); +extern int highbit64(uint64_t i); + +#endif /* _SYS_SYSMACROS_H */ diff --git a/scripts/spdxcheck.pl b/scripts/spdxcheck.pl index e119f1351..1b3dd6393 100755 --- a/scripts/spdxcheck.pl +++ b/scripts/spdxcheck.pl @@ -127,7 +127,6 @@ my $untagged_patterns = q( include/os/freebsd/spl/sys/trace_zfs.h include/os/freebsd/zfs/sys/zpl.h include/os/linux/kernel/linux/page_compat.h - lib/libspl/include/os/freebsd/sys/sysmacros.h lib/libspl/include/sys/string.h lib/libspl/include/sys/trace_spl.h lib/libzdb/libzdb.c