Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparse file support for lseek? #480

Closed
sharifhsn opened this issue Dec 8, 2022 · 3 comments · Fixed by #486
Closed

Sparse file support for lseek? #480

sharifhsn opened this issue Dec 8, 2022 · 3 comments · Fixed by #486

Comments

@sharifhsn
Copy link
Contributor

On Linux and some other POSIX systems, lseek supports two additional values for whence relating to sparse files, SEEK_HOLE and SEEK_DATA. I believe these should be supported by rustix.

For reference, some filesystems have files with large amounts of zero data that can be optionally marked "sparse", and these sections won't be allocated on disk. This feature can be exposed to userspace applications to improve the performance of some operations, like cp.

Although this is technically not a part of the POSIX standard, it has been proposed for issue 8.

As an example of prior art, nix already exposes this ability.

@sunfishcode
Copy link
Member

Yes, rustix should add this. It will require Rustix to switch to its own SeekFrom type, rather than just using std's, but I think that makes sense to do.

@sharifhsn
Copy link
Contributor Author

Great! I'll submit a PR for this today if you want.

@sunfishcode
Copy link
Member

Sure, sounds great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants