Skip to content

Commit c8880df

Browse files
committed
std.os.linux: rework io_uring support
* `linux.IO_Uring` -> `linux.IoUring` to align with naming conventions. * All functions `io_uring_prep_foo` are now methods `prep_foo` on `io_uring_sqe`, which is in a file of its own. * `SubmissionQueue` and `CompletionQueue` are namespaced under `IoUring`. This is a breaking change. The new file and namespace layouts are more idiomatic, and allow us to eliminate one more usage of `usingnamespace` from the standard library. 2 remain.
1 parent 2522ca0 commit c8880df

File tree

5 files changed

+1923
-1912
lines changed

5 files changed

+1923
-1912
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ set(ZIG_STAGE2_SOURCES
291291
"${CMAKE_SOURCE_DIR}/lib/std/os/linux/errno/generic.zig"
292292
"${CMAKE_SOURCE_DIR}/lib/std/os/linux/x86_64.zig"
293293
"${CMAKE_SOURCE_DIR}/lib/std/os/linux.zig"
294-
"${CMAKE_SOURCE_DIR}/lib/std/os/linux/io_uring.zig"
294+
"${CMAKE_SOURCE_DIR}/lib/std/os/linux/IoUring.zig"
295+
"${CMAKE_SOURCE_DIR}/lib/std/os/linux/io_uring_sqe.zig"
295296
"${CMAKE_SOURCE_DIR}/lib/std/os/linux/x86_64.zig"
296297
"${CMAKE_SOURCE_DIR}/lib/std/os/windows.zig"
297298
"${CMAKE_SOURCE_DIR}/lib/std/os/windows/ntstatus.zig"

lib/std/os/linux.zig

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,6 @@ pub const O = switch (native_arch) {
383383
else => @compileError("missing std.os.linux.O constants for this architecture"),
384384
};
385385

386-
pub usingnamespace @import("linux/io_uring.zig");
387-
388386
/// Set by startup code, used by `getauxval`.
389387
pub var elf_aux_maybe: ?[*]std.elf.Auxv = null;
390388

@@ -4188,22 +4186,9 @@ pub const IORING_SETUP_SINGLE_ISSUER = 1 << 12;
41884186
pub const IORING_SETUP_DEFER_TASKRUN = 1 << 13;
41894187

41904188
/// IO submission data structure (Submission Queue Entry)
4191-
pub const io_uring_sqe = extern struct {
4192-
opcode: IORING_OP,
4193-
flags: u8,
4194-
ioprio: u16,
4195-
fd: i32,
4196-
off: u64,
4197-
addr: u64,
4198-
len: u32,
4199-
rw_flags: u32,
4200-
user_data: u64,
4201-
buf_index: u16,
4202-
personality: u16,
4203-
splice_fd_in: i32,
4204-
addr3: u64,
4205-
resv: u64,
4206-
};
4189+
pub const io_uring_sqe = @import("linux/io_uring_sqe.zig").io_uring_sqe;
4190+
4191+
pub const IoUring = @import("linux/IoUring.zig");
42074192

42084193
/// If sqe->file_index is set to this for opcodes that instantiate a new
42094194
/// direct descriptor (like openat/openat2/accept), then io_uring will allocate

0 commit comments

Comments
 (0)