nix
nix copied to clipboard
API request: expose `reflink` functionality
Although this is basically implemented in https://github.com/nicokoch/reflink/blob/master/src/sys/unix.rs, the code itself doesn't work portable on all architectures where linux runs (https://github.com/nicokoch/reflink/pull/7), and fixing it would require a duplication of code from the nix crate, so it might be a better idea to move the unix-specific code into the nix crate instead.
Pro tip: As long as you know the request code, you can generate the function using Nix's ioctl_write_int_bad! macro. Would that help?
idk exactly, I basically would need a way to express https://github.com/nicokoch/reflink/pull/7/files#diff-bbdb7821e30b05ce3afbaa9fbc1526c18d6670d65479baaca3beaf4ea6174891R18-R28 without as much code duplication.
Yes, that's exactly what it would help with. You'd still need to calculate the ioctl number, though.
request_read_write! is exported, that should suffice. (I asked in the reflink PR if it could be changed and if there are any downsides)