If the input file isn't a multiple of block_size, count the trailing
bit as a block in the output, otherwise bootloader will try to write
past the last declared block in the sparse file.
Test: Run sparse_test
Bug: 37339998
Change-Id: Iec143107d15795c6a6f4d3ea7b7515f6f16adcae
CHUNK_HEADER structure type allows DATA chunk to be up to MAX_UINT
large.
The write() callback LEN parameter should be unsigned int.
Also:
- write() callback should continue to write data if less than expected
data have been written.
- gzerror() returns LEN on success, 0 otherwise
Test: manual
Change-Id: Id46d664b84c1a506f419524fe28055f784c2ae7a
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
This cleans up most of the size-related problems in system/core.
There are still a few changes needed for a clean 64-bit build,
but they look like they might require changes to things like the
fastboot protocol.
Change-Id: I1560425a289fa158e13e2e3173cc3e71976f92c0
Fix the issue that "out" pointer is dereferenced without checking.
Change-Id: I76a57ad7309841218231346f4807ef2be8628737
Signed-off-by: Hong-Mei Li <a21834@motorola.com>
Until ext4_utils switches to using libsparse, libext4_utils defines some
of the same symbols as libsparse. Fastboot links statically against
both of them, and there is no easy way to make the symbols hidden, so
just rename them in libsparse.
Change-Id: Idc2cfe20efe3c3a7fb8233f453a89bbbeb0dcc8b
Add a new output file subclass that will call a callback for
each block as it is written. Will be used to measure the space
used by each sparse block to allow resparsing files.
Also add sparse_file_callback, which will write out a sparse
file by calling the provided write function.
Change-Id: I18707bd9c357b68da319cc07982e93d1c2b2bee2
Create two subclasses of output_file that can handle normal
and gzipped files, and refactor open_output_fd. Will allow
adding support for an output_file type that is not file
backed.
Change-Id: I26744c74d13f205cf17df1ea9caac1eea9c57357
Add sparse_file_add_fd to include all or part of the contents
of an fd in the output file. Will be useful for re-sparsing files
where fd will point to the input sparse file.
Change-Id: I5d4ab07fb37231e8e9c1912f62a2968c8b0a00ef
Move block loops into sparse.c with iterator helpers in backed_block.c.
Simplify chunk writing by moving skip chunk calls from output_file.c to
sparse.c.
Rename variables to be consistent with new naming.
Remove use of u8, u32, u64.
Change-Id: Ic138ad58bef9f96239266ccee12ee83ea285e7eb
This moves an exact copy of libsparse from
system/extras/ext4_utils/libsparse to system/core/libsparse in
preparation for linking tools in system/core against it.
Change-Id: If664e4fcfd6612844ac745589beb1517e7f9fe58