erofs-utils: lib: add erofs_{rebuild_make_root,enable_sb_chksum}
PATCH v2 1/1 erofs-utils: lib: add erofs_{rebuild_make_root,enable_sb_chksum}
Move erofs_sb_csum_set() and erofs_mkfs_alloc_root() into liberofs for external use.
Signed-off-by Hongzhen Luo <[email protected]>
---
v2: Update the commit message.
v1: https://lore.kernel.org/all/[email protected]/
--- include/erofs/inode.h | 1 + include/erofs/internal.h | 1 + lib/inode.c | 16 +++++++++ lib/super.c | 47 ++++++++++++++++++++++++ mkfs/main.c | 77 +++++----------------------------------- 5 files changed, 73 insertions(+), 69 deletions(-)
include/erofs/inode.h +1 -0
@@ -45,6 +45,7 @@ struct erofs_inode *erofs_mkfs_build_tree_from_path(struct erofs_sb_info *sbi,struct erofs_inode *erofs_mkfs_build_special_from_fd (struct erofs_sb_info *sbi,int fd,const char *name);int erofs_fixup_root_inode (struct erofs_inode *root); +struct erofs_inode *erofs_rebuild_make_root (struct erofs_sb_info *sbi); #ifdef __cplusplus }
include/erofs/internal.h +1 -0
@@ -403,6 +403,7 @@ void erofs_put_super(struct erofs_sb_info *sbi);int erofs_writesb (struct erofs_sb_info *sbi,struct erofs_buffer_head *sb_bh,erofs_blk_t *blocks);struct erofs_buffer_head *erofs_reserve_sb (struct erofs_sb_info *sbi); +int erofs_enable_sb_chksum (struct erofs_sb_info *sbi,u32 *crc);/* namei.c */ int erofs_read_inode_from_disk (struct erofs_inode *vi);
lib/inode.c +16 -0
@@ -1986,3 +1986,19 @@ int erofs_fixup_root_inode(struct erofs_inode *root)free (ibuf);return err; } + +struct erofs_inode *erofs_rebuild_make_root (struct erofs_sb_info *sbi) +{ +struct erofs_inode *root; + + root =erofs_new_inode (sbi); +if (IS_ERR (root)) +return root; + root->i_srcpath =strdup ("/" ); + root->i_mode =S_IFDIR |0777 ; + root->i_parent = root; + root->i_mtime = root->sbi->build_time; + root->i_mtime_nsec = root->sbi->build_time_nsec; +erofs_init_empty_dir (root); +return root; +}
lib/super.c +47 -0
50 lines not on this page · raw message
mkfs/main.c +8 -69
113 lines not on this page · raw message
Signature · 1 line
2.39.3
Quoted 8 lines · Hongzhen Luo
Move
erofs_sb_csum_set()anderofs_mkfs_alloc_root()into liberofs for external use.Signed-off-by Hongzhen Luo <[email protected]>---
v2: Update the commit message.
v1: https://lore.kernel.org/all/[email protected]/
---
I failed to apply this patch. Again, please rebase your patch on either -dev or -experimental branch.
Thanks,
Gao Xiang