Skip to content

Commit

Permalink
Make wrapper function for iov_iter type access
Browse files Browse the repository at this point in the history
An iov_iter_type() function to access the "type" member of the struct
iov_iter was added at one point. Move the conditional logic to decide
which method to use for accessing it into a macro and simplify the
zpl_uio_init code.

Signed-off-by: Coleman Kane <ckane@colemankane.org>
  • Loading branch information
ckane committed Aug 1, 2023
1 parent 960c08d commit 2df72b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 6 additions & 0 deletions include/os/linux/spl/sys/uio.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,10 @@ zfs_uio_iov_iter_init(zfs_uio_t *uio, struct iov_iter *iter, offset_t offset,
#define zfs_uio_iter_iov(iter) (iter)->iov
#endif

#if defined(HAVE_IOV_ITER_TYPE)
#define zfs_uio_iov_iter_type(iter) iov_iter_type((iter))
#else
#define zfs_uio_iov_iter_type(iter) (iter)->type
#endif

#endif /* SPL_UIO_H */
7 changes: 2 additions & 5 deletions module/os/linux/zfs/zpl_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,10 @@ zpl_uio_init(zfs_uio_t *uio, struct kiocb *kiocb, struct iov_iter *to,
{
#if defined(HAVE_VFS_IOV_ITER)
zfs_uio_iov_iter_init(uio, to, pos, count, skip);
#elif defined(HAVE_IOV_ITER_TYPE)
zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
iov_iter_type(to) & ITER_KVEC ? UIO_SYSSPACE : UIO_USERSPACE,
count, skip);
#else
zfs_uio_iovec_init(uio, zfs_uio_iter_iov(to), to->nr_segs, pos,
to->type & ITER_KVEC ? UIO_SYSSPACE : UIO_USERSPACE,
zfs_uio_iov_iter_type(to) & ITER_KVEC ?
UIO_SYSSPACE : UIO_USERSPACE,
count, skip);
#endif
}
Expand Down

0 comments on commit 2df72b5

Please sign in to comment.