aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-05-29 19:27:28 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-05-29 19:49:11 +0200
commit577aae140e05f2b7cd140926443517260c0132b7 (patch)
tree13edf3ca12b02443259a05129e538e6f77339f06 /lib/sqfs
parent50b901d5ebdad40227de66cd5a0a0f62548f1563 (diff)
Block processor: add flags to manage hashing & sparse block detection
This commit adds 2 new user settable flags to the block processor: - A flag to ignore sparse blocks and treat them like normal data blocks. - A flag to disable checksum computation altogether. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs')
-rw-r--r--lib/sqfs/block_processor/common.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqfs/block_processor/common.c b/lib/sqfs/block_processor/common.c
index bfcc3d5..b40ec0f 100644
--- a/lib/sqfs/block_processor/common.c
+++ b/lib/sqfs/block_processor/common.c
@@ -144,12 +144,17 @@ static int process_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
}
}
- if (is_zero_block(block->data, block->size)) {
+ if (!(block->flags & SQFS_BLK_IGNORE_SPARSE) &&
+ is_zero_block(block->data, block->size)) {
block->flags |= SQFS_BLK_IS_SPARSE;
return 0;
}
- block->checksum = xxh32(block->data, block->size);
+ if (block->flags & SQFS_BLK_DONT_HASH) {
+ block->checksum = 0;
+ } else {
+ block->checksum = xxh32(block->data, block->size);
+ }
if (block->flags & (SQFS_BLK_IS_FRAGMENT | SQFS_BLK_DONT_COMPRESS))
return 0;