Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor(driver): adjust sys layout#870

Merged
George-Miao merged 1 commit into
compio-rs:masterfrom
George-Miao:refactor/driver/adjust-layout
Apr 16, 2026
Merged

refactor(driver): adjust sys layout#870
George-Miao merged 1 commit into
compio-rs:masterfrom
George-Miao:refactor/driver/adjust-layout

Conversation

@George-Miao
Copy link
Copy Markdown
Member

@George-Miao George-Miao commented Apr 15, 2026

No description provided.

@George-Miao George-Miao force-pushed the refactor/driver/adjust-layout branch from dc1ab39 to 0d8530c Compare April 15, 2026 22:53
@George-Miao George-Miao self-assigned this Apr 15, 2026
@George-Miao George-Miao added package: driver Related to compio-driver refactor Refactoring existing code labels Apr 15, 2026
@George-Miao George-Miao force-pushed the refactor/driver/adjust-layout branch 2 times, most recently from efcf18e to eb7424d Compare April 15, 2026 23:13
@George-Miao George-Miao requested a review from Berrysoft April 15, 2026 23:22
@George-Miao George-Miao enabled auto-merge April 15, 2026 23:22
@Berrysoft Berrysoft requested a review from Copilot April 16, 2026 03:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors compio-driver’s sys module layout by extracting platform abstractions into sys::pal, reorganizing driver backends under sys::driver, and regrouping low-level operations under sys::op (including new socket/zerocopy/multishot op modules).

Changes:

  • Introduces sys::pal (unix/windows) for platform-specific types/utilities and re-exports them through sys.
  • Restructures backend drivers into sys::driver::{iour,poll,iocp,fusion,stub} and moves backend-specific “extra” types into sys::extra.
  • Reorganizes and adds low-level op implementations under sys::op (general/fs/socket/managed/multishot/zerocopy/asyncify) with fusion wiring via a new fuse_op! macro.

Reviewed changes

Copilot reviewed 77 out of 83 changed files in this pull request and generated no comments.

