• 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 struct erofs_configure {
36 	const char *c_version;
37 	int c_dbg_lvl;
38 	bool c_dry_run;
39 	bool c_legacy_compress;
40 #ifndef NDEBUG
41 	bool c_random_pclusterblks;
42 #endif
43 	char c_timeinherit;
44 	char c_chunkbits;
45 	bool c_noinline_data;
46 	bool c_ztailpacking;
47 	bool c_ignore_mtime;
48 	bool c_showprogress;
49 
50 #ifdef HAVE_LIBSELINUX
51 	struct selabel_handle *sehnd;
52 #endif
53 	/* related arguments for mkfs.erofs */
54 	char *c_img_path;
55 	char *c_src_path;
56 	char *c_blobdev_path;
57 	char *c_compress_hints_file;
58 	char *c_compr_alg_master;
59 	int c_compr_level_master;
60 	char c_force_inodeversion;
61 	char c_force_chunkformat;
62 	/* < 0, xattr disabled and INT_MAX, always use inline xattrs */
63 	int c_inline_xattr_tolerance;
64 
65 	u32 c_pclusterblks_max, c_pclusterblks_def;
66 	u32 c_max_decompressed_extent_bytes;
67 	u32 c_dict_size;
68 	u64 c_unix_timestamp;
69 	u32 c_uid, c_gid;
70 #ifdef WITH_ANDROID
71 	char *mount_point;
72 	char *target_out_path;
73 	char *fs_config_file;
74 	char *block_list_file;
75 #endif
76 };
77 
78 extern struct erofs_configure cfg;
79 
80 void erofs_init_configure(void);
81 void erofs_show_config(void);
82 void erofs_exit_configure(void);
83 
84 void erofs_set_fs_root(const char *rootdir);
85 const char *erofs_fspath(const char *fullpath);
86 
87 #ifdef HAVE_LIBSELINUX
88 int erofs_selabel_open(const char *file_contexts);
89 #else
erofs_selabel_open(const char * file_contexts)90 static inline int erofs_selabel_open(const char *file_contexts)
91 {
92 	return -EINVAL;
93 }
94 #endif
95 
96 void erofs_update_progressinfo(const char *fmt, ...);
97 char *erofs_trim_for_progressinfo(const char *str, int placeholder);
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif
104