24 FdTable(io_uring &ring) : ring_(ring) {}
26 CONDY_DELETE_COPY_MOVE(FdTable);
34 int init(
size_t capacity)
noexcept {
35 return io_uring_register_files_sparse(&ring_, capacity);
45 int init(
const int *fds,
unsigned nr_fds) {
46 return io_uring_register_files(&ring_, fds, nr_fds);
53 int destroy() noexcept {
return io_uring_unregister_files(&ring_); }
63 int update(
unsigned index_base,
const int *fds,
unsigned nr_fds)
noexcept {
64 return io_uring_register_files_update(&ring_, index_base, fds, nr_fds);
74 return io_uring_register_file_alloc_range(&ring_, offset, size);
88 BufferTable(io_uring &ring) : ring_(ring) {}
90 CONDY_DELETE_COPY_MOVE(BufferTable);
98 int init(
size_t capacity)
noexcept {
99 return io_uring_register_buffers_sparse(&ring_, capacity);
109 int init(
const iovec *vecs,
unsigned nr_vecs) {
110 return io_uring_register_buffers(&ring_, vecs, nr_vecs);
117 int destroy() noexcept {
return io_uring_unregister_buffers(&ring_); }
127 int update(
unsigned index_base,
const iovec *vecs,
128 unsigned nr_vecs)
noexcept {
129 return io_uring_register_buffers_update_tag(&ring_, index_base, vecs,
133#if !IO_URING_CHECK_VERSION(2, 10)
144 unsigned int src_off = 0,
unsigned int nr = 0) noexcept {
145 auto *src_ring = &src.ring_;
146 auto *dst_ring = &ring_;
147 return __io_uring_clone_buffers_offset(dst_ring, src_ring, dst_off,
149 IORING_REGISTER_DST_REPLACE);
164 RingSettings(io_uring &ring) : ring_(ring) {}
168 io_uring_free_probe(probe_);
173 CONDY_DELETE_COPY_MOVE(RingSettings);
183 return io_uring_register_iowq_aff(&ring_, cpusz, mask);
190 return io_uring_unregister_iowq_aff(&ring_);
200 return io_uring_register_iowq_max_workers(&ring_, values);
212 probe_ = io_uring_get_probe_ring(&ring_);
222#if !IO_URING_CHECK_VERSION(2, 6)
229 return io_uring_register_napi(&ring_, napi);
236 return io_uring_unregister_napi(&ring_, napi);
240#if !IO_URING_CHECK_VERSION(2, 8)
246 int set_clock(io_uring_clock_register *clock_reg)
noexcept {
247 return io_uring_register_clock(&ring_, clock_reg);
251#if !IO_URING_CHECK_VERSION(2, 9)
258 return io_uring_resize_rings(&ring_, params);
262#if !IO_URING_CHECK_VERSION(2, 10)
269 return io_uring_set_iowait(&ring_, enable_iowait);
275 io_uring_probe *probe_ =
nullptr;
int clone_buffers(BufferTable &src, unsigned int dst_off=0, unsigned int src_off=0, unsigned int nr=0) noexcept
Clone buffers from another BufferTable into this one.
int update(unsigned index_base, const iovec *vecs, unsigned nr_vecs) noexcept
Update the buffer table starting from the given index.
int init(size_t capacity) noexcept
Initialize the buffer table with the given capacity.
int destroy() noexcept
Destroy the buffer table.
int init(const iovec *vecs, unsigned nr_vecs)
Initialize the buffer table with the given array of iovec structures.
int init(size_t capacity) noexcept
Initialize the file descriptor table with the given capacity.
int destroy() noexcept
Destroy the file descriptor table.
int init(const int *fds, unsigned nr_fds)
Initialize the file descriptor table with the given array of file descriptors.
int set_file_alloc_range(unsigned offset, unsigned size) noexcept
Set the file allocation range for the fd table.
int update(unsigned index_base, const int *fds, unsigned nr_fds) noexcept
Update the file descriptor table starting from the given index.
int set_rings_size(io_uring_params *params) noexcept
Resize the rings of the io_uring instance.
int apply_napi(io_uring_napi *napi) noexcept
Apply NAPI settings to the io_uring instance.
io_uring_probe * get_probe() noexcept
Get the io_uring probe for the ring.
uint32_t get_features() const noexcept
Get the supported features of the ring.
int set_iowq_max_workers(unsigned int *values) noexcept
Set the maximum number of I/O workers.
int apply_iowq_aff(size_t cpusz, const cpu_set_t *mask) noexcept
Apply I/O worker queue affinity settings.
int remove_iowq_aff() noexcept
Remove I/O worker queue affinity settings.
int set_clock(io_uring_clock_register *clock_reg) noexcept
Set the clock registration for the io_uring instance.
int set_iowait(bool enable_iowait) noexcept
Enable or disable iowait for the io_uring instance.
int remove_napi(io_uring_napi *napi=nullptr) noexcept
Remove NAPI settings from the io_uring instance.
The main namespace for the Condy library.
Internal utility classes and functions used by Condy.