Skip to content

Implement sparse files support#62

Merged
alexcrichton merged 8 commits into
composefs:masterfrom
tailhook:sparse_files
Apr 30, 2016
Merged

Implement sparse files support#62
alexcrichton merged 8 commits into
composefs:masterfrom
tailhook:sparse_files

Conversation

@tailhook

Copy link
Copy Markdown
Contributor

This adds a Read trait which emits all zeros on non-existing chunks of file.

Any ideas how to provide an interface where you could actually produce a sparse file on a filesystem? As far as I know there is no cross-platform way to create a sparse file, and so no way to do it with standard library. So maybe we should provide this functionality as iterator of blocks?

I've added super minimal example files, so I could test the library. Also I should add some tests for this pull request specifically.

Comment thread src/header.rs
pub struct GnuExtSparseHeader {
pub sparse: [GnuSparseHeader; 21],
pub isextended: [u8; 1],
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this also explicitly have the 7 bytes of padding to ensure that the header is 512 bytes in length?

@alexcrichton

Copy link
Copy Markdown
Collaborator

Awesome, thanks @tailhook! Could you also be sure to add enough tests to cover all the new code here as well?

@tailhook

Copy link
Copy Markdown
Contributor Author

I'm don't know how to make it simpler or how to write decoder in terms of io combinators. We can't do chain of the arbitrary number of readers not known at compile time. And even if we do, we can't borrow the reader twice.

I've fixed other issues and added tests. So given we now have the tests, can we merge it in, and refactor later if needed?

@alexcrichton alexcrichton merged commit ff91870 into composefs:master Apr 30, 2016
@alexcrichton

Copy link
Copy Markdown
Collaborator

Ok, I ended up rejiggering the code a bit and adding a few more pieces of functionality here and there, can you give it a whirl and see if it works for you?

@tailhook

Copy link
Copy Markdown
Contributor Author

Works fine for me. Thanks!

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 this pull request may close these issues.

2 participants