Clean fsopen a bit & add support for mount_setattr#1630
Open
livingsilver94 wants to merge 6 commits into
Open
Conversation
Author
|
Converting to draft as the CI is returning errors I did not have on my system running Fedora + Rust 1.96. |
67c0b12 to
41612f0
Compare
MOUNT_ATTR_IDMAP requires an additional field (a file descriptor) that is not possible to pass to fsmount(). In fact, MOUNT_ATTR_IDMAP is supposed to be used in `struct mount_attr`, that defines the `.userns_fd` field for such task. It is better to remove MOUNT_ATTR_IDMAP from MountAttrFlags to not deceive users. See https://man7.org/linux/man-pages/man2/fsmount.2.html
MOUNT_ATTR_SIZE_VER0 is the `sizeof` of the first version of `struct mount_attr`, it's not supposed to be passed as a flag. Remove it from FsMountAttrFlags.
41612f0 to
b9e05c2
Compare
Author
|
Done. libc is not compatible with Rust 1.63 and it's making the CI fail, but this is outside of the scope of this PR unless you want me to fix that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is my attempt at supporting
mount_setattr, taking into consideration the factstruct mount_attris designed to be expandable, and that it currently borrows a user namespace's file descriptor. See discussions in PR #1002 for more details.The idea is to have a
MountAttrstruct that is a thin wrapper aroundstruct mount_attr, that also manages lifetimes. Theunderlying type is not exposed: you can only set parameters via the constructor and setters.
While at it, I cleaned fsopen (and some related modules) a little. See the commit history.
Fixes #975.
Test plan