Initialize the newer core filesystem design#887
Conversation
1fbc7ce to
0bea5df
Compare
4189660 to
89cd30b
Compare
wdcui
left a comment
There was a problem hiding this comment.
Thank you for staring this sequence of PRs to improve the fs code. I left a couple of comments below.
89cd30b to
76ff35d
Compare
76ff35d to
7cd8d12
Compare
|
🤖 SemverChecks 🤖 Click for details |
wdcui
left a comment
There was a problem hiding this comment.
LGTM. I left a couple of minor comments. Thanks.
|
GPT-5.5 found the following issues. You can decide if they should be addressed in this PR.
|
jaybosamiya-ms
left a comment
There was a problem hiding this comment.
Thanks Weidong! For the GPT-5.5 discovered issues:
- I already have an existing TODO to account for this in a future PR (GPT-5.5 even recognizes that I have a TODO for it); I did not want to block this PR on figuring out this currently-unobservable detail.
- Does not apply right now, because I've only migrated the devices file system which is read-only; it is a hazard, and will be handled in future PRs with mutable file systems.
unimplemented!()is an explicit signal of "we will implement this later", the panic there is intentionally indicating "we need to solve this in a future PR"- This is a known issue due to the ongoing migration of the different backends, will be resolved in future PRs (there are technically even more collisions possible due to the
STDIO_NODE_INFOand such constants), yes the inode allocation needs improvement to make consistent throughout the codebase, but that will come as one of the last few PRs in the series, because it needs coordination across all backends (that's why I'm migrating everything over to the inode allocator design that this PR introduces).
|
In prep for the next PR in the series, I've discovered that it may be helpful to slightly tweak the new |
microsoft#887 introduced the `Backend` abstraction to the file system, but as I was working on more functionality, I discovered that the better design is to guarantee that `Backend` is [dyn-compatible](https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility), so that the composition of multiple backends can be done without a huge amount of type-level machinery + macros; it also keeps the interfaces more ergonomic for consumers of LiteBox core. To make things dyn-safe, we need to move out the `Backend`-specific handles; however, rather than the naive handling of this, there's a convenient abstraction such that backend implementations still end up with a largely convenient way to use their own typed handles.
…oft#995) This PR introduces the `Composer`, which acts as a mount point for the new core file system design (see microsoft#887). It maintains a runtime list of dyn-safe `Backend` objects for each mount point, using as much walking as feasible under the mount points. To exercise the `Composer` and demonstrate how it works, I've also switched `Devices` to stop being hardcoded to `/dev` _inside_ the backend but instead be a flat list of devices that is _mounted_ at `/dev`. While this PR does not expose/use it this way yet, with this PR, finally LiteBox core now has some of the fundamental machinery needed to eventually support `mount(2)` family of syscalls in the Linux shim. Future PRs will continue migrating more backends over, eventually allowing for the old layered file system to disappear, and replaced with this mount composition + (upcoming) overlay file system to support union mounting.
This PR introduces some of the key components the new filesystem design. Concretely, it sets up a new
Backendabstraction, which is used by theResolverto provide aFileSystem. This PR itself is part 1 of the changes towards this new file system design. For now, I have only migrated the devices sub-filesystem over to the new model.Few points of interest:
unimplemented!s in it along the way/devshowing up