LCOV - code coverage report
Current view: top level - util/io_uring - fd_io_uring_register.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 21 0.0 %
Date: 2026-08-14 04:54:57 Functions: 0 5 0.0 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_util_io_fd_io_uring_register_h
       2             : #define HEADER_fd_src_util_io_fd_io_uring_register_h
       3             : 
       4             : /* fd_io_uring_register.h provides APIs to add file descriptors and
       5             :    sandbox restrictions to an ioring. */
       6             : 
       7             : #include "fd_io_uring_sys.h"
       8             : #include <linux/io_uring.h>
       9             : #include <errno.h>
      10             : #include <sys/uio.h>
      11             : #include "../../util/fd_util_base.h"
      12             : 
      13             : FD_PROTOTYPES_BEGIN
      14             : 
      15             : static inline int
      16             : fd_io_uring_register_buffers( int                  ring_fd,
      17             :                               struct iovec const * iovecs,
      18           0 :                               ulong                iovec_cnt ) {
      19           0 :   if( FD_UNLIKELY( iovec_cnt > UINT_MAX ) ) return -EINVAL;
      20           0 :   return fd_io_uring_register( ring_fd, FD_IORING_REGISTER_BUFFERS, iovecs, (uint)iovec_cnt );
      21           0 : }
      22             : 
      23             : static inline int
      24             : fd_io_uring_register_files( int         ring_fd,
      25             :                             int const * fds,
      26           0 :                             ulong       fd_cnt ) {
      27           0 :   if( FD_UNLIKELY( fd_cnt > UINT_MAX ) ) return -EINVAL;
      28           0 :   return fd_io_uring_register( ring_fd, FD_IORING_REGISTER_FILES, fds, (uint)fd_cnt );
      29           0 : }
      30             : 
      31             : static inline int
      32             : fd_io_uring_register_files_update( int         ring_fd,
      33             :                                    unsigned    off,
      34             :                                    const int * files,
      35           0 :                                    unsigned    nr_files ) {
      36           0 :         struct io_uring_rsrc_update up = {
      37           0 :                 .offset = off,
      38           0 :                 .data   = (unsigned long) files,
      39           0 :         };
      40           0 :   return fd_io_uring_register( ring_fd, FD_IORING_REGISTER_FILES_UPDATE, &up, nr_files );
      41           0 : }
      42             : 
      43             : static inline int
      44             : fd_io_uring_register_restrictions( int                         ring_fd,
      45             :                                    fd_io_uring_restriction_t * res,
      46           0 :                                    uint                        res_cnt ) {
      47           0 :   return fd_io_uring_register( ring_fd, FD_IORING_REGISTER_RESTRICTIONS, res, res_cnt );
      48           0 : }
      49             : 
      50             : static inline int
      51           0 : fd_io_uring_enable_rings( int ring_fd ) {
      52           0 :   return fd_io_uring_register( ring_fd, FD_IORING_REGISTER_ENABLE_RINGS, NULL, 0 );
      53           0 : }
      54             : 
      55             : FD_PROTOTYPES_END
      56             : 
      57             : #endif /* HEADER_fd_src_util_io_fd_io_uring_register_h */

Generated by: LCOV version 1.14