• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0+ OR Apache-2.0 */
2 /*
3  * Copyright (C) 2018-2019 HUAWEI, Inc.
4  *             http://www.huawei.com/
5  * Created by Li Guifu <bluce.liguifu@huawei.com>
6  */
7 #ifndef __EROFS_CONFIG_H
8 #define __EROFS_CONFIG_H
9 
10 #ifdef __cplusplus
11 extern "C"
12 {
13 #endif
14 
15 #include "defs.h"
16 #include "err.h"
17 
18 
19 enum {
20 	FORCE_INODE_COMPACT = 1,
21 	FORCE_INODE_EXTENDED,
22 };
23 
24 enum {
25 	FORCE_INODE_BLOCK_MAP = 1,
26 	FORCE_INODE_CHUNK_INDEXES,
27 };
28 
29 enum {
30 	TIMESTAMP_NONE,
31 	TIMESTAMP_FIXED,
32 	TIMESTAMP_CLAMPING,
33 };
34 
35 #define EROFS_MAX_COMPR_CFGS		64
36 
37 struct erofs_configure {
38 	const char *c_version;
39 	int c_dbg_lvl;
40 	bool c_dry_run;
41 	bool c_legacy_compress;
42 #ifndef NDEBUG
43 	bool c_random_pclusterblks;
44 	bool c_random_algorithms;
45 #endif
46 	char c_timeinherit;
47 	char c_chunkbits;
48 	bool c_inline_data;
49 	bool c_ztailpacking;
50 	bool c_fragments;
51 	bool c_all_fragments;
52 	bool c_dedupe;
53 	bool c_ignore_mtime;
54 	bool c_showprogress;
55 	bool c_extra_ea_name_prefixes;
56 	bool c_xattr_name_filter;
57 	bool c_ovlfs_strip;
58 
59 #ifdef HAVE_LIBSELINUX
60 	struct selabel_handle *sehnd;
61 #endif
62 	/* related arguments for mkfs.erofs */
63 	char *c_img_path;
64 	char *c_src_path;
65 	char *c_blobdev_path;
66 	char *c_compress_hints_file;
67 	char *c_compr_alg[EROFS_MAX_COMPR_CFGS];
68 	int c_compr_level[EROFS_MAX_COMPR_CFGS];
69 	char c_force_inodeversion;
70 	char c_force_chunkformat;
71 	/* < 0, xattr disabled and INT_MAX, always use inline xattrs */
72 	int c_inline_xattr_tolerance;
73 
74 	u32 c_pclusterblks_max, c_pclusterblks_def, c_pclusterblks_packed;
75 	u32 c_max_decompressed_extent_bytes;
76 	u32 c_dict_size;
77 	u64 c_unix_timestamp;
78 	u32 c_uid, c_gid;
79 	const char *mount_point;
80 	long long c_uid_offset, c_gid_offset;
81 #ifdef WITH_ANDROID
82 	char *target_out_path;
83 	char *fs_config_file;
84 	char *block_list_file;
85 #endif
86 
87 	/* offset when reading multi partition images */
88 	u64 c_offset;
89 };
90 
91 extern struct erofs_configure cfg;
92 
93 void erofs_init_configure(void);
94 void erofs_show_config(void);
95 void erofs_exit_configure(void);
96 
97 void erofs_set_fs_root(const char *rootdir);
98 const char *erofs_fspath(const char *fullpath);
99 
100 #ifdef HAVE_LIBSELINUX
101 int erofs_selabel_open(const char *file_contexts);
102 #else
erofs_selabel_open(const char * file_contexts)103 static inline int erofs_selabel_open(const char *file_contexts)
104 {
105 	return -EINVAL;
106 }
107 #endif
108 
109 void erofs_update_progressinfo(const char *fmt, ...);
110 char *erofs_trim_for_progressinfo(const char *str, int placeholder);
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif
117