alexcrichton opened PR #14345 from alexcrichton:cleanup-cap-primitives to bytecodealliance:main:
This commit is the next step in my attempt to reorganize
filesystem::primitives, imported from thecap-primitivescrate, to a format that best suits its new home. Notably various layers of abstraction and such are less applicable than they were in the original crate. Another goal of this commit is to ideally remove the layers of indirection andpub usechains to find the definition of something. Previously the definition bounced around a few modules before finding a home, and along the way there were various#[cfg]directives in play to follow as well.The refactorings applied here are:
The
fssubmodules withinwindows,rustix,linux, andfreebsdmodules were all removed. They're now flat within the module's namespace itself.The
rustixsubmodule was renamed tounixto avoid conflicting with the crate.Function definitions are now largely organized as either a reexport of a
sysmodule definition for entirely platform-specific definitions, or a generic wrapper with minimal#[cfg]for a mostly-platform-agnostic definition.For a number of functions where some platforms effective have a fast path the structure is now that the function
fooconditionally callsfoo_fastdefined in thesys(per-platform) module. This enables keeping common logic in one location while adding a (hopefully) easy to read way to hook into platform-specific optimizations.Various single-function modules are flattened into their parent, for example
linux.rsnow contains all Linux-specific content.Various
*_implfunctions are now just named without such a suffix.The goal of this commit is to have no behavior change. I've done my best to ensure this along the way and any deviation from prior behavior is unintentional. I've also done my best to preserve various comments from before, but I've also likely crossed wires in a location or two.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton updated PR #14345.
alexcrichton has marked PR #14345 as ready for review.
alexcrichton requested wasmtime-wasi-reviewers for a review on PR #14345.
alexcrichton requested dicej for a review on PR #14345.
github-actions[bot] added the label wasi on PR #14345.
:thumbs_up: dicej submitted PR review.
alexcrichton added PR #14345 Continue to reorganize filesystem::primitives to the merge queue
:check: alexcrichton merged PR #14345.
alexcrichton removed PR #14345 Continue to reorganize filesystem::primitives from the merge queue
Last updated: Sep 20 2026 at 18:08 UTC