nix icon indicating copy to clipboard operation
nix copied to clipboard

API request: expose `reflink` functionality

Open fogti opened this issue 3 years ago • 4 comments
trafficstars

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.

fogti avatar Sep 02 '22 20:09 fogti

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?

asomers avatar Sep 11 '22 21:09 asomers

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.

fogti avatar Sep 11 '22 22:09 fogti

Yes, that's exactly what it would help with. You'd still need to calculate the ioctl number, though.

asomers avatar Sep 11 '22 22:09 asomers

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)

fogti avatar Sep 11 '22 22:09 fogti