aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/block_processor/serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs/block_processor/serial.c')
-rw-r--r--lib/sqfs/block_processor/serial.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/sqfs/block_processor/serial.c b/lib/sqfs/block_processor/serial.c
index daa11fe..b20d5b0 100644
--- a/lib/sqfs/block_processor/serial.c
+++ b/lib/sqfs/block_processor/serial.c
@@ -61,6 +61,22 @@ static int block_processor_sync(sqfs_block_processor_t *proc)
return ((serial_block_processor_t *)proc)->status;
}
+static int compare_frag_in_flight(sqfs_block_processor_t *proc,
+ sqfs_block_t *frag, sqfs_u32 index,
+ sqfs_u32 offset)
+{
+ if (proc->frag_block == NULL || index != proc->frag_block->index)
+ return -1;
+
+ if (offset >= proc->frag_block->size)
+ return -1;
+
+ if (frag->size > (proc->frag_block->size - offset))
+ return -1;
+
+ return memcmp(proc->frag_block->data + offset, frag->data, frag->size);
+}
+
int sqfs_block_processor_create_ex(const sqfs_block_processor_desc_t *desc,
sqfs_block_processor_t **out)
{
@@ -82,6 +98,7 @@ int sqfs_block_processor_create_ex(const sqfs_block_processor_desc_t *desc,
proc->base.sync = block_processor_sync;
proc->base.append_to_work_queue = append_to_work_queue;
+ proc->base.compare_frag_in_flight = compare_frag_in_flight;
((sqfs_object_t *)proc)->destroy = block_processor_destroy;
*out = (sqfs_block_processor_t *)proc;