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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow wrapping an existing /dev/fuse file descriptor #304
Allow wrapping an existing /dev/fuse file descriptor #304
Changes from all commits
574a43a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this optional instead of removing it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the utility of getting the mountpoint back out, after you just passed it in? Especially if it returns an
Option<PathBuf>
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getter doesn't seem useful, but it seems nice to have the logging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the logging back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to have a
mount_to_fd()
function similar tomount()
that instead returns the FD. That better separates the concerns of creating the mountpoint, which won't even need to have aFilesystem
implementation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just for symmetry - I'm not using it, so I can remove it if you don't like it. Note that the stdlib equivalents all support this (File, various sockets, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would someone use it though?
The reason it doesn't seem right to me is that a
Session
represents a mounted filesystem, borrowing its fd, and reading/writing it would interfere with theFilesystem
that is mounted and feels like it breaks the encapsulation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By passing it into
mount(2)
/fsconfig(2)
to mount the session somewhere.In my use case, you need to mount first and then create the session. But it's not hard to imagine someone needing to do it the other way around.
EDIT: I just thought of another one. You could unset
CLOEXEC
or do some otherfcntl
stuff on the session if you needed to.EDIT2: You could also use it to call fuse ioctls, perhaps ones that aren't supported by this library yet (eg file passthrough).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zooming out a bit:
I would like to submit that FUSE is a very low-level concept, and it's often used as a hack-on-demand. So people using it probably know what they're doing, and may have complicated requirements. A fuse session is a
/dev/fuse
file descriptor - therefore it fulfills the requirements ofAsFd
.I do see the concerns around breaking the encapsulation, but
Channel
is not actually stateful, right? So it's really very similar toUnixStream
or whatever. If you callAsFd
on aUnixStream
and drop down tonix::io::write
or whatever, you probably have a very specific use case that the stdlib authors didn't think of.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points. Thanks for explaining the use case!