If a chunk with the same hash is already present on device, it is
recorded in the src pointer. Add accessor to return this chunk.
Signed-off-by: Stefano Babic <sbabic@denx.de>
/* Find out if two chunk digests are the same */
bool zck_compare_chunk_digest(zckChunk *a, zckChunk *b)
__attribute__ ((warn_unused_result));
-
+/* Get associate src chunk if any */
+zckChunk *zck_get_src_chunk(zckChunk *idx)
+ __attribute__ ((warn_unused_result));
/*******************************************************************
* Advanced hash functions
return idx->next;
}
+zckChunk PUBLIC *zck_get_src_chunk(zckChunk *idx) {
+ if(idx && idx->zck) {
+ VALIDATE_PTR(idx->zck);
+ ALLOCD_PTR(idx->zck, idx);
+ } else {
+ ALLOCD_PTR(NULL, idx);
+ }
+
+ return idx->src;
+}
+
ssize_t PUBLIC zck_get_chunk_start(zckChunk *idx) {
if(idx && idx->zck) {
VALIDATE_INT(idx->zck);