aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libspl
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2020-07-31 21:30:31 -0700
committerGitHub <[email protected]>2020-07-31 21:30:31 -0700
commit47ed79ff60945e0c5d8ccb56f0d29a893e1261ac (patch)
treeaf032038ad66d947e333ea55cf1383ce2627ea8b /lib/libspl
parent0cc3454821879396c38d8c557ab918a70afd919b (diff)
Changes to make openzfs build within FreeBSD buildworld
A collection of header changes to enable FreeBSD to build with vendored OpenZFS. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #10635
Diffstat (limited to 'lib/libspl')
-rw-r--r--lib/libspl/asm-i386/atomic.S6
-rw-r--r--lib/libspl/include/os/freebsd/sys/param.h2
-rw-r--r--lib/libspl/include/rpc/xdr.h7
-rw-r--r--lib/libspl/include/sys/isa_defs.h2
-rw-r--r--lib/libspl/include/sys/uio.h3
5 files changed, 15 insertions, 5 deletions
diff --git a/lib/libspl/asm-i386/atomic.S b/lib/libspl/asm-i386/atomic.S
index 3086d5543..7a574b0d1 100644
--- a/lib/libspl/asm-i386/atomic.S
+++ b/lib/libspl/asm-i386/atomic.S
@@ -28,8 +28,12 @@
.file "%M%"
#define _ASM
+#ifdef __linux__
#include <ia32/sys/asm_linkage.h>
-
+#elif __FreeBSD__
+#include <machine/asmacros.h>
+#define SET_SIZE(x)
+#endif
ENTRY(atomic_inc_8)
ALTENTRY(atomic_inc_uchar)
movl 4(%esp), %eax
diff --git a/lib/libspl/include/os/freebsd/sys/param.h b/lib/libspl/include/os/freebsd/sys/param.h
index e2abef189..7c23b6705 100644
--- a/lib/libspl/include/os/freebsd/sys/param.h
+++ b/lib/libspl/include/os/freebsd/sys/param.h
@@ -45,8 +45,10 @@
*/
#define MAXNAMELEN 256
+#ifndef IN_BASE
#define UID_NOBODY 60001 /* user ID no body */
#define GID_NOBODY UID_NOBODY
+#endif
#define UID_NOACCESS 60002 /* user ID no access */
#define MAXUID UINT32_MAX /* max user id */
diff --git a/lib/libspl/include/rpc/xdr.h b/lib/libspl/include/rpc/xdr.h
index 27e4395c7..51d71f693 100644
--- a/lib/libspl/include/rpc/xdr.h
+++ b/lib/libspl/include/rpc/xdr.h
@@ -40,10 +40,13 @@
#define XDR_GET_BYTES_AVAIL 1
-typedef struct xdr_bytesrec {
+#ifndef HAVE_XDR_BYTESREC
+struct xdr_bytesrec {
bool_t xc_is_last_record;
size_t xc_num_avail;
-} xdr_bytesrec_t;
+};
+#endif
+typedef struct xdr_bytesrec xdr_bytesrec_t;
/*
* This functionality is not required and is disabled in user space.
diff --git a/lib/libspl/include/sys/isa_defs.h b/lib/libspl/include/sys/isa_defs.h
index 6f242ea77..8c0932f57 100644
--- a/lib/libspl/include/sys/isa_defs.h
+++ b/lib/libspl/include/sys/isa_defs.h
@@ -208,7 +208,7 @@ extern "C" {
#error MIPS no endian specified
#endif
-#ifndef _LP64
+#if !defined(_LP64) && !defined(_ILP32)
#define _ILP32
#endif
diff --git a/lib/libspl/include/sys/uio.h b/lib/libspl/include/sys/uio.h
index 6d892dd3e..3a834b996 100644
--- a/lib/libspl/include/sys/uio.h
+++ b/lib/libspl/include/sys/uio.h
@@ -141,7 +141,8 @@ static inline offset_t
uio_index_at_offset(uio_t *uio, offset_t off, uint_t *vec_idx)
{
*vec_idx = 0;
- while (*vec_idx < uio_iovcnt(uio) && off >= uio_iovlen(uio, *vec_idx)) {
+ while (*vec_idx < (uint_t)uio_iovcnt(uio) &&
+ off >= (offset_t)uio_iovlen(uio, *vec_idx)) {
off -= uio_iovlen(uio, *vec_idx);
(*vec_idx)++;
}