# io_uring_register_buffers

## NAME



           io_uring_register_buffers - register buffers for fixed buffer
           operations
    


## SYNOPSIS



           **#include <liburing.h>**
    
           **int io_uring_register_buffers(struct io_uring ***_ring_**,**
                                         **const struct iovec ***_iovecs_**,**
                                         **unsigned** _nr_iovecs_**);**
    
           **int io_uring_register_buffers_tags(struct io_uring ***_ring_**,**
                                              **const struct iovec ***_iovecs_**,**
                                              **const __u64 ***_tags_**,**
                                              **unsigned** _nr_**);**
    
           **int io_uring_register_buffers_sparse(struct io_uring ***_ring_**,**
                                                **unsigned** _nr_iovecs_**);**
    
           **int io_uring_register_buffers_update_tag(struct io_uring ***_ring_**,**
                                                    **unsigned** _off_**,**
                                                    **const struct iovec ***_iovecs_**,**
                                                    **const __u64 ***_tags_**,**
                                                    **unsigned** _nr_**);**
    


## DESCRIPTION



           The io_uring_register_buffers(3) function registers _nr_iovecs_
           number of buffers defined by the array _iovecs_ belonging to the
           _ring_.
    
           The io_uring_register_buffers_tags(3) function behaves the same as
           io_uring_register_buffers(3) function but additionally takes _tags_
           parameter. See **IORING_REGISTER_BUFFERS2** for the resource tagging
           description.
    
           The io_uring_register_buffers_sparse(3) function registers
           _nr_iovecs_ empty buffers belonging to the _ring_.  These buffers must
           be updated before use, using eg
           io_uring_register_buffers_update_tag(3).
    
           After the caller has registered the buffers, they can be used with
           one of the fixed buffers functions.
    
           Registered buffers is an optimization that is useful in
           conjunction with **O_DIRECT** reads and writes, where it maps the
           specified range into the kernel once when the buffer is registered
           rather than doing a map and unmap for each IO every time IO is
           performed to that region. Additionally, it also avoids
           manipulating the page reference counts for each IO.
    
           The io_uring_register_buffers_update_tag(3) function updates
           registered buffers with new ones, either turning a sparse entry
           into a real one, or replacing an existing entry. The _off_ is offset
           on which to start the update _nr_ number of buffers defined by the
           array _iovecs_ belonging to the _ring_.  The _tags_ points to an array
           of tags. See **IORING_REGISTER_BUFFERS2** for the resource tagging
           description.
    


## RETURN VALUE



           On success io_uring_register_buffers(3),
           io_uring_register_buffers_tags(3) and
           io_uring_register_buffers_sparse(3) return 0.
           io_uring_register_buffers_update_tag(3) return number of buffers
           updated.  On failure they return **-errno**.
    


* * *