diff options
author | Zhihao Cheng <chengzhihao1@huawei.com> | 2024-11-11 17:08:01 +0800 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2024-11-11 10:32:46 +0100 |
commit | 0d1cc10378c2a8f800ff78d79c93b39485d6ca14 (patch) | |
tree | d4a840af01f202d6a515e06de60a4dda7095763f /ubifs-utils/libubifs | |
parent | 7e9a7ceaa9d3851963f92f99ce012f7cd99e742b (diff) |
fsck.ubifs: Traverse TNC and construct files
This is the 6/18 step of fsck. Traverse TNC and construct files. There
could be following steps and possible errors:
Step 1. Traverse TNC, check whether the leaf node is valid, remove invalid
nodes, construct file for valid node and insert file into file tree.
a. corrupted node searched from TNC: remove corresponding TNC branch for
danger mode and normal mode with 'yes' answer, other modes will exit.
b. corrupted index node read from TNC: danger mode with rebuild_fs and
normal mode with 'yes' answer will turn to rebuild filesystem, other
modes will exit.
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils/libubifs')
-rw-r--r-- | ubifs-utils/libubifs/debug.c | 12 | ||||
-rw-r--r-- | ubifs-utils/libubifs/debug.h | 1 |
2 files changed, 8 insertions, 5 deletions
diff --git a/ubifs-utils/libubifs/debug.c b/ubifs-utils/libubifs/debug.c index eaf403f..836cbc7 100644 --- a/ubifs-utils/libubifs/debug.c +++ b/ubifs-utils/libubifs/debug.c @@ -51,7 +51,7 @@ static const char *get_key_hash(int hash) } } -static const char *get_key_type(int type) +const char *ubifs_get_key_name(int type) { switch (type) { case UBIFS_INO_KEY: @@ -102,23 +102,25 @@ const char *dbg_snprintf_key(const struct ubifs_info *c, case UBIFS_INO_KEY: len -= snprintf(p, len, "(%lu, %s)", (unsigned long)key_inum(c, key), - get_key_type(type)); + ubifs_get_key_name(type)); break; case UBIFS_DENT_KEY: case UBIFS_XENT_KEY: len -= snprintf(p, len, "(%lu, %s, %#08x)", (unsigned long)key_inum(c, key), - get_key_type(type), key_hash(c, key)); + ubifs_get_key_name(type), + key_hash(c, key)); break; case UBIFS_DATA_KEY: len -= snprintf(p, len, "(%lu, %s, %u)", (unsigned long)key_inum(c, key), - get_key_type(type), key_block(c, key)); + ubifs_get_key_name(type), + key_block(c, key)); break; case UBIFS_TRUN_KEY: len -= snprintf(p, len, "(%lu, %s)", (unsigned long)key_inum(c, key), - get_key_type(type)); + ubifs_get_key_name(type)); break; default: len -= snprintf(p, len, "(bad key type: %#08x, %#08x)", diff --git a/ubifs-utils/libubifs/debug.h b/ubifs-utils/libubifs/debug.h index 4b475a0..c4aa59d 100644 --- a/ubifs-utils/libubifs/debug.h +++ b/ubifs-utils/libubifs/debug.h @@ -84,6 +84,7 @@ static inline int dbg_is_chk_index(__unused const struct ubifs_info *c) { return 0; } /* Dump functions */ +const char *ubifs_get_key_name(int type); const char *ubifs_get_type_name(int type); const char *dbg_ntype(int type); const char *dbg_cstate(int cmt_state); |