aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGao Xiang <gaoxiang25@huawei.com>2019-04-19 17:22:37 +0800
committerGao Xiang <hsiangkao@aol.com>2019-08-03 11:18:30 +0800
commit66653ef10a7fb4da0296f9c42b4f51035282966f (patch)
tree386c07a9591dd8fd3cf5ed08875502bd0306a496 /include
parentd51c2d043773a91e397ad8115fd9fdc0f78994e0 (diff)
downloaderofs-utils-66653ef10a7fb4da0296f9c42b4f51035282966f.tar.gz
erofs-utils: introduce compression for regular files
Yay! Let's try to transparent file compression for all regular files if necessary. Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Diffstat (limited to 'include')
-rw-r--r--include/erofs/compress.h25
-rw-r--r--include/erofs/config.h2
-rw-r--r--include/erofs/internal.h1
3 files changed, 28 insertions, 0 deletions
diff --git a/include/erofs/compress.h b/include/erofs/compress.h
new file mode 100644
index 0000000..e0abb8f
--- /dev/null
+++ b/include/erofs/compress.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * erofs_utils/include/erofs/compress.h
+ *
+ * Copyright (C) 2019 HUAWEI, Inc.
+ * http://www.huawei.com/
+ * Created by Gao Xiang <gaoxiang25@huawei.com>
+ */
+#ifndef __EROFS_COMPRESS_H
+#define __EROFS_COMPRESS_H
+
+#include "internal.h"
+
+/* workaround for an upstream lz4 compression issue, which can crash us */
+/* #define EROFS_CONFIG_COMPR_MAX_SZ (1024 * 1024) */
+#define EROFS_CONFIG_COMPR_MAX_SZ (900 * 1024)
+#define EROFS_CONFIG_COMPR_MIN_SZ (32 * 1024)
+
+int erofs_write_compressed_file(struct erofs_inode *inode);
+
+int z_erofs_compress_init(void);
+int z_erofs_compress_exit(void);
+
+#endif
+
diff --git a/include/erofs/config.h b/include/erofs/config.h
index e31732b..177017b 100644
--- a/include/erofs/config.h
+++ b/include/erofs/config.h
@@ -19,6 +19,8 @@ struct erofs_configure {
/* related arguments for mkfs.erofs */
char *c_img_path;
char *c_src_path;
+ char *c_compr_alg_master;
+ int c_compr_level_master;
};
extern struct erofs_configure cfg;
diff --git a/include/erofs/internal.h b/include/erofs/internal.h
index f4ca9ee..cf33e22 100644
--- a/include/erofs/internal.h
+++ b/include/erofs/internal.h
@@ -93,6 +93,7 @@ struct erofs_inode {
struct erofs_buffer_head *bh_inline, *bh_data;
void *idata;
+ void *compressmeta;
};
#define IS_ROOT(x) ((x) == (x)->i_parent)