erofs-utils: add support for chunk-based files
v3 cover erofs-utils: add support for chunk-based files
v1 & 2: https://lore.kernel.org/r/[email protected]
changes since v2:
- add erofsfuse support for chunk-based files;
- add support for 4-byte blockmap array in addition to chunk indexes;
- update manpages;
- minor cleanups.
Gao Xiang (5):
erofs-utils: fuse: support reading chunk-based uncompressed files
erofs-utils: introduce hashmap from git source
erofs-utils: introduce sha256
erofs-utils: introduce copy_file_range
erofs-utils: mkfs: support chunk-based uncompressed files
configure.ac | 1 + include/erofs/blobchunk.h | 18 +++ include/erofs/config.h | 1 + include/erofs/defs.h | 77 ++++++++++ include/erofs/flex-array.h | 147 +++++++++++++++++++ include/erofs/hashmap.h | 103 ++++++++++++++ include/erofs/hashtable.h | 77 ---------- include/erofs/internal.h | 6 + include/erofs/io.h | 7 + include/erofs_fs.h | 48 ++++++- lib/Makefile.am | 3 +- lib/blobchunk.c | 217 ++++++++++++++++++++++++++++ lib/data.c | 86 +++++++++-- lib/hashmap.c | 284 +++++++++++++++++++++++++++++++++++++ lib/inode.c | 36 ++++- lib/io.c | 97 ++++++++++++- lib/namei.c | 15 +- lib/sha256.c | 248 ++++++++++++++++++++++++++++++++ man/mkfs.erofs.1 | 3 + mkfs/main.c | 38 +++++ 20 files changed, 1413 insertions(+), 99 deletions(-) create mode 100644 include/erofs/blobchunk.h create mode 100644 include/erofs/flex-array.h create mode 100644 include/erofs/hashmap.h create mode 100644 lib/blobchunk.c create mode 100644 lib/hashmap.c create mode 100644 lib/sha256.c
Signature · 1 line
2.24.4
PATCH v3 1/5 erofs-utils: fuse: support reading chunk-based uncompressed files
Keep in sync with the latest kernel
commit 2a9dc7a8fec6 ("erofs: introduce chunk-based file on-disk format") and
commit c5aa903a59db ("erofs: support reading chunk-based uncompressed files")
--- include/erofs/internal.h | 5 +++ include/erofs_fs.h | 48 ++++++++++++++++++++-- lib/data.c | 86 +++++++++++++++++++++++++++++++++++----- lib/namei.c | 15 ++++++- 4 files changed, 140 insertions(+), 14 deletions(-)
include/erofs/internal.h +5 -0
@@ -109,6 +109,7 @@ static inline void erofs_sb_clear_##name(void) \ EROFS_FEATURE_FUNCS(lz4_0padding, incompat, INCOMPAT_LZ4_0PADDING) EROFS_FEATURE_FUNCS(compr_cfgs, incompat, INCOMPAT_COMPR_CFGS) EROFS_FEATURE_FUNCS(big_pcluster, incompat, INCOMPAT_BIG_PCLUSTER) +EROFS_FEATURE_FUNCS(chunked_file, incompat, INCOMPAT_CHUNKED_FILE) EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM)#define EROFS_I_EA_INITED (1 << 0)
@@ -140,6 +141,10 @@ struct erofs_inode {u32 i_blkaddr;u32 i_blocks;u32 i_rdev; +struct { +unsigned short chunkformat; +unsigned char chunkbits; + }; } u;char i_srcpath[PATH_MAX +1 ];
include/erofs_fs.h +45 -3
108 lines not on this page · raw message
lib/data.c +76 -10
116 lines not on this page · raw message
lib/namei.c +14 -1
@@ -82,6 +82,9 @@ static int erofs_read_inode_from_disk(struct erofs_inode *vi) vi->i_ctime =le64_to_cpu (die->i_ctime); vi->i_ctime_nsec =le64_to_cpu (die->i_ctime_nsec); vi->i_size =le64_to_cpu (die->i_size); +if (vi->datalayout ==EROFS_INODE_CHUNK_BASED ) +/* fill chunked inode summary info */ + vi->u.chunkformat =le16_to_cpu (die->i_u.c.format);break ;case EROFS_INODE_LAYOUT_COMPACT : vi->inode_isize =sizeof (struct erofs_inode_compact );
@@ -115,6 +118,8 @@ static int erofs_read_inode_from_disk(struct erofs_inode *vi) vi->i_ctime_nsec = sbi.build_time_nsec; vi->i_size =le32_to_cpu (dic->i_size); +if (vi->datalayout ==EROFS_INODE_CHUNK_BASED ) + vi->u.chunkformat =le16_to_cpu (dic->i_u.c.format);break ;default : erofs_err("unsupported on-disk inode version %u of nid %llu",
@@ -123,7 +128,15 @@ static int erofs_read_inode_from_disk(struct erofs_inode *vi) } vi->flags =0 ; -if (erofs_inode_is_data_compressed (vi->datalayout)) +if (vi->datalayout ==EROFS_INODE_CHUNK_BASED ) { +if (vi->u.chunkformat & ~EROFS_CHUNK_FORMAT_ALL ) { +erofs_err ("unsupported chunk format %x of nid %llu" , + vi->u.chunkformat, vi->nid |0ULL ); +return -EOPNOTSUPP ; + } + vi->u.chunkbits =LOG_BLOCK_SIZE + + (vi->u.chunkformat &EROFS_CHUNK_FORMAT_BLKBITS_MASK ); + }else if (erofs_inode_is_data_compressed (vi->datalayout))z_erofs_fill_inode (vi);return 0 ; bogusimode:
Signature · 1 line
2.24.4
PATCH v3 2/5 erofs-utils: introduce hashmap from git source
In reply to Gao XiangCopied from git source (it's already workable).
--- include/erofs/flex-array.h | 147 +++++++++++++++++++ include/erofs/hashmap.h | 103 ++++++++++++++ lib/Makefile.am | 3 +- lib/hashmap.c | 284 +++++++++++++++++++++++++++++++++++++ 4 files changed, 536 insertions(+), 1 deletion(-) create mode 100644 include/erofs/flex-array.h create mode 100644 include/erofs/hashmap.h create mode 100644 lib/hashmap.c
include/erofs/flex-array.h new file +147 -0
@@ -0,0 +1,147 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __EROFS_FLEX_ARRAY_H +#define __EROFS_FLEX_ARRAY_H + +#include <stdio.h> +#include <stdlib.h> +#include <limits.h> +#include <stdint.h> + +#include "defs.h" +#include "print.h" + +/* +* flex-array.h +* +* Some notes to make sense of the code. +* +* Flex-arrays: +* - Flex-arrays became standard in C99 and are defined by "array[]" (at the +* end of a struct) +* - Pre-C99 flex-arrays can be accomplished by "array[1]" +* - There is a GNU extension where they are defined using "array[0]" +* Allegedly there is/was a bug in gcc whereby foo[1] generated incorrect +* code, so it's safest to use [0] (https://lkml.org/lkml/2015/2/18/407). +* +* For C89 and C90, __STDC__ is 1 +* For later standards, __STDC_VERSION__ is defined according to the standard. +* For example: 199901L or 201112L +* +* Whilst we're on the subject, in version 5 of gcc, the default std was +* changed from gnu89 to gnu11. In jgmenu, CFLAGS therefore contains -std=gnu89 +* You can check your default gcc std by doing: +* gcc -dM -E - </dev/null | grep '__STDC_VERSION__\|__STDC__' +* +* The code below is copied from git's git-compat-util.h in support of +* hashmap.c +*/ + +#ifndef FLEX_ARRAY +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >=199901L ) && \ + (!defined(__SUNPRO_C) || (__SUNPRO_C >0x580 )) +# define FLEX_ARRAY /* empty */ +#elif defined(__GNUC__) +# if (__GNUC__ >=3 ) +# define FLEX_ARRAY /* empty */ +# else +# define FLEX_ARRAY 0/* older GNU extension */ +# endif +#endif + +/* Otherwise, default to safer but a bit wasteful traditional style */ +#ifndef FLEX_ARRAY +# define FLEX_ARRAY 1 +#endif +#endif + +#define bitsizeof (x) (CHAR_BIT * sizeof(x)) + +#define maximum_signed_value_of_type (a) \ + (INTMAX_MAX >> (bitsizeof(intmax_t) - bitsizeof(a))) + +#define maximum_unsigned_value_of_type (a) \ + (UINTMAX_MAX >> (bitsizeof(uintmax_t) - bitsizeof(a))) + +/* +* Signed integer overflow is undefined in C, so here's a helper macro +* to detect if the sum of two integers will overflow. +* Requires: a >= 0, typeof(a) equals typeof(b) +*/ +#define signed_add_overflows (a, b) \ + ((b) > maximum_signed_value_of_type(a) - (a)) + +#define unsigned_add_overflows (a, b) \ + ((b) > maximum_unsigned_value_of_type(a) - (a)) + +static inline size_t st_add (size_t a,size_t b) +{ +if (unsigned_add_overflows (a, b)) { +erofs_err ("size_t overflow: %llu + %llu" , a |0ULL , b |0ULL ); +BUG_ON (1 ); +return -1 ; + } +return a + b; +} + +#define st_add3 (a, b, c) st_add(st_add((a), (b)), (c)) +#define st_add4 (a, b, c, d) st_add(st_add3((a), (b), (c)), (d)) + +/* +* These functions help you allocate structs with flex arrays, and copy +* the data directly into the array. For example, if you had: +* +* struct foo { +* int bar; +* char name[FLEX_ARRAY]; +* }; +* +* you can do: +* +* struct foo *f; +* FLEX_ALLOC_MEM(f, name, src, len); +* +* to allocate a "foo" with the contents of "src" in the "name" field. +* The resulting struct is automatically zero'd, and the flex-array field +* is NUL-terminated (whether the incoming src buffer was or not). +* +* The FLEXPTR_* variants operate on structs that don't use flex-arrays, +* but do want to store a pointer to some extra data in the same allocated +* block. For example, if you have: +* +* struct foo { +* char *name; +* int bar; +* }; +* +* you can do: +* +* struct foo *f; +* FLEXPTR_ALLOC_STR(f, name, src); +* +* and "name" will point to a block of memory after the struct, which will be +* freed along with the struct (but the pointer can be repointed anywhere). +* +* The *_STR variants accept a string parameter rather than a ptr/len +* combination. +* +* Note that these macros will evaluate the first parameter multiple +* times, and it must be assignable as an lvalue. +*/ +#define FLEX_ALLOC_MEM (x, flexname, buf, len) do { \ + size_t flex_array_len_ = (len); \ + (x) = calloc(1, st_add3(sizeof(*(x)), flex_array_len_, 1)); \ + BUG_ON(!(x)); \ + memcpy((void *)(x)->flexname, (buf), flex_array_len_); \ +} while (0) +#define FLEXPTR_ALLOC_MEM (x, ptrname, buf, len) do { \ + size_t flex_array_len_ = (len); \ + (x) = xcalloc(1, st_add3(sizeof(*(x)), flex_array_len_, 1)); \ + memcpy((x) + 1, (buf), flex_array_len_); \ + (x)->ptrname = (void *)((x) + 1); \ +} while (0) +#define FLEX_ALLOC_STR (x, flexname, str) \ + FLEX_ALLOC_MEM((x), flexname, (str), strlen(str)) +#define FLEXPTR_ALLOC_STR (x, ptrname, str) \ + FLEXPTR_ALLOC_MEM((x), ptrname, (str), strlen(str)) + +#endif
include/erofs/hashmap.h new file +103 -0
103 lines not on this page · raw message
lib/Makefile.am +2 -1
@@ -21,7 +21,8 @@ noinst_HEADERS = $(top_srcdir)/include/erofs_fs.h \ noinst_HEADERS += compressor.h liberofs_la_SOURCES = config.c io.c cache.c super.c inode.c xattr.c exclude.c \ - namei.c data.c compress.c compressor.c zmap.c decompress.c compress_hints.c + namei.c data.c compress.c compressor.c zmap.c decompress.c \ + compress_hints.c hashmap.c liberofs_la_CFLAGS = -Wall -Werror -I$(top_srcdir)/include if ENABLE_LZ4 liberofs_la_CFLAGS += ${LZ4_CFLAGS}
lib/hashmap.c new file +284 -0
284 lines not on this page · raw message
Signature · 1 line
2.24.4
PATCH v3 3/5 erofs-utils: introduce sha256
In reply to Gao XiangA simple sha256 approach copied from e2fsprogs.
--- lib/Makefile.am | 2 +- lib/sha256.c | 248 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 249 insertions(+), 1 deletion(-) create mode 100644 lib/sha256.c
lib/Makefile.am +1 -1
@@ -22,7 +22,7 @@ noinst_HEADERS = $(top_srcdir)/include/erofs_fs.h \ noinst_HEADERS += compressor.h liberofs_la_SOURCES = config.c io.c cache.c super.c inode.c xattr.c exclude.c \ namei.c data.c compress.c compressor.c zmap.c decompress.c \ - compress_hints.c hashmap.c + compress_hints.c hashmap.c sha256.c liberofs_la_CFLAGS = -Wall -Werror -I$(top_srcdir)/include if ENABLE_LZ4 liberofs_la_CFLAGS += ${LZ4_CFLAGS}
lib/sha256.c new file +248 -0
248 lines not on this page · raw message
Signature · 1 line
2.24.4
PATCH v3 4/5 erofs-utils: introduce copy_file_range
In reply to Gao XiangAdd copy_file_range support. Emulate it instead if libc doesn't support it or have no emulation.
--- configure.ac | 1 + include/erofs/io.h | 5 +++ lib/io.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+)
configure.ac +1 -0
@@ -158,6 +158,7 @@ AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1, # Checks for library functions. AC_CHECK_FUNCS(m4_flatten([ backtrace + copy_file_range fallocate gettimeofday lgetxattr
include/erofs/io.h +5 -0
@@ -7,6 +7,7 @@#ifndef __EROFS_IO_H#define __EROFS_IO_H +#define _GNU_SOURCE#include <unistd.h> #include "internal.h"
@@ -24,6 +25,10 @@ int dev_fsync(void);int dev_resize (erofs_blk_t nblocks);u64 dev_length (void ); +int erofs_copy_file_range (int fd_in,erofs_off_t *off_in, +int fd_out,erofs_off_t *off_out, +size_t length); +static inline int blk_write (const void *buf,erofs_blk_t blkaddr,u32 nblocks) {
lib/io.c +95 -0
98 lines not on this page · raw message
Signature · 1 line
2.24.4
PATCH v3 5/5 erofs-utils: mkfs: support chunk-based uncompressed files
In reply to Gao Xiangmkfs support for the new chunk-based uncompressed files, including:
* chunk-based files with 4-byte block address array;
* chunk-based files with 8-byte inode chunk indexes.
--- include/erofs/blobchunk.h | 18 ++++ include/erofs/config.h | 1 + include/erofs/defs.h | 77 ++++++++++++++ include/erofs/hashtable.h | 77 -------------- include/erofs/internal.h | 1 + include/erofs/io.h | 2 + lib/Makefile.am | 2 +- lib/blobchunk.c | 217 ++++++++++++++++++++++++++++++++++++++ lib/inode.c | 36 +++++-- lib/io.c | 2 +- man/mkfs.erofs.1 | 3 + mkfs/main.c | 38 +++++++ 12 files changed, 389 insertions(+), 85 deletions(-) create mode 100644 include/erofs/blobchunk.h create mode 100644 lib/blobchunk.c
include/erofs/blobchunk.h new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* erofs-utils/lib/blobchunk.h +* +* Copyright (C) 2021, Alibaba Cloud +*/ +#ifndef __EROFS_BLOBCHUNK_H +#define __EROFS_BLOBCHUNK_H + +#include "erofs/internal.h" + +int erofs_blob_write_chunk_indexes (struct erofs_inode *inode,erofs_off_t off); +int erofs_blob_write_chunked_file (struct erofs_inode *inode); +int erofs_blob_remap (void ); +void erofs_blob_exit (void ); +int erofs_blob_init (void ); + +#endif
include/erofs/config.h +1 -0
@@ -42,6 +42,7 @@ struct erofs_configure {bool c_random_pclusterblks;#endif char c_timeinherit; +char c_chunkbits;bool c_noinline_data;#ifdef HAVE_LIBSELINUX
include/erofs/defs.h +77 -0
83 lines not on this page · raw message
include/erofs/hashtable.h +0 -77
83 lines not on this page · raw message
include/erofs/internal.h +1 -0
@@ -165,6 +165,7 @@ struct erofs_inode {union {void *compressmeta; +void *chunkindexes;struct {uint16_t z_advise;uint8_t z_algorithmtype[2 ];
include/erofs/io.h +2 -0
@@ -25,6 +25,8 @@ int dev_fsync(void);int dev_resize (erofs_blk_t nblocks);u64 dev_length (void ); +extern int erofs_devfd; +int erofs_copy_file_range (int fd_in,erofs_off_t *off_in,int fd_out,erofs_off_t *off_out,size_t length);
lib/Makefile.am +1 -1
@@ -22,7 +22,7 @@ noinst_HEADERS = $(top_srcdir)/include/erofs_fs.h \ noinst_HEADERS += compressor.h liberofs_la_SOURCES = config.c io.c cache.c super.c inode.c xattr.c exclude.c \ namei.c data.c compress.c compressor.c zmap.c decompress.c \ - compress_hints.c hashmap.c sha256.c + compress_hints.c hashmap.c sha256.c blobchunk.c liberofs_la_CFLAGS = -Wall -Werror -I$(top_srcdir)/include if ENABLE_LZ4 liberofs_la_CFLAGS += ${LZ4_CFLAGS}
lib/blobchunk.c new file +217 -0
217 lines not on this page · raw message
lib/inode.c +30 -6
@@ -24,6 +24,7 @@#include "erofs/exclude.h" #include "erofs/block_list.h" #include "erofs/compress_hints.h" +#include "erofs/blobchunk.h" #define S_SHIFT 12static unsigned char erofs_ftype_by_mode[S_IFMT >>S_SHIFT ] = {
@@ -387,6 +388,12 @@ int erofs_write_file(struct erofs_inode *inode)return 0 ; } +if (cfg.c_chunkbits) { + inode->u.chunkbits = cfg.c_chunkbits; + inode->u.chunkformat =EROFS_CHUNK_FORMAT_INDEXES ; +return erofs_blob_write_chunked_file (inode); + } +if (cfg.c_compr_alg_master &&erofs_file_is_compressible (inode)) { ret =erofs_write_compressed_file (inode);
@@ -440,6 +447,10 @@ static bool erofs_bh_flush_write_inode(struct erofs_buffer_head *bh)if (is_inode_layout_compression (inode)) u.dic.i_u.compressed_blocks =cpu_to_le32 (inode->u.i_blocks); +else if (inode->datalayout == +EROFS_INODE_CHUNK_BASED ) + u.dic.i_u.c.format = +cpu_to_le16 (inode->u.chunkformat);else u.dic.i_u.raw_blkaddr =cpu_to_le32 (inode->u.i_blkaddr);
@@ -473,6 +484,10 @@ static bool erofs_bh_flush_write_inode(struct erofs_buffer_head *bh)if (is_inode_layout_compression (inode)) u.die.i_u.compressed_blocks =cpu_to_le32 (inode->u.i_blocks); +else if (inode->datalayout == +EROFS_INODE_CHUNK_BASED ) + u.die.i_u.c.format = +cpu_to_le16 (inode->u.chunkformat);else u.die.i_u.raw_blkaddr =cpu_to_le32 (inode->u.i_blkaddr);
@@ -505,12 +520,19 @@ static bool erofs_bh_flush_write_inode(struct erofs_buffer_head *bh) }if (inode->extent_isize) { -/* write compression metadata */ - off =Z_EROFS_VLE_EXTENT_ALIGN (off); - ret =dev_write (inode->compressmeta, off, inode->extent_isize); -if (ret) -return false; -free (inode->compressmeta); +if (inode->datalayout ==EROFS_INODE_CHUNK_BASED ) { + ret =erofs_blob_write_chunk_indexes (inode, off); +if (ret) +return false; + }else { +/* write compression metadata */ + off =Z_EROFS_VLE_EXTENT_ALIGN (off); + ret =dev_write (inode->compressmeta, off, + inode->extent_isize); +if (ret) +return false; +free (inode->compressmeta); + } } inode->bh =NULL ;
@@ -565,6 +587,8 @@ static int erofs_prepare_inode_buffer(struct erofs_inode *inode)if (is_inode_layout_compression (inode)) goto noinline; +if (inode->datalayout ==EROFS_INODE_CHUNK_BASED ) + goto noinline;if (cfg.c_noinline_data &&S_ISREG (inode->i_mode)) { inode->datalayout =EROFS_INODE_FLAT_PLAIN ;
lib/io.c +1 -1
@@ -24,7 +24,7 @@#include "erofs/print.h" static const char *erofs_devname; -static int erofs_devfd =-1 ; +int erofs_devfd =-1 ;static u64 erofs_devsz;int dev_get_blkdev_size (int fd,u64 *bytes)
man/mkfs.erofs.1 +3 -0
@@ -83,6 +83,9 @@ Set all file gids to \fIGID\fR. .B \-\-all-root Make all files owned by root. .TP +.BI "\-\-chunksize " # +Generate chunk-based files with #-byte chunks. +.TP .B \-\-help Display this help and exit. .TP
mkfs/main.c +38 -0
@@ -22,6 +22,7 @@#include "erofs/exclude.h" #include "erofs/block_list.h" #include "erofs/compress_hints.h" +#include "erofs/blobchunk.h" #ifdef HAVE_LIBUUID #include <uuid.h>
@@ -44,6 +45,7 @@ static struct option long_options[] = {#endif {"max-extent-bytes", required_argument, NULL, 9}, {"compress-hints", required_argument, NULL, 10}, + {"chunksize", required_argument, NULL, 11}, #ifdef WITH_ANDROID {"mount-point", required_argument, NULL, 512}, {"product-out", required_argument, NULL, 513},
@@ -79,6 +81,7 @@ static void usage(void)#ifdef HAVE_LIBUUID " -UX use a given filesystem UUID\n" #endif +" --chunksize=X generate chunk-based files with X-byte chunks\n" " --exclude-path=X avoid including file X (X = exact literal path)\n" " --exclude-regex=X avoid including files that match X (X = regular expression)\n" #ifdef HAVE_LIBSELINUX
@@ -321,6 +324,26 @@ static int mkfs_parse_options_cfg(int argc, char *argv[]) cfg.c_pclusterblks_max = i /EROFS_BLKSIZ ; cfg.c_pclusterblks_def = cfg.c_pclusterblks_max;break ; +case 11 : + i =strtol (optarg, &endptr,0 ); +if (*endptr !='\0' ) { +erofs_err ("invalid chunksize %s" , optarg); +return -EINVAL ; + } + cfg.c_chunkbits =ilog2 (i); +if ((1 << cfg.c_chunkbits) != i) { +erofs_err ("chunksize %s must be a power of two" , + optarg); +return -EINVAL ; + } +if (i <EROFS_BLKSIZ ) { +erofs_err ("chunksize %s must be larger than block size" , + optarg); +return -EINVAL ; + } +erofs_sb_set_chunked_file (); +erofs_warn ("EXPERIMENTAL chunked file feature in use. Use at your own risk!" ); +break ;case 1 :usage ();
@@ -528,6 +551,12 @@ int main(int argc, char **argv)return 1 ; } +if (cfg.c_chunkbits) { + err =erofs_blob_init (); +if (err) +return 1 ; + } + err =lstat64 (cfg.c_src_path, &st);if (err)return 1 ;
@@ -622,6 +651,13 @@ int main(int argc, char **argv) root_nid =erofs_lookupnid (root_inode);erofs_iput (root_inode); +if (cfg.c_chunkbits) { +erofs_info ("total metadata: %u blocks" ,erofs_mapbh (NULL )); + err =erofs_blob_remap (); +if (err) + goto exit; + } + err =erofs_mkfs_update_super_block (sb_bh, root_nid, &nblocks);if (err) goto exit;
@@ -642,6 +678,8 @@ exit:dev_close ();erofs_cleanup_compress_hints ();erofs_cleanup_exclude_rules (); +if (cfg.c_chunkbits) +erofs_blob_exit ();erofs_exit_configure ();if (err) {
Signature · 1 line
2.24.4
Re: [PATCH v3 5/5] erofs-utils: mkfs: support chunk-based uncompressed files
Quoted 6 lines · Gao Xiang
mkfs support for the new chunk-based uncompressed files, including:
* chunk-based files with 4-byte block address array;
* chunk-based files with 8-byte inode chunk indexes.Signed-off-by Gao Xiang <[email protected]>
Quoted 17 lines
--- include/erofs/blobchunk.h | 18 ++++ include/erofs/config.h | 1 + include/erofs/defs.h | 77 ++++++++++++++ include/erofs/hashtable.h | 77 -------------- include/erofs/internal.h | 1 + include/erofs/io.h | 2 + lib/Makefile.am | 2 +- lib/blobchunk.c | 217 ++++++++++++++++++++++++++++++++++++++ lib/inode.c | 36 +++++-- lib/io.c | 2 +- man/mkfs.erofs.1 | 3 + mkfs/main.c | 38 +++++++ 12 files changed, 389 insertions(+), 85 deletions(-) create mode 100644 include/erofs/blobchunk.h create mode 100644 lib/blobchunk.c
Applying following diff to fix up the MacOS build:
configure.ac +2 -1
@@ -170,7 +170,8 @@ AC_CHECK_FUNCS(m4_flatten([ strdup strerror strrchr - strtoull])) + strtoull + tmpfile64])) # Configure debug mode AS_IF([test "x$enable_debug" != "xno"], [], [
lib/blobchunk.c +4 -0
@@ -208,7 +208,11 @@ void erofs_blob_exit(void)int erofs_blob_init (void ) { +#ifdef HAVE_TMPFILE64 blobfile =tmpfile64 (); +#else + blobfile =tmpfile (); +#endif if (!blobfile)return -ENOMEM ;