From cf844f788d34e1facf142910b955554c69eb8f9b Mon Sep 17 00:00:00 2001 From: Zhihao Cheng Date: Mon, 11 Nov 2024 17:01:22 +0800 Subject: fsck.ubifs: Replay journal This is the 2/18 step of fsck. Replay journal, update TNC & LPT. There could be following steps and possible errors: Step 1. scan log LEB, get all bud LEBs a. corrupted scanning data in log area: danger mode with rebuild_fs and normal mode with 'yes' answer will turn to rebuild filesystem, other modes will exit. Step 2. scan bud LEBs, get all nodes a. corrupted scanning data in bud LEB: danger mode and normal mode with 'yes' answer will drop bud LEB and set %FR_LPT_INCORRECT for lpt status, other modes will exit. Step 3. apply nodes, record latest isize into size_tree Step 4. apply nodes, update TNC & LPT a. corrupted data searched from TNC: skip node and set %FR_LPT_INCORRECT lpt status 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. c. corrupted lpt: Set %FR_LPT_CORRUPTED for lpt status. Ignore the error. d. incorrect lpt: Set %FR_LPT_INCORRECT for lpt status. Ignore the error. e. If lpt status is not empty, skip updating lpt. Signed-off-by: Zhihao Cheng Signed-off-by: David Oberhollenzer --- ubifs-utils/fsck.ubifs/fsck.ubifs.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ubifs-utils/fsck.ubifs/fsck.ubifs.h') diff --git a/ubifs-utils/fsck.ubifs/fsck.ubifs.h b/ubifs-utils/fsck.ubifs/fsck.ubifs.h index 7f82615..f1da974 100644 --- a/ubifs-utils/fsck.ubifs/fsck.ubifs.h +++ b/ubifs-utils/fsck.ubifs/fsck.ubifs.h @@ -37,7 +37,8 @@ enum { NORMAL_MODE = 0, SAFE_MODE, DANGER_MODE0, DANGER_MODE1, REBUILD_MODE, CHECK_MODE }; /* Types of inconsistent problems */ -enum { SB_CORRUPTED = 0, MST_CORRUPTED }; +enum { SB_CORRUPTED = 0, MST_CORRUPTED, LOG_CORRUPTED, BUD_CORRUPTED, + TNC_CORRUPTED, TNC_DATA_CORRUPTED }; struct scanned_file; @@ -259,7 +260,7 @@ static inline const char *mode_name(const struct ubifs_info *c) extern int exit_code; /* problem.c */ -bool fix_problem(const struct ubifs_info *c, int problem_type); +bool fix_problem(const struct ubifs_info *c, int problem_type, const void *priv); /* load_fs.c */ int ubifs_load_filesystem(struct ubifs_info *c); -- cgit v1.2.3