lkml.org 
[lkml]   [2024]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 005/437] uio: add get/put_iter helpers
    Date
    For users that currently do put_user(val, uaddr) or get_user(val, uaddr),
    add iterator versions that do the same thing.

    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    ---
    include/linux/uio.h | 3 +++
    1 file changed, 3 insertions(+)

    diff --git a/include/linux/uio.h b/include/linux/uio.h
    index 7020adedfa08..ed1711201597 100644
    --- a/include/linux/uio.h
    +++ b/include/linux/uio.h
    @@ -215,6 +215,9 @@ bool copy_to_iter_full(const void *addr, size_t bytes, struct iov_iter *i)
    return false;
    }

    +#define put_iter(val, to) !copy_to_iter_full(&(val), sizeof((val)), to)
    +#define get_iter(val, from) !copy_from_iter_full(&(val), sizeof((val)), from)
    +
    static __always_inline __must_check
    bool copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i)
    {
    --
    2.43.0

    \
     
     \ /
      Last update: 2024-05-27 16:35    [W:7.693 / U:0.468 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site