Commit graph

4 commits

Author SHA1 Message Date
Sean Anderson
6150b00b60 img2simg: Add support for converting holes to "don't care" chunks
This adds support for converting files with holes to "don't care"
chunks. This can result in a substantial reduction in the time it takes
to program an image if it has many holes.

Generally, constants compared to argc have been reduced by one, since we
no longer have the program name as the first argument.

Change-Id: I00750edc07d6415dcc07ae0351e9397b0222b7ba
2022-01-27 14:49:46 -05:00
Sean Anderson
f96466b055 libsparse: Add "hole" mode to sparse_file_read
This adds support for filesystem-level sparse files. These files have
holes which are not stored in the filesystem and when read are full of
zeros. While these zeros may be significant in some types of files,
other types of files may not care about the contents of holes. For
example, most filesystem creation tools write to all the blocks they
care about. Those blocks not written to will remain holes, and can be
safely represented by "don't care" chunks. Using "don't care" chunks
instead of fill chunks can result in a substantial reduction of the time
it takes to program a sparse image.

To accomplish this, we extend the existing "sparse" boolean parameter to
be an enum of mode types. This enum represents the strategy we take when
reading in a file. For the most part the implementation is
straightforward. We use lseek to determine where the holes in the file
are, and then use do_sparse_file_read_normal to create chunks for the
data section. Note that every file has an implicit hole at its end.

Change-Id: I0cfbf08886fca9a91cb753ec8734c84fcbe52c9f
2022-01-27 14:49:46 -05:00
Jerry Zhang
7b444f08c1 libsparse: Add .clang-format and reformat to google3 style
Bug: 78793464
Test: compiles
Change-Id: I8e44ba77195a12fc2bac7d4276bbc4aa95149b31
2018-06-13 20:32:24 +00:00
Jerry Zhang
5a75507795 libsparse: Change source files to cpp
Bug: 78793464
Test: compiles
Change-Id: Ib8b933fe3ccb8dfa49a77f7955891678bf0df086
2018-06-13 11:17:22 -07:00
Renamed from libsparse/img2simg.c (Browse further)