Skip to content

Sparse file support for lseek? #480

Closed

Description

@sharifhsn

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.

Activity

  1. sunfishcode commented on Dec 13, 2022

    @sunfishcode
    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.

  2. sharifhsn commented on Dec 13, 2022

    @sharifhsn
    ContributorAuthor

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

  3. sunfishcode commented on Dec 13, 2022

    @sunfishcode
    Member

    Sure, sounds great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions