diff mbox series

[f2fs-dev,v2] f2fs-tools: fix to set c.auto_fix only for fsck

Message ID 20250307090049.52182-1-chao@kernel.org (mailing list archive)
State New
Headers show
Series [f2fs-dev,v2] f2fs-tools: fix to set c.auto_fix only for fsck | expand

Commit Message

Chao Yu March 7, 2025, 9 a.m. UTC
add_default_options() will be reused by fsck family tools, including
dump, dfrag, resize, sload, label, inject, add a comment for this.

And also fix to set c.auto_fix only for fsck in add_default_options().

Signed-off-by: Chao Yu <chao@kernel.org>
---
v2:
- fix typo in comments
 fsck/main.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/fsck/main.c b/fsck/main.c
index 97cab5d..47ba6c9 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -215,17 +215,19 @@  static void error_out(char *prog)
 		MSG(0, "\nWrong program.\n");
 }
 
-static void __add_fsck_options(void)
-{
-	/* -a */
-	c.auto_fix = 1;
-}
-
 static void add_default_options(void)
 {
 	switch (c.defset) {
 	case CONF_ANDROID:
-		__add_fsck_options();
+		if (c.func == FSCK) {
+			/* -a */
+			c.auto_fix = 1;
+		}
+
+		/*
+		 * global config for fsck family tools, including dump,
+		 * defrag, resize, sload, label and inject.
+		 */
 
 		/* disable nat_bits feature by default */
 		c.disabled_feature |= F2FS_FEATURE_NAT_BITS;