Support mounting file systems & migrate devices to use mounts#995
Support mounting file systems & migrate devices to use mounts#995jaybosamiya-ms wants to merge 8 commits into
Conversation
|
GPT-5.5 reported two potential issues. I will try to review this PR tomorrow.
|
wdcui
left a comment
There was a problem hiding this comment.
Overall the code looks good to me. Some minor comments below. Please also take a look at the potential issues reported by GPT-5.5. Thanks!
| let dev_stdio = litebox::fs::resolver::Resolver::new( | ||
| litebox, | ||
| litebox::fs::devices::Devices::migration_helper_standalone_new(litebox), | ||
| litebox::fs::composer::Composer::builder() |
There was a problem hiding this comment.
Why do we have similar code both here and default_fs() in litebox_shim_linux/src/lib.rs?
There was a problem hiding this comment.
It's similar but a little different because the default_fs in the Linux shim does not deal with 9p. We can probably abstract some of it out, but that's outside the scope of this particular PR.
| if dir.location != Location::Dev { | ||
| return Err(OpenError::PathError(PathError::NoSuchFileOrDirectory)); | ||
| } | ||
| let _dir = dir.into_typed::<Self>(); |
There was a problem hiding this comment.
It looks like into_typed may cause panic by expect. It's a little hidden,and it's obvious that into_typed would have this kind of behavior.
There was a problem hiding this comment.
Yes, it can panic, but only if you actively try to use a handle from one file system onto another. The expectation is that any "normal" use of the file system will not actually panic, since users are not supposed to be invoking backends directly. More concretely, if we have initialized the file systems correctly (in shim or runner), and no backends are actively trying to mess with each other, then no set of guest syscalls can cause a panic at these calls.
Essentially, I explicitly chose not to make these Option or Result, but instead intentionally short there.
Nonetheless, I added doc comments to each of these as to what their intended use case is.
|
Thanks Weidong! The two reported issues are reasonable, not critical in practice I think, but fixed since they were real issues. I also added a little more documentation about the internal usage of |
|
🤖 SemverChecks 🤖 Click for details |
This PR introduces the
Composer, which acts as a mount point for the new core file system design (see #887). It maintains a runtime list of dyn-safeBackendobjects for each mount point, using as much walking as feasible under the mount points.To exercise the
Composerand demonstrate how it works, I've also switchedDevicesto stop being hardcoded to/devinside 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.