Show a summary per file
File Description
compio-driver/src/sys/sys_slice.rs Refactors platform-specific slice ABI handling via cfg_if.
compio-driver/src/sys/pal/mod.rs New platform abstraction entry point (unix/windows).
compio-driver/src/sys/pal/unix/mod.rs New Unix PAL exports (fd types, libc helpers, io_uring probe, etc.).
compio-driver/src/sys/pal/windows/mod.rs New Windows PAL utilities (OVERLAPPED wrapper, results helpers, cancel, WSA fn lookup).
compio-driver/src/sys/pal/windows/fd.rs Windows fd/handle/socket type layer and AsFd/AsRawFd abstractions.
compio-driver/src/sys/op/mod.rs New centralized op module with submodules and unix-only re-exports.
compio-driver/src/sys/op/asyncify/mod.rs New asyncify op module wiring per-backend implementations.
compio-driver/src/sys/op/asyncify/poll.rs Polling backend impls for asyncify operations.
compio-driver/src/sys/op/asyncify/iour.rs io_uring backend impls for asyncify operations.
compio-driver/src/sys/op/asyncify/iocp.rs IOCP backend impls for asyncify operations.
compio-driver/src/sys/op/asyncify/stub.rs Stub backend impls for asyncify operations.
compio-driver/src/sys/op/ext.rs Adds extension traits for taking/advancing buffers and mapping recv results.
compio-driver/src/sys/op/flag.rs Adds OpCodeFlag bitflags for opcode support detection.
compio-driver/src/sys/op/general/mod.rs New “general” ops module (read/write/at variants).
compio-driver/src/sys/op/general/poll.rs Polling backend implementation for general ops.
compio-driver/src/sys/op/general/iour.rs io_uring backend implementation for general ops.
compio-driver/src/sys/op/general/iocp.rs IOCP backend implementation for general ops (incl. device ioctl, named pipe connect).
compio-driver/src/sys/op/general/stub.rs Stub backend implementations for general ops.
compio-driver/src/sys/op/fs/mod.rs New filesystem ops module and backend selection.
compio-driver/src/sys/op/fs/poll.rs Polling backend filesystem ops (stat, sync, mkdir, unlink, etc.).
compio-driver/src/sys/op/fs/iour.rs io_uring backend filesystem ops (openat/close/ftruncate/statx).
compio-driver/src/sys/op/fs/fusion.rs Fusion wrapper exports for fs ops.
compio-driver/src/sys/op/fs/stub.rs Stub backend filesystem ops.
compio-driver/src/sys/op/managed/mod.rs New managed-buffer ops module selection per backend.
compio-driver/src/sys/op/managed/poll.rs Polling backend wrappers for managed ops.
compio-driver/src/sys/op/managed/iour.rs io_uring backend managed ops tweaks + doc(hidden) controls.
compio-driver/src/sys/op/managed/iocp.rs IOCP backend wrappers for managed ops.
compio-driver/src/sys/op/managed/stub.rs Stub backend wrappers for managed ops.
compio-driver/src/sys/op/managed/fallback.rs Adjusts fallback imports to use sys::op ops.
compio-driver/src/sys/op/managed/fusion.rs Refactors fused managed ops implementation to use new layout.
compio-driver/src/sys/op/multishot/mod.rs New multishot ops module selection and fusion glue.
compio-driver/src/sys/op/multishot/iour.rs io_uring multishot accept implementation.
compio-driver/src/sys/op/multishot/poll.rs Polling multishot accept wrapper over Accept.
compio-driver/src/sys/op/multishot/stub.rs Stub multishot accept placeholder.
compio-driver/src/sys/op/socket/mod.rs New socket ops module definitions and backend selection.
compio-driver/src/sys/op/socket/unix.rs Unix socket control structs + libc call helpers for socket ops.
compio-driver/src/sys/op/socket/iour.rs io_uring backend socket op implementations.
compio-driver/src/sys/op/socket/stub.rs Stub backend socket op implementations.
compio-driver/src/sys/op/zerocopy/mod.rs New zerocopy ops module selection (fusion/iour/fallback).
compio-driver/src/sys/op/zerocopy/iour.rs io_uring zerocopy send/sendmsg variants with multishot handling.
compio-driver/src/sys/op/zerocopy/fusion.rs Fusion wrapper exports for zerocopy ops.
compio-driver/src/sys/op/zerocopy/fallback.rs Fallback aliases mapping ZC ops to non-ZC equivalents.
compio-driver/src/sys/mod.rs Reorganizes sys module (adds driver, pal, op, sys_slice, prelude).
compio-driver/src/sys/extra/mod.rs Refactors “extra” to be per-backend module + adds Extra::new(&Driver).
compio-driver/src/sys/extra/poll.rs Adjusts polling extra visibility + alias export.
compio-driver/src/sys/extra/iour.rs Adds alias export for iour extra.
compio-driver/src/sys/extra/fusion.rs Refactors fusion extra enum + alias exports.
compio-driver/src/sys/extra/iocp.rs New IOCP extra wrapper around Overlapped.
compio-driver/src/sys/extra/stub.rs New stub extra type.
compio-driver/src/sys/driver/mod.rs New driver selection module (iocp/fusion/iour/poll/stub).
compio-driver/src/sys/driver/poll/mod.rs Poll driver refactor; moves op traits/types into poll/op.rs.
compio-driver/src/sys/driver/poll/op.rs New polling OpCode trait/types (Decision/OpType/WaitArg).
compio-driver/src/sys/driver/iour/mod.rs io_uring driver refactor; factors out op + notifier; adjusts extra creation.
compio-driver/src/sys/driver/iour/op.rs New io_uring OpCode trait + OpEntry + carry glue.
compio-driver/src/sys/driver/iour/notify.rs New io_uring notifier/waker implementation.
compio-driver/src/sys/driver/iocp/mod.rs IOCP driver refactor; moves overlapped/extra handling into PAL/extra.
compio-driver/src/sys/driver/iocp/wait/mod.rs New IOCP wait backend selection (wait packet vs threadpool).
compio-driver/src/sys/driver/iocp/wait/packet.rs IOCP wait implementation using Nt*WaitCompletionPacket.
compio-driver/src/sys/driver/iocp/wait/thread_pool.rs IOCP wait implementation using Win threadpool waits.
compio-driver/src/sys/driver/iocp/cp/mod.rs New IOCP completion-port abstraction (global vs per-thread).
compio-driver/src/sys/driver/iocp/cp/multi.rs IOCP-per-thread completion port wrapper.
compio-driver/src/sys/driver/iocp/cp/global.rs Global IOCP completion port adjustments to use sys prelude.
compio-driver/src/sys/driver/fusion/mod.rs Fusion driver refactor and re-exports; uses new FuseExtra.
compio-driver/src/sys/driver/fusion/op.rs New fusion OpCode marker trait + carry dispatch based on Extra.
compio-driver/src/sys/driver/stub/mod.rs Stub driver updated to use new sys::extra::StubExtra and prelude.
compio-driver/src/sys/buffer_pool/mod.rs Buffer pool control refactor; adds fusion/iour/fallback modules.
compio-driver/src/sys/buffer_pool/iour.rs Updates buffer-ring registration API to work via crate::Driver and iour accessor.
compio-driver/src/sys/buffer_pool/fusion.rs Fusion buffer pool control dispatch based on driver.as_iour().
compio-driver/src/sys/buffer_pool/fallback.rs New fallback buffer pool control implementation.
compio-driver/src/macros.rs Adds fuse_op! macro for generating fused ops and refactors macro exports.
compio-driver/src/lib.rs Re-exports sys::op at crate root; routes default_extra() through new Extra::new.
compio-driver/build.rs Updates cfg aliases; adds stub alias and refines polling alias.
compio-driver/Cargo.toml Adds mod_use dependency.
.gitignore Normalizes ignore patterns for editor/direnv files.
Comments suppressed due to low confidence (2)

