The check for chunk size is done on the compressed data.
This forbids to create the same chunk set in case data is not compressed
and comparison is done using the hashes of original data and not of
compressed chunk.
Signed-off-by: Stefano Babic <sbabic@denx.de>
ZCK_VAL_HEADER_HASH_TYPE, /* Set what the header hash type *should* be */
ZCK_VAL_HEADER_LENGTH, /* Set what the header length *should* be */
ZCK_UNCOMP_HEADER, /* Header should contain uncompressed size, too */
+ ZCK_NO_MIN_CHUNKSIZE, /* No check for min size */
ZCK_COMP_TYPE = 100, /* Set compression type using zck_comp */
ZCK_MANUAL_CHUNK, /* Disable auto-chunking */
ZCK_CHUNK_MIN, /* Minimum chunk size when manual chunking */
"chunk");
else
zck_log(ZCK_LOG_DDEBUG, "Automatically ending chunk");
- if(zck->comp.dc_data_size < zck->chunk_auto_min) {
+ if(!zck->no_check_min_size && zck->comp.dc_data_size < zck->chunk_auto_min) {
zck_log(ZCK_LOG_DDEBUG,
"Chunk too small, refusing to end chunk");
continue;
if(!zck->comp.started && !comp_init(zck))
return -1;
- if(zck->comp.dc_data_size < zck->chunk_min_size) {
+ if(!zck->no_check_min_size && zck->comp.dc_data_size < zck->chunk_min_size) {
zck_log(ZCK_LOG_DDEBUG, "Chunk too small, refusing to end chunk");
return zck->comp.dc_data_size;
}
} else if(option == ZCK_UNCOMP_HEADER) {
zck->has_uncompressed_source = 1;
+ } else if(option == ZCK_NO_MIN_CHUNKSIZE) {
+ zck->no_check_min_size = 1;
/* Hash options */
} else if(option < 100) {
/* Currently no hash options other than setting hash type, so bail */
int has_streams;
int has_optional_elems;
int has_uncompressed_source;
+ int no_check_min_size;
char *read_buf;
size_t read_buf_size;
}
if(arguments.uncompressed) {
- if(!zck_set_ioption(zck, ZCK_UNCOMP_HEADER, 1)) {
+ if(!zck_set_ioption(zck, ZCK_UNCOMP_HEADER, 1) ||
+ (!zck_set_ioption(zck, ZCK_NO_MIN_CHUNKSIZE, 1))) {
dprintf(STDERR_FILENO, "%s\n", zck_get_error(zck));
exit(1);
}