pub struct SubmitEntry {
pub fd: i32,
pub opcode: u8,
pub flags: u16,
pub user_data: u64,
pub buf_ptr: Option<NonNull<u8>>,
pub buf_len: u32,
pub offset: u64,
pub addr: Option<SockAddr>,
}Expand description
Submission queue entry 提交队列条目
Represents a single I/O operation to be submitted to the kernel. 表示要提交给内核的单个I/O操作。
§Safety / 安全性
buf_ptrmust be valid forbuf_lenbytes if non-null- The buffer must remain valid until the operation completes
- 如果非空,
buf_ptr必须对buf_len字节有效 - 缓冲区必须在操作完成前保持有效
Fields§
§fd: i32File descriptor to operate on / 操作的文件描述符
opcode: u8Operation opcode (READ, WRITE, etc.) / 操作操作码
flags: u16Operation flags / 操作标志
user_data: u64User data for completion correlation (opaque pointer) 用于完成关联的用户数据(不透明指针)
buf_ptr: Option<NonNull<u8>>Buffer pointer / 缓冲区指针
buf_len: u32Buffer length in bytes / 缓冲区长度(字节)
offset: u64Offset for file operations / 文件操作的偏移量
addr: Option<SockAddr>Address for connect/accept operations / 连接/接受操作的地址
Implementations§
Source§impl SubmitEntry
impl SubmitEntry
Sourcepub const fn new(fd: i32, opcode: u8, user_data: u64) -> Self
pub const fn new(fd: i32, opcode: u8, user_data: u64) -> Self
Create a new submission entry 创建新的提交条目
Sourcepub unsafe fn read(fd: i32, buf: *mut u8, buf_len: u32, user_data: u64) -> Self
pub unsafe fn read(fd: i32, buf: *mut u8, buf_len: u32, user_data: u64) -> Self
Create a read operation entry 创建读操作条目
§Safety / 安全性
buf must be valid for reads and remain valid until completion.
buf 必须对读取有效并在完成前保持有效。
Sourcepub unsafe fn write(
fd: i32,
buf: *const u8,
buf_len: u32,
user_data: u64,
) -> Self
pub unsafe fn write( fd: i32, buf: *const u8, buf_len: u32, user_data: u64, ) -> Self
Create a write operation entry 创建写操作条目
§Safety / 安全性
buf must be valid for reads and remain valid until completion.
buf 必须对读取有效并在完成前保持有效。
Sourcepub unsafe fn with_buffer(self, buf: *mut u8, buf_len: u32) -> Self
pub unsafe fn with_buffer(self, buf: *mut u8, buf_len: u32) -> Self
Set the buffer for this operation 为此操作设置缓冲区
§Safety / 安全性
buf must be valid for buf_len bytes.
buf 必须对 buf_len 字节有效。
Sourcepub const fn with_offset(self, offset: u64) -> Self
pub const fn with_offset(self, offset: u64) -> Self
Set the offset for file operations 为文件操作设置偏移量
Sourcepub const fn with_flags(self, flags: u16) -> Self
pub const fn with_flags(self, flags: u16) -> Self
Set operation flags 设置操作标志
Sourcepub fn with_addr(self, addr: SockAddr) -> Self
pub fn with_addr(self, addr: SockAddr) -> Self
Set socket address for connect/accept 为connect/accept设置套接字地址
Sourcepub unsafe fn buffer(&self) -> Option<&[u8]>
pub unsafe fn buffer(&self) -> Option<&[u8]>
Get the buffer as a slice if available 如果可用,获取缓冲区的切片
§Safety / 安全性
The returned slice is only valid if the buffer is still alive. 返回的切片仅在缓冲区仍然存活时有效。
Sourcepub unsafe fn buffer_mut(&self) -> Option<&mut [u8]>
pub unsafe fn buffer_mut(&self) -> Option<&mut [u8]>
Get the buffer as a mutable slice if available 如果可用,获取缓冲区的可变切片
§Safety / 安全性
The returned slice is only valid if the buffer is still alive and mutable. 返回的切片仅在缓冲区仍然存活且可变时有效。
Trait Implementations§
Source§impl Clone for SubmitEntry
impl Clone for SubmitEntry
Source§fn clone(&self) -> SubmitEntry
fn clone(&self) -> SubmitEntry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more