aboutsummaryrefslogtreecommitdiff
path: root/ubifs-utils/libubifs
AgeCommit message (Collapse)Author
8 daysubifs-utils: Adapt sb.c in libubifsZhihao Cheng
Adapt sb.c in libubifs, compared with linux kernel implementations: 1. Remove authentication related implementations (eg. authenticate_sb_node), authentication is not supported in fsck for now. 2. Remove some functions(eg. create_default_filesystem) which won't be used in fsck/mkfs. 3. Modify ubifs_read_superblock(), remove some assignments which won't be used in mkfs/fsck. 4. Apapt fixup_leb to ignore %-EBADMSG, subsequent steps will check all areas carefully. Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 daysubifs-utils: Adapt recovery subsystem in libubifsZhihao Cheng
Adapt recovery subsystem(replay.c, recovery.c) in libubifs, compared with linux kernel implementations: 1. Remove authentication related implementations (eg. authenticate_sleb_hash), authentication is not supported in fsck for now. 2. Add explicit type conversions(const char *) to avoid compiling warnings. 3. Replace implementations of inode_fix_size() with ubifs_assert(0), authentication is not supported in fsck, so this function won't be invoked. 4. Remove unused ubifs_clean_lebs() and ubifs_write_rcvrd_mst_node(). 5. Adapt fix_unclean_leb/recover_head/fix_size_in_place to ignore %-EBADMSG, subsequent steps will check nodes in lpt/main area carefully. Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 daysubifs-utils: Adapt log.c in libubifsZhihao Cheng
Adapt log.c in libubifs, compared with linux kernel implementations: 1. Remove debug related implementations(eg. dbg_check_bud_bytes), debug functions are not needed by fsck, because fsck will check fs in another way. Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 daysubifs-utils: Adapt tnc subsystem in libubifsZhihao Cheng
Adapt tnc subsystem(tnc.c,tnc_misc.c,tnc_commit.c) in libubifs, compared with linux kernel implementations: 1. Remove debug related functions(eg. dbg_check_inode_size), debug functions are not needed by fsck, because fsck will check fs in another way. 2. Remove some functions(eg. ubifs_tnc_bulk_read) which won't be used in fsck/mkfs. 3. Adapt tnc_delete and ubifs_search_zbranch to handle empty TNC case, which could happen in fsck. 4. Don't skip checking the length of non-leaf index node's branch in read_znode. 5. Adapt try_read_node to ignore %-EBADMSG, subsequent steps will check nodes carefully. Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 daysubifs-utils: Adapt lpt subsystem in libubifsZhihao Cheng
Adapt lpt subsystem(lpt.c,lprops.c,lpt_commit.c) in libubifs, compared with linux kernel implementations: 1. Remove debug related functions(eg. dbg_chk_lpt_sz, dbg_chk_pnode), some of debug functions are not needed by fsck, because fsck will check fs in another way. 2. Remove some functions(eg. ubifs_create_dflt_lpt) which won't be used in fsck/mkfs. 3. Adapt do_calc_lpt_geom() to mkfs/fsck situations. 4. Adapt calc_dflt_lpt_geom to support the mkfs tool, and export it. 5. Adapt ubifs_create_lpt() according to create_lpt(mkfs), make sure that the height of created lpt is right. Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 daysubifs-utils: Adapt io.c in libubifsZhihao Cheng
Adapt io.c in libubifs, compared with linux kernel implementations: 1. Modify io related functions(eg. ubifs_leb_read/ubifs_leb_write, etc.), adapt them with userspace io functions lseek/read/write. 2. Remove some functions(eg. record_magic_error, ubifs_bg_wbufs_sync) which won't be used in fsck/mkfs. 3. Replce ubifs_errc with ubifs_err, because there will be no SB_SILENT options in mkfs/fsck. 4. Initiate wbuf->size as c->max_write_size. Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 daysubifs-utils: Adapt super.c in libubifsZhihao Cheng
Adapt super.c in libubifs, compared with linux kernel implementations: 1. It contains all definitions in common/super.c(Message printing functions are replaced with linux kernel styles). 2. Remove some functions(eg. ubifs_iget, ubifs_dirty_inode) which won't be used in fsck/mkfs. 3. Remove unused variables initialization in some functions(eg. init_constants_early, init_constants_sb). Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 daysubifs-utils: Adapt ubifs header file in libubifsZhihao Cheng
Adapt ubifs header file in libubifs, compared with linux kernel implementations: 1. New header file contains all definitions in common/ubifs.h 2. Remove some structures(eg. ubifs_mount_opts, bu_info) and functions(eg. ubifs_sync_wbufs_by_inode, ubifs_jnl_XXX) which won't be used in fsck/mkfs. 3. Modify some authentication related functions, keep functions that mkfs may need, other functions are defined as empty. 4. Move ubifs message printing functions(ubifs_err/warn/msg) which are originally defined in misc.c into ubifs.h. Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
8 daysubifs-utils: Import UBIFS libs from linux kernelZhihao Cheng
Import UBIFS libs from linux kernel. Next patches will replace ubifs related source code with implementation of linux kernel, which makes userspace implementation be same with linux kernel, then fsck.ubifs can resuse the code. Notice: lpt.c is modified with [1] applied. ubifs.h and orphan.c are modified with [2] applied, journal.c is modified with [3] reverted( because fsck runs in a single thread, so waitqueue is not needed to be implemented in userspace.). [1] https://lore.kernel.org/linux-mtd/20231228014112.2836317-13-chengzhihao1@huawei.com/ [2] https://lore.kernel.org/linux-mtd/20240410073751.2522830-1-chengzhihao1@huawei.com/ [3] https://lore.kernel.org/linux-mtd/20240122063103.359501-1-chengzhihao1@huawei.com/ Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>