aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/lib/libspl/include
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/openzfs/lib/libspl/include')
-rw-r--r--sys/contrib/openzfs/lib/libspl/include/os/freebsd/Makefile.am4
-rw-r--r--sys/contrib/openzfs/lib/libspl/include/os/freebsd/fcntl.h33
-rw-r--r--sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/Makefile.am1
-rw-r--r--sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/fcntl.h38
-rw-r--r--sys/contrib/openzfs/lib/libspl/include/sys/uio.h44
5 files changed, 98 insertions, 22 deletions
diff --git a/sys/contrib/openzfs/lib/libspl/include/os/freebsd/Makefile.am b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/Makefile.am
index 081839c48c8f..f06325ee3e4e 100644
--- a/sys/contrib/openzfs/lib/libspl/include/os/freebsd/Makefile.am
+++ b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/Makefile.am
@@ -1 +1,5 @@
SUBDIRS = sys
+
+libspldir = $(includedir)/libspl
+libspl_HEADERS = \
+ fcntl.h
diff --git a/sys/contrib/openzfs/lib/libspl/include/os/freebsd/fcntl.h b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/fcntl.h
new file mode 100644
index 000000000000..26d571ad8926
--- /dev/null
+++ b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/fcntl.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2021 iXsystems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _LIBSPL_FCNTL_H_
+#define _LIBSPL_FCNTL_H_
+
+#include_next <fcntl.h>
+
+#include <sys/fcntl.h>
+
+#endif /* _LIBSPL_FCNTL_H_ */
diff --git a/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/Makefile.am b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/Makefile.am
index 6775522f5d72..7a854608079c 100644
--- a/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/Makefile.am
+++ b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/Makefile.am
@@ -1,6 +1,7 @@
libspldir = $(includedir)/libspl/sys
libspl_HEADERS = \
byteorder.h \
+ fcntl.h \
file.h \
mnttab.h \
mount.h \
diff --git a/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/fcntl.h b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/fcntl.h
new file mode 100644
index 000000000000..c8a37a193850
--- /dev/null
+++ b/sys/contrib/openzfs/lib/libspl/include/os/freebsd/sys/fcntl.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2021 iXsystems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _LIBSPL_SYS_FCNTL_H_
+#define _LIBSPL_SYS_FCNTL_H_
+
+#include_next <sys/fcntl.h>
+
+#define O_LARGEFILE 0
+#define O_RSYNC 0
+
+#ifndef O_DSYNC
+#define O_DSYNC 0
+#endif
+
+#endif /* _LIBSPL_SYS_FCNTL_H_ */
diff --git a/sys/contrib/openzfs/lib/libspl/include/sys/uio.h b/sys/contrib/openzfs/lib/libspl/include/sys/uio.h
index 1d56b5b18baf..81ade54b5409 100644
--- a/sys/contrib/openzfs/lib/libspl/include/sys/uio.h
+++ b/sys/contrib/openzfs/lib/libspl/include/sys/uio.h
@@ -51,58 +51,58 @@
typedef struct iovec iovec_t;
#if defined(__linux__) || defined(__APPLE__)
-typedef enum uio_rw {
+typedef enum zfs_uio_rw {
UIO_READ = 0,
UIO_WRITE = 1,
-} uio_rw_t;
+} zfs_uio_rw_t;
-typedef enum uio_seg {
+typedef enum zfs_uio_seg {
UIO_USERSPACE = 0,
UIO_SYSSPACE = 1,
-} uio_seg_t;
+} zfs_uio_seg_t;
#elif defined(__FreeBSD__)
-typedef enum uio_seg uio_seg_t;
+typedef enum uio_seg zfs_uio_seg_t;
#endif
-typedef struct uio {
+typedef struct zfs_uio {
struct iovec *uio_iov; /* pointer to array of iovecs */
int uio_iovcnt; /* number of iovecs */
offset_t uio_loffset; /* file offset */
- uio_seg_t uio_segflg; /* address space (kernel or user) */
+ zfs_uio_seg_t uio_segflg; /* address space (kernel or user) */
uint16_t uio_fmode; /* file mode flags */
uint16_t uio_extflg; /* extended flags */
ssize_t uio_resid; /* residual count */
-} uio_t;
+} zfs_uio_t;
-#define uio_segflg(uio) (uio)->uio_segflg
-#define uio_offset(uio) (uio)->uio_loffset
-#define uio_resid(uio) (uio)->uio_resid
-#define uio_iovcnt(uio) (uio)->uio_iovcnt
-#define uio_iovlen(uio, idx) (uio)->uio_iov[(idx)].iov_len
-#define uio_iovbase(uio, idx) (uio)->uio_iov[(idx)].iov_base
+#define zfs_uio_segflg(uio) (uio)->uio_segflg
+#define zfs_uio_offset(uio) (uio)->uio_loffset
+#define zfs_uio_resid(uio) (uio)->uio_resid
+#define zfs_uio_iovcnt(uio) (uio)->uio_iovcnt
+#define zfs_uio_iovlen(uio, idx) (uio)->uio_iov[(idx)].iov_len
+#define zfs_uio_iovbase(uio, idx) (uio)->uio_iov[(idx)].iov_base
static inline void
-uio_iov_at_index(uio_t *uio, uint_t idx, void **base, uint64_t *len)
+zfs_uio_iov_at_index(zfs_uio_t *uio, uint_t idx, void **base, uint64_t *len)
{
- *base = uio_iovbase(uio, idx);
- *len = uio_iovlen(uio, idx);
+ *base = zfs_uio_iovbase(uio, idx);
+ *len = zfs_uio_iovlen(uio, idx);
}
static inline void
-uio_advance(uio_t *uio, size_t size)
+zfs_uio_advance(zfs_uio_t *uio, size_t size)
{
uio->uio_resid -= size;
uio->uio_loffset += size;
}
static inline offset_t
-uio_index_at_offset(uio_t *uio, offset_t off, uint_t *vec_idx)
+zfs_uio_index_at_offset(zfs_uio_t *uio, offset_t off, uint_t *vec_idx)
{
*vec_idx = 0;
- while (*vec_idx < (uint_t)uio_iovcnt(uio) &&
- off >= (offset_t)uio_iovlen(uio, *vec_idx)) {
- off -= uio_iovlen(uio, *vec_idx);
+ while (*vec_idx < (uint_t)zfs_uio_iovcnt(uio) &&
+ off >= (offset_t)zfs_uio_iovlen(uio, *vec_idx)) {
+ off -= zfs_uio_iovlen(uio, *vec_idx);
(*vec_idx)++;
}