Export mountinfo::MountInfoParser#7
Conversation
|
I'm fine with this. However, I should take a closer look to review the public API before a release because we are going to maintain it for long time. Your feedback is valuable for this thing. Do you find current API good? Does it solves your task? |
|
BTW I actually extended another crate that parsed /proc/mount to also handle mountinfo here: stemjail/mnt-rs#4 but which unfortunately hasn't been picked up yet. BTW libmount wouldn't want to take that code because it's under a different license. Some nice things there that libmount might want to adopt are small helper constructors that handle reading from /proc/self/mountinfo (or /proc/(pid)/mountinfo) without making the caller do this. Going along with that would be the need for the MountInfoParser to own the buffer instead of just having a reference. I started to work on this but wasn't sure how to handle io:Errors that would now be possible. mnt-rs had a From conversion for io:Error to its ParseError type, but libmount's ParseError is a little more specialized so that didn't seem like an obviously good way to go. |
Well, what's your use case? I believe mountinfo is used just for few "system level" things and it's not hard to write two lines
You can't return reference borrowed from the internal buffer when using Iterator trait. So either get rid of iterator or return fully owned entry. I don't think it's justified. For what it worth error type is not a problem, we can turn it into an enum. And it should be public API too. (your PR omits it) |
So it can be used. Signed-off-by: Andy Grover <agrover@redhat.com>
ddff38c to
a23fde3
Compare
|
OK, I was just comparing to what the other crate did, I'm fine with current impl, tbh. BTW for how I'd like to use MountInfoParser, I have a prelim commit with the changes for our project: agrover/stratisd@cc294f8. (We also probably could be using libmount for mounting and unmounting since we need that too, but this commit doesn't yet.) |
|
Updated PR to export ParseError as well. |
|
Okay, further investigation shows:
|
|
Both points makes sense and sound good to me. |
|
Okay. Done in the current master. |
|
Great, thanks so much! I look forward to making use of this! btw please also update the checkbox on the main README feature list since mountinfo parsing is now supported 😃 😃 😃 |
|
Released as v0.1.9 with no further changes (apart from docstrings). |
Hi, I'd like to use
MountInfoParserand was hoping libmount could export it.