diff options
author | Zhihao Cheng <chengzhihao1@huawei.com> | 2024-11-11 17:08:08 +0800 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2024-11-11 10:32:46 +0100 |
commit | 47c1cfd5e8ec289597f7342f88e103811511f0a8 (patch) | |
tree | 364fe0e96fbcd6bcbd964d0349f3d4883c5f539b /ubifs-utils/libubifs/lpt.c | |
parent | 59dd2cf5ad8e32c7b38b3287b9d05a2d809e93e4 (diff) |
fsck.ubifs: Move common functions and data structures into check_space.c
This is a preparation for adding LPT checking support. Move some data
structures and functions into check_space.c, also factor out some common
functions in libubifs:
1. Move 'lpts' from rebuild module, make it resuable for non-rebuild_fs
modes.
2. Move function 'get_free_leb' from rebuild_fs.c, it could be reused in
building LPT.
3. Move function 'build_lpt' from rebuild_fs.c, it could be reused in
building LPT.
4. Factor out lpt nodes freeing into a new function ubifs_free_lpt_nodes.
5. Factor out nnode dirty marking implementations into a new function
ubifs_make_nnode_dirty.
5. Export the function of nnode number calculation, calc_nnode_num is
renamed as ubifs_calc_nnode_num.
6. Export the function of making pnode dirty, do_make_pnode_dirty is
renamed as ubifs_make_pnode_dirty.
7. Rename next_pnode_to_dirty to ubifs_find_next_pnode and export it.
8. Export free_buds and expend its parameters.
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils/libubifs/lpt.c')
-rw-r--r-- | ubifs-utils/libubifs/lpt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ubifs-utils/libubifs/lpt.c b/ubifs-utils/libubifs/lpt.c index b07f1f7..fc70cad 100644 --- a/ubifs-utils/libubifs/lpt.c +++ b/ubifs-utils/libubifs/lpt.c @@ -523,7 +523,7 @@ static void add_pnode_dirt(struct ubifs_info *c, struct ubifs_pnode *pnode) } /** - * calc_nnode_num - calculate nnode number. + * ubifs_calc_nnode_num - calculate nnode number. * @row: the row in the tree (root is zero) * @col: the column in the row (leftmost is zero) * @@ -533,7 +533,7 @@ static void add_pnode_dirt(struct ubifs_info *c, struct ubifs_pnode *pnode) * This function calculates and returns the nnode number for the nnode at @row * and @col. */ -static int calc_nnode_num(int row, int col) +int ubifs_calc_nnode_num(int row, int col) { int num, bits; @@ -779,7 +779,7 @@ int ubifs_create_lpt(struct ubifs_info *c, struct ubifs_lprops *lps, int lp_cnt, nnode->nbranch[j].offs = 0; } } - nnode->num = calc_nnode_num(row, i); + nnode->num = ubifs_calc_nnode_num(row, i); ubifs_pack_nnode(c, p, nnode); p += c->nnode_sz; len += c->nnode_sz; |