summaryrefslogtreecommitdiffstats
path: root/include/os
diff options
context:
space:
mode:
authorBrian Atkinson <[email protected]>2021-02-20 21:16:50 -0700
committerGitHub <[email protected]>2021-02-20 20:16:50 -0800
commitc0801bf35a09623a8f4422530550266c9fa143b5 (patch)
treeb9bd7c99600ccc1c07733bb5ba563843730aa523 /include/os
parent52cb284f7b7e2e8eb389c2f62d133ca4e4d38832 (diff)
Cleaning up uio headers
Making uio_impl.h the common header interface between Linux and FreeBSD so both OS's can share a common header file. This also helps reduce code duplication for zfs_uio_t for each OS. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Brian Atkinson <[email protected]> Closes #11622
Diffstat (limited to 'include/os')
-rw-r--r--include/os/freebsd/spl/sys/uio.h43
-rw-r--r--include/os/linux/spl/sys/uio.h22
-rw-r--r--include/os/linux/zfs/sys/zfs_context_os.h1
3 files changed, 8 insertions, 58 deletions
diff --git a/include/os/freebsd/spl/sys/uio.h b/include/os/freebsd/spl/sys/uio.h
index f1d30195f..b71f2f2e5 100644
--- a/include/os/freebsd/spl/sys/uio.h
+++ b/include/os/freebsd/spl/sys/uio.h
@@ -55,38 +55,12 @@ typedef struct zfs_uio {
#define zfs_uio_fault_disable(u, set)
#define zfs_uio_prefaultpages(size, u) (0)
-
-static __inline void
-zfs_uio_init(zfs_uio_t *uio, struct uio *uio_s)
-{
- GET_UIO_STRUCT(uio) = uio_s;
-}
-
-static __inline void
+static inline void
zfs_uio_setoffset(zfs_uio_t *uio, offset_t off)
{
zfs_uio_offset(uio) = off;
}
-static __inline int
-zfs_uiomove(void *cp, size_t n, zfs_uio_rw_t dir, zfs_uio_t *uio)
-{
- ASSERT(zfs_uio_rw(uio) == dir);
- return (uiomove(cp, (int)n, GET_UIO_STRUCT(uio)));
-}
-
-int zfs_uiocopy(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio,
- size_t *cbytes);
-void zfs_uioskip(zfs_uio_t *uiop, size_t n);
-int zfs_uio_fault_move(void *p, size_t n, zfs_uio_rw_t dir, zfs_uio_t *uio);
-
-static inline void
-zfs_uio_iov_at_index(zfs_uio_t *uio, uint_t idx, void **base, uint64_t *len)
-{
- *base = zfs_uio_iovbase(uio, idx);
- *len = zfs_uio_iovlen(uio, idx);
-}
-
static inline void
zfs_uio_advance(zfs_uio_t *uio, size_t size)
{
@@ -94,19 +68,14 @@ zfs_uio_advance(zfs_uio_t *uio, size_t size)
zfs_uio_offset(uio) += size;
}
-static inline offset_t
-zfs_uio_index_at_offset(zfs_uio_t *uio, offset_t off, uint_t *vec_idx)
+static __inline void
+zfs_uio_init(zfs_uio_t *uio, struct uio *uio_s)
{
- *vec_idx = 0;
- while (*vec_idx < zfs_uio_iovcnt(uio) &&
- off >= zfs_uio_iovlen(uio, *vec_idx)) {
- off -= zfs_uio_iovlen(uio, *vec_idx);
- (*vec_idx)++;
- }
-
- return (off);
+ GET_UIO_STRUCT(uio) = uio_s;
}
+int zfs_uio_fault_move(void *p, size_t n, zfs_uio_rw_t dir, zfs_uio_t *uio);
+
#endif /* !_STANDALONE */
#endif /* !_OPENSOLARIS_SYS_UIO_H_ */
diff --git a/include/os/linux/spl/sys/uio.h b/include/os/linux/spl/sys/uio.h
index 0deed3c57..66af2b0b5 100644
--- a/include/os/linux/spl/sys/uio.h
+++ b/include/os/linux/spl/sys/uio.h
@@ -78,6 +78,8 @@ typedef struct zfs_uio {
#define zfs_uio_rlimit_fsize(z, u) (0)
#define zfs_uio_fault_move(p, n, rw, u) zfs_uiomove((p), (n), (rw), (u))
+extern int zfs_uio_prefaultpages(ssize_t, zfs_uio_t *);
+
static inline void
zfs_uio_setoffset(zfs_uio_t *uio, offset_t off)
{
@@ -85,32 +87,12 @@ zfs_uio_setoffset(zfs_uio_t *uio, offset_t off)
}
static inline void
-zfs_uio_iov_at_index(zfs_uio_t *uio, uint_t idx, void **base, uint64_t *len)
-{
- *base = zfs_uio_iovbase(uio, idx);
- *len = zfs_uio_iovlen(uio, idx);
-}
-
-static inline void
zfs_uio_advance(zfs_uio_t *uio, size_t size)
{
uio->uio_resid -= size;
uio->uio_loffset += size;
}
-static inline offset_t
-zfs_uio_index_at_offset(zfs_uio_t *uio, offset_t off, uint_t *vec_idx)
-{
- *vec_idx = 0;
- while (*vec_idx < zfs_uio_iovcnt(uio) &&
- off >= zfs_uio_iovlen(uio, *vec_idx)) {
- off -= zfs_uio_iovlen(uio, *vec_idx);
- (*vec_idx)++;
- }
-
- return (off);
-}
-
static inline void
zfs_uio_iovec_init(zfs_uio_t *uio, const struct iovec *iov,
unsigned long nr_segs, offset_t offset, zfs_uio_seg_t seg, ssize_t resid,
diff --git a/include/os/linux/zfs/sys/zfs_context_os.h b/include/os/linux/zfs/sys/zfs_context_os.h
index 9e5fdd79f..de7015b92 100644
--- a/include/os/linux/zfs/sys/zfs_context_os.h
+++ b/include/os/linux/zfs/sys/zfs_context_os.h
@@ -23,7 +23,6 @@
#ifndef ZFS_CONTEXT_OS_H
#define ZFS_CONTEXT_OS_H
-#include <sys/uio_impl.h>
#include <linux/dcache_compat.h>
#include <linux/utsname_compat.h>