aboutsummaryrefslogtreecommitdiffstats
path: root/module/os/linux/zfs/zfs_uio.c
diff options
context:
space:
mode:
authorBrian Atkinson <[email protected]>2021-01-20 22:27:30 -0700
committerGitHub <[email protected]>2021-01-20 21:27:30 -0800
commitd0cd9a5cc65e39feab5631ad4b5c09cf004ad3f0 (patch)
treef228b2dbb9655257e4f8e85862320ee61cae9ff4 /module/os/linux/zfs/zfs_uio.c
parente2af2acce3436acdb2b35fdc7c9de1a30ea85514 (diff)
Extending FreeBSD UIO Struct
In FreeBSD the struct uio was just a typedef to uio_t. In order to extend this struct, outside of the definition for the struct uio, the struct uio has been embedded inside of a uio_t struct. Also renamed all the uio_* interfaces to be zfs_uio_* to make it clear this is a ZFS interface. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Jorgen Lundman <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Brian Atkinson <[email protected]> Closes #11438
Diffstat (limited to 'module/os/linux/zfs/zfs_uio.c')
-rw-r--r--module/os/linux/zfs/zfs_uio.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/module/os/linux/zfs/zfs_uio.c b/module/os/linux/zfs/zfs_uio.c
index e435e1a9f..a31d2d7e1 100644
--- a/module/os/linux/zfs/zfs_uio.c
+++ b/module/os/linux/zfs/zfs_uio.c
@@ -55,7 +55,7 @@
* a non-zero errno on failure.
*/
static int
-uiomove_iov(void *p, size_t n, enum uio_rw rw, struct uio *uio)
+zfs_uiomove_iov(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio)
{
const struct iovec *iov = uio->uio_iov;
size_t skip = uio->uio_skip;
@@ -126,7 +126,7 @@ uiomove_iov(void *p, size_t n, enum uio_rw rw, struct uio *uio)
}
static int
-uiomove_bvec(void *p, size_t n, enum uio_rw rw, struct uio *uio)
+zfs_uiomove_bvec(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio)
{
const struct bio_vec *bv = uio->uio_bvec;
size_t skip = uio->uio_skip;
@@ -160,7 +160,7 @@ uiomove_bvec(void *p, size_t n, enum uio_rw rw, struct uio *uio)
#if defined(HAVE_VFS_IOV_ITER)
static int
-uiomove_iter(void *p, size_t n, enum uio_rw rw, struct uio *uio,
+zfs_uiomove_iter(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio,
boolean_t revert)
{
size_t cnt = MIN(n, uio->uio_resid);
@@ -182,7 +182,7 @@ uiomove_iter(void *p, size_t n, enum uio_rw rw, struct uio *uio,
return (EFAULT);
/*
- * Revert advancing the uio_iter. This is set by uiocopy()
+ * Revert advancing the uio_iter. This is set by zfs_uiocopy()
* to avoid consuming the uio and its iov_iter structure.
*/
if (revert)
@@ -196,21 +196,21 @@ uiomove_iter(void *p, size_t n, enum uio_rw rw, struct uio *uio,
#endif
int
-uiomove(void *p, size_t n, enum uio_rw rw, struct uio *uio)
+zfs_uiomove(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio)
{
if (uio->uio_segflg == UIO_BVEC)
- return (uiomove_bvec(p, n, rw, uio));
+ return (zfs_uiomove_bvec(p, n, rw, uio));
#if defined(HAVE_VFS_IOV_ITER)
else if (uio->uio_segflg == UIO_ITER)
- return (uiomove_iter(p, n, rw, uio, B_FALSE));
+ return (zfs_uiomove_iter(p, n, rw, uio, B_FALSE));
#endif
else
- return (uiomove_iov(p, n, rw, uio));
+ return (zfs_uiomove_iov(p, n, rw, uio));
}
-EXPORT_SYMBOL(uiomove);
+EXPORT_SYMBOL(zfs_uiomove);
int
-uio_prefaultpages(ssize_t n, struct uio *uio)
+zfs_uio_prefaultpages(ssize_t n, zfs_uio_t *uio)
{
struct iov_iter iter, *iterp = NULL;
@@ -230,40 +230,40 @@ uio_prefaultpages(ssize_t n, struct uio *uio)
#endif
return (0);
}
-EXPORT_SYMBOL(uio_prefaultpages);
+EXPORT_SYMBOL(zfs_uio_prefaultpages);
/*
- * The same as uiomove() but doesn't modify uio structure.
+ * The same as zfs_uiomove() but doesn't modify uio structure.
* return in cbytes how many bytes were copied.
*/
int
-uiocopy(void *p, size_t n, enum uio_rw rw, struct uio *uio, size_t *cbytes)
+zfs_uiocopy(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio, size_t *cbytes)
{
- struct uio uio_copy;
+ zfs_uio_t uio_copy;
int ret;
- bcopy(uio, &uio_copy, sizeof (struct uio));
+ bcopy(uio, &uio_copy, sizeof (zfs_uio_t));
if (uio->uio_segflg == UIO_BVEC)
- ret = uiomove_bvec(p, n, rw, &uio_copy);
+ ret = zfs_uiomove_bvec(p, n, rw, &uio_copy);
#if defined(HAVE_VFS_IOV_ITER)
else if (uio->uio_segflg == UIO_ITER)
- ret = uiomove_iter(p, n, rw, &uio_copy, B_TRUE);
+ ret = zfs_uiomove_iter(p, n, rw, &uio_copy, B_TRUE);
#endif
else
- ret = uiomove_iov(p, n, rw, &uio_copy);
+ ret = zfs_uiomove_iov(p, n, rw, &uio_copy);
*cbytes = uio->uio_resid - uio_copy.uio_resid;
return (ret);
}
-EXPORT_SYMBOL(uiocopy);
+EXPORT_SYMBOL(zfs_uiocopy);
/*
* Drop the next n chars out of *uio.
*/
void
-uioskip(uio_t *uio, size_t n)
+zfs_uioskip(zfs_uio_t *uio, size_t n)
{
if (n > uio->uio_resid)
return;
@@ -292,5 +292,6 @@ uioskip(uio_t *uio, size_t n)
uio->uio_loffset += n;
uio->uio_resid -= n;
}
-EXPORT_SYMBOL(uioskip);
+EXPORT_SYMBOL(zfs_uioskip);
+
#endif /* _KERNEL */