nix
nix copied to clipboard
Add functions for iterating over Linux filesystems
Hi,
I'm relatively new to Rust and this is my first time interfacing Rust with C, I needed to find out if a path is already mounted and I thought I should contribute back :)
First: I'm not affiliated with the nix project, so take this review with a grain of salt.
Of course, but I imagine this is helping the maintainers of nix-rust, and is certainly helping me so thank you for your time :)
I'm still wondering if it is possible to avoid all the owned strings. It feels like exposing
Cow<'_, str>
safely is just on the border of what is possible with rust.
I think that is what they are trying to do https://www.reddit.com/r/rust/comments/d4rl3d/a_remarkably_simple_solution_to_the_problem_of/ with Rc
. I still need to wrap my brain around this a bit more, especially as it's difficult because the buffer we send to getmntent_r
comes back to us in pieces (split into the fields)
Thanks! I've resolved the conflicts (was just the updating libc, which is no longer necessary in this commit). I haven't had any further thoughts about the buffer we allocate as one, then pass in to C which splits it up, re: how to use CoW but if I do I might even remember to come back to this. I think I still need to chase up the glibc bug but I can do that separately to this :)
I haven't had any further thoughts on the buffer -> C -> split buffer back, if I do I can always make a different MR, for now I've marked it as ready as everything else is I think ready