Function buf_ring_add [src]
Assigns buffer with the br buffer ring.
buffer_id is identifier which will be returned in the CQE.
buffer_offset is the offset to insert at from the current tail.
If just one buffer is provided before the ring tail is committed with advance then offset should be 0.
If buffers are provided in a loop before being committed, the offset must be incremented by one for each buffer added.
Prototype
pub fn buf_ring_add( br: *linux.io_uring_buf_ring, buffer: []u8, buffer_id: u16, mask: u16, buffer_offset: u16, ) void
Parameters
br: *linux.io_uring_buf_ring
buffer: []u8
buffer_id: u16
mask: u16
buffer_offset: u16
Source
pub fn buf_ring_add(
br: *linux.io_uring_buf_ring,
buffer: []u8,
buffer_id: u16,
mask: u16,
buffer_offset: u16,
) void {
const bufs: [*]linux.io_uring_buf = @ptrCast(br);
const buf: *linux.io_uring_buf = &bufs[(br.tail +% buffer_offset) & mask];
buf.addr = @intFromPtr(buffer.ptr);
buf.len = @intCast(buffer.len);
buf.bid = buffer_id;
}