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