compio-driver/src/sys/sys_slice.rs:31

  • In the cfg_if fallback (else) branch, new takes *mut MaybeUninit<u8> but MaybeUninit is not in scope in that branch. This will fail to compile on targets that are neither unix nor windows. Import std::mem::MaybeUninit in the else branch or fully-qualify it in the signature.
    compio-driver/src/sys/sys_slice.rs:90
  • SysSlice::ptr/len only have #[cfg(unix)] and #[cfg(windows)] returns; on any other target the function body becomes empty and won’t compile. If non-unix/windows targets are intentionally unsupported, gate the entire type/impl with #[cfg(any(unix, windows))]; otherwise add an explicit #[cfg(not(any(unix, windows)))] branch (e.g., unreachable!() or a dummy return).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread compio-driver/src/sys/driver/iocp/mod.rs
Comment thread compio-driver/src/sys/op/fs/iour.rs
Comment thread compio-driver/src/sys/op/multishot/iour.rs
@George-Miao George-Miao force-pushed the refactor/driver/adjust-layout branch from eb7424d to ff57032 Compare April 16, 2026 15:33
@George-Miao George-Miao requested a review from Berrysoft April 16, 2026 15:33
@George-Miao George-Miao force-pushed the refactor/driver/adjust-layout branch from ff57032 to 396c2a3 Compare April 16, 2026 15:36
Berrysoft
Berrysoft previously approved these changes Apr 16, 2026
Copy link
Copy Markdown
Member

@Berrysoft Berrysoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@George-Miao George-Miao added this pull request to the merge queue Apr 16, 2026
@Berrysoft Berrysoft removed this pull request from the merge queue due to a manual request Apr 16, 2026
@Berrysoft
Copy link
Copy Markdown
Member

Let's wait for CI a while...

@George-Miao
Copy link
Copy Markdown
Member Author

Wait a sec. I still need to change a little.

@George-Miao George-Miao added this pull request to the merge queue Apr 16, 2026
Merged via the queue into compio-rs:master with commit 8e76a5b Apr 16, 2026
68 checks passed
@George-Miao George-Miao deleted the refactor/driver/adjust-layout branch April 16, 2026 15:54
@github-actions github-actions Bot mentioned this pull request Apr 14, 2026
This was referenced Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: driver Related to compio-driver refactor Refactoring existing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants