1*33b1fccfSAndroid Build Coastguard Worker /* SPDX-License-Identifier: GPL-2.0+ OR Apache-2.0 */ 2*33b1fccfSAndroid Build Coastguard Worker /* 3*33b1fccfSAndroid Build Coastguard Worker * Copyright (C) 2022 Alibaba Cloud 4*33b1fccfSAndroid Build Coastguard Worker */ 5*33b1fccfSAndroid Build Coastguard Worker #ifndef __EROFS_DEDUPE_H 6*33b1fccfSAndroid Build Coastguard Worker #define __EROFS_DEDUPE_H 7*33b1fccfSAndroid Build Coastguard Worker 8*33b1fccfSAndroid Build Coastguard Worker #ifdef __cplusplus 9*33b1fccfSAndroid Build Coastguard Worker extern "C" 10*33b1fccfSAndroid Build Coastguard Worker { 11*33b1fccfSAndroid Build Coastguard Worker #endif 12*33b1fccfSAndroid Build Coastguard Worker 13*33b1fccfSAndroid Build Coastguard Worker #include "internal.h" 14*33b1fccfSAndroid Build Coastguard Worker 15*33b1fccfSAndroid Build Coastguard Worker struct z_erofs_inmem_extent { 16*33b1fccfSAndroid Build Coastguard Worker erofs_blk_t blkaddr; 17*33b1fccfSAndroid Build Coastguard Worker unsigned int compressedblks; 18*33b1fccfSAndroid Build Coastguard Worker unsigned int length; 19*33b1fccfSAndroid Build Coastguard Worker bool raw, partial, inlined; 20*33b1fccfSAndroid Build Coastguard Worker }; 21*33b1fccfSAndroid Build Coastguard Worker 22*33b1fccfSAndroid Build Coastguard Worker struct z_erofs_dedupe_ctx { 23*33b1fccfSAndroid Build Coastguard Worker u8 *start, *end; 24*33b1fccfSAndroid Build Coastguard Worker u8 *cur; 25*33b1fccfSAndroid Build Coastguard Worker struct z_erofs_inmem_extent e; 26*33b1fccfSAndroid Build Coastguard Worker }; 27*33b1fccfSAndroid Build Coastguard Worker 28*33b1fccfSAndroid Build Coastguard Worker int z_erofs_dedupe_match(struct z_erofs_dedupe_ctx *ctx); 29*33b1fccfSAndroid Build Coastguard Worker int z_erofs_dedupe_insert(struct z_erofs_inmem_extent *e, 30*33b1fccfSAndroid Build Coastguard Worker void *original_data); 31*33b1fccfSAndroid Build Coastguard Worker void z_erofs_dedupe_commit(bool drop); 32*33b1fccfSAndroid Build Coastguard Worker int z_erofs_dedupe_init(unsigned int wsiz); 33*33b1fccfSAndroid Build Coastguard Worker void z_erofs_dedupe_exit(void); 34*33b1fccfSAndroid Build Coastguard Worker 35*33b1fccfSAndroid Build Coastguard Worker #ifdef __cplusplus 36*33b1fccfSAndroid Build Coastguard Worker } 37*33b1fccfSAndroid Build Coastguard Worker #endif 38*33b1fccfSAndroid Build Coastguard Worker 39*33b1fccfSAndroid Build Coastguard Worker #endif 40