mount(2) wrapper
This is a slightly harder problem than it looks, for a few reasons:
-
We need to have a Rust-level API for
mount(2), which is already a bit hard given that the semantics ofmount(2)are incredibly odd and probably should be at least 5-6 separate methods. How those methods should be split and how we should expose very filesystem-specific features like mount options is also going to be fun (and almost every mount wrapper gets this wrong...). -
There is a new mount API (since 5.3-ish) which we should support since certain features will only be supported by it (and it also has some other "fun" features like being able to directly mount to a file descriptor without needing to go through procfs as well as mounting over symlinks :fire: :fire: :fire:). Ideally this should be compatible with the
mount(2)methods (meaning we use the new mount API opportunisically) but this is going to be extra fun becausefsconfig(2)is incredibly different tomount(2)-style flags and options. But maybe we should just go with thefsconfig(2)style and then mount -
It's unclear whether mounts should be an operation on a handle (which is more accurate, but has weird semantics -- like that you can umount a handle which wasn't mounted over and doesn't point at a mountpoint because in-kernel the
struct pathgets resolved and that's all that matters) or on a root (more in keeping with other operations but is still a little bit odd in that you can't be sure what path you're dealing with -- imagine mountingprocfsinside a container).
Not to mention all of the above should be presented through C FFI in a way that makes sense.