1 /* SPDX-License-Identifier: GPL-2.0+ OR Apache-2.0 */ 2 /* 3 * Copyright (C) 2019 HUAWEI, Inc. 4 * http://www.huawei.com/ 5 * Created by Gao Xiang <gaoxiang25@huawei.com> 6 */ 7 #ifndef __EROFS_COMPRESS_H 8 #define __EROFS_COMPRESS_H 9 10 #ifdef __cplusplus 11 extern "C" 12 { 13 #endif 14 15 #include "internal.h" 16 17 #define EROFS_CONFIG_COMPR_MAX_SZ (4000 * 1024) 18 19 void z_erofs_drop_inline_pcluster(struct erofs_inode *inode); 20 int erofs_write_compressed_file(struct erofs_inode *inode, int fd); 21 22 int z_erofs_compress_init(struct erofs_sb_info *sbi, 23 struct erofs_buffer_head *bh); 24 int z_erofs_compress_exit(void); 25 26 const char *z_erofs_list_supported_algorithms(int i, unsigned int *mask); 27 const char *z_erofs_list_available_compressors(int *i); 28 erofs_is_packed_inode(struct erofs_inode * inode)29static inline bool erofs_is_packed_inode(struct erofs_inode *inode) 30 { 31 erofs_nid_t packed_nid = inode->sbi->packed_nid; 32 33 if (inode->nid == EROFS_PACKED_NID_UNALLOCATED) { 34 DBG_BUGON(packed_nid != EROFS_PACKED_NID_UNALLOCATED); 35 return true; 36 } 37 return (packed_nid > 0 && inode->nid == packed_nid); 38 } 39 40 #ifdef __cplusplus 41 } 42 #endif 43 44 #endif 45