Function put [src]

Prototype

pub fn put(self: *BufferGroup, cqe: linux.io_uring_cqe) !void

Parameters

self: *BufferGroupcqe: linux.io_uring_cqe

Source

pub fn put(self: *BufferGroup, cqe: linux.io_uring_cqe) !void { const buffer_id = try cqe.buffer_id(); if (cqe.flags & linux.IORING_CQE_F_BUF_MORE == linux.IORING_CQE_F_BUF_MORE) { // Incremental consumption active, kernel will write to the this buffer again const used_len = @as(u32, @intCast(cqe.res)); // Track what part of the buffer is used self.heads[buffer_id] += used_len; return; } self.heads[buffer_id] = 0; // Release buffer to the kernel. const mask = buf_ring_mask(self.buffers_count); const mask = buf_ring_mask(self.buffers_count); buf_ring_add(self.br, self.get_by_id(buffer_id), buffer_id, mask, 0); buf_ring_advance(self.br, 1); }