aboutsummaryrefslogtreecommitdiffstats
path: root/include/os/freebsd/spl
diff options
context:
space:
mode:
Diffstat (limited to 'include/os/freebsd/spl')
-rw-r--r--include/os/freebsd/spl/sys/mutex.h1
-rw-r--r--include/os/freebsd/spl/sys/param.h1
-rw-r--r--include/os/freebsd/spl/sys/uio.h31
3 files changed, 32 insertions, 1 deletions
diff --git a/include/os/freebsd/spl/sys/mutex.h b/include/os/freebsd/spl/sys/mutex.h
index 8cfe56c75..bbff9fe80 100644
--- a/include/os/freebsd/spl/sys/mutex.h
+++ b/include/os/freebsd/spl/sys/mutex.h
@@ -70,4 +70,5 @@ typedef enum {
#define mutex_exit(lock) sx_xunlock(lock)
#define mutex_owned(lock) sx_xlocked(lock)
#define mutex_owner(lock) sx_xholder(lock)
+
#endif /* _OPENSOLARIS_SYS_MUTEX_H_ */
diff --git a/include/os/freebsd/spl/sys/param.h b/include/os/freebsd/spl/sys/param.h
index 92724e332..96440dce0 100644
--- a/include/os/freebsd/spl/sys/param.h
+++ b/include/os/freebsd/spl/sys/param.h
@@ -33,6 +33,7 @@
#include <sys/types.h>
#include_next <sys/param.h>
#define PAGESIZE PAGE_SIZE
+#define PAGESHIFT PAGE_SHIFT
#define ptob(x) ((uint64_t)(x) << PAGE_SHIFT)
#ifdef _KERNEL
#include <sys/systm.h>
diff --git a/include/os/freebsd/spl/sys/uio.h b/include/os/freebsd/spl/sys/uio.h
index b9d41903e..2bd5bdb80 100644
--- a/include/os/freebsd/spl/sys/uio.h
+++ b/include/os/freebsd/spl/sys/uio.h
@@ -34,13 +34,30 @@
#include_next <sys/uio.h>
#include <sys/_uio.h>
#include <sys/debug.h>
+#include <sys/sysmacros.h>
+
+/*
+ * uio_extflg: extended flags
+ */
+#define UIO_DIRECT 0x0001 /* Direct I/O requset */
typedef struct iovec iovec_t;
typedef enum uio_seg zfs_uio_seg_t;
typedef enum uio_rw zfs_uio_rw_t;
+/*
+ * This structure is used when doing Direct I/O.
+ */
+typedef struct {
+ vm_page_t *pages;
+ int npages;
+} zfs_uio_dio_t;
+
typedef struct zfs_uio {
struct uio *uio;
+ offset_t uio_soffset;
+ uint16_t uio_extflg;
+ zfs_uio_dio_t uio_dio;
} zfs_uio_t;
#define GET_UIO_STRUCT(u) (u)->uio
@@ -52,6 +69,7 @@ typedef struct zfs_uio {
#define zfs_uio_iovbase(u, idx) GET_UIO_STRUCT(u)->uio_iov[(idx)].iov_base
#define zfs_uio_td(u) GET_UIO_STRUCT(u)->uio_td
#define zfs_uio_rw(u) GET_UIO_STRUCT(u)->uio_rw
+#define zfs_uio_soffset(u) (u)->uio_soffset
#define zfs_uio_fault_disable(u, set)
#define zfs_uio_prefaultpages(size, u) (0)
@@ -62,6 +80,13 @@ zfs_uio_setoffset(zfs_uio_t *uio, offset_t off)
}
static inline void
+zfs_uio_setsoffset(zfs_uio_t *uio, offset_t off)
+{
+ ASSERT3U(zfs_uio_offset(uio), ==, off);
+ zfs_uio_soffset(uio) = off;
+}
+
+static inline void
zfs_uio_advance(zfs_uio_t *uio, ssize_t size)
{
zfs_uio_resid(uio) -= size;
@@ -71,7 +96,11 @@ zfs_uio_advance(zfs_uio_t *uio, ssize_t size)
static __inline void
zfs_uio_init(zfs_uio_t *uio, struct uio *uio_s)
{
- GET_UIO_STRUCT(uio) = uio_s;
+ memset(uio, 0, sizeof (zfs_uio_t));
+ if (uio_s != NULL) {
+ GET_UIO_STRUCT(uio) = uio_s;
+ zfs_uio_soffset(uio) = uio_s->uio_offset;
+ }
}
int zfs_uio_fault_move(void *p, size_t n, zfs_uio_rw_t dir, zfs_uio_t *uio);