1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * erofs-utils/include/erofs/config.h 4 * 5 * Copyright (C) 2018-2019 HUAWEI, Inc. 6 * http://www.huawei.com/ 7 * Created by Li Guifu <bluce.liguifu@huawei.com> 8 */ 9 #ifndef __EROFS_CONFIG_H 10 #define __EROFS_CONFIG_H 11 12 #include "defs.h" 13 #include "err.h" 14 15 #ifdef HAVE_LIBSELINUX 16 #include <selinux/selinux.h> 17 #include <selinux/label.h> 18 #endif 19 20 #ifdef WITH_ANDROID 21 #include <selinux/android.h> 22 #include <private/android_filesystem_config.h> 23 #include <private/canned_fs_config.h> 24 #include <private/fs_config.h> 25 #endif 26 27 enum { 28 FORCE_INODE_COMPACT = 1, 29 FORCE_INODE_EXTENDED, 30 }; 31 32 enum { 33 TIMESTAMP_NONE, 34 TIMESTAMP_FIXED, 35 TIMESTAMP_CLAMPING, 36 }; 37 38 struct erofs_configure { 39 const char *c_version; 40 int c_dbg_lvl; 41 bool c_dry_run; 42 bool c_legacy_compress; 43 char c_timeinherit; 44 45 #ifdef HAVE_LIBSELINUX 46 struct selabel_handle *sehnd; 47 #endif 48 /* related arguments for mkfs.erofs */ 49 char *c_img_path; 50 char *c_src_path; 51 char *c_compr_alg_master; 52 int c_compr_level_master; 53 int c_force_inodeversion; 54 /* < 0, xattr disabled and INT_MAX, always use inline xattrs */ 55 int c_inline_xattr_tolerance; 56 u64 c_unix_timestamp; 57 #ifdef WITH_ANDROID 58 char *mount_point; 59 char *target_out_path; 60 char *fs_config_file; 61 #endif 62 }; 63 64 extern struct erofs_configure cfg; 65 66 void erofs_init_configure(void); 67 void erofs_show_config(void); 68 void erofs_exit_configure(void); 69 70 void erofs_set_fs_root(const char *rootdir); 71 const char *erofs_fspath(const char *fullpath); 72 73 #ifdef HAVE_LIBSELINUX 74 int erofs_selabel_open(const char *file_contexts); 75 #else erofs_selabel_open(const char * file_contexts)76static inline int erofs_selabel_open(const char *file_contexts) 77 { 78 return -EINVAL; 79 } 80 #endif 81 82 #endif 83 84