[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201207064250.272240-2-robinh3123@gmail.com>
Date: Mon, 7 Dec 2020 14:42:48 +0800
From: Robin Hsu <robinh3123@...il.com>
To: linux-f2fs-devel@...ts.sourceforge.net, jaegeuk@...nel.org,
chao@...nel.org
Cc: linux-kernel@...r.kernel.org, Robin Hsu <robinhsu@...gle.com>
Subject: [PATCH v2 1/3] f2fs-tools: Added #ifdef WITH_func
From: Robin Hsu <robinhsu@...gle.com>
Add proprocessor defines (options) 'WITH_func',
where func = DUMP, DEFRAG, RESIZE, or SLOAD
Bug: 161486536
Test: n/a (trivial)
Signed-off-by: Robin Hsu <robinhsu@...gle.com>
Change-Id: I813755548cc71dd8b026abd06893ed0fcf1d8b26
---
fsck/main.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/fsck/main.c b/fsck/main.c
index e70048b..b20498f 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -345,6 +345,7 @@ void f2fs_parse_options(int argc, char *argv[])
break;
}
} else if (!strcmp("dump.f2fs", prog)) {
+#ifdef WITH_DUMP
const char *option_string = "d:i:n:s:Sa:b:V";
static struct dump_option dump_opt = {
.nid = 0, /* default root ino */
@@ -426,7 +427,9 @@ void f2fs_parse_options(int argc, char *argv[])
}
c.private = &dump_opt;
+#endif
} else if (!strcmp("defrag.f2fs", prog)) {
+#ifdef WITH_DEFRAG
const char *option_string = "d:s:Sl:t:iV";
c.func = DEFRAG;
@@ -484,7 +487,9 @@ void f2fs_parse_options(int argc, char *argv[])
if (err != NOERROR)
break;
}
+#endif
} else if (!strcmp("resize.f2fs", prog)) {
+#ifdef WITH_RESIZE
const char *option_string = "d:st:iV";
c.func = RESIZE;
@@ -526,7 +531,9 @@ void f2fs_parse_options(int argc, char *argv[])
if (err != NOERROR)
break;
}
+#endif
} else if (!strcmp("sload.f2fs", prog)) {
+#ifdef WITH_SLOAD
const char *option_string = "C:d:f:p:s:St:T:V";
#ifdef HAVE_LIBSELINUX
int max_nr_opt = (int)sizeof(c.seopt_file) /
@@ -595,6 +602,7 @@ void f2fs_parse_options(int argc, char *argv[])
if (err != NOERROR)
break;
}
+#endif /* WITH_SLOAD */
}
if (err == NOERROR) {
@@ -707,6 +715,7 @@ static int do_fsck(struct f2fs_sb_info *sbi)
return FSCK_ERRORS_LEFT_UNCORRECTED;
}
+#ifdef WITH_DUMP
static void do_dump(struct f2fs_sb_info *sbi)
{
struct dump_option *opt = (struct dump_option *)c.private;
@@ -733,7 +742,9 @@ static void do_dump(struct f2fs_sb_info *sbi)
print_cp_state(flag);
}
+#endif
+#ifdef WITH_DEFRAG
static int do_defrag(struct f2fs_sb_info *sbi)
{
struct f2fs_super_block *sb = F2FS_RAW_SUPER(sbi);
@@ -782,7 +793,9 @@ out_range:
c.defrag_target);
return -1;
}
+#endif
+#ifdef WITH_RESIZE
static int do_resize(struct f2fs_sb_info *sbi)
{
if (!c.target_sectors)
@@ -796,7 +809,9 @@ static int do_resize(struct f2fs_sb_info *sbi)
return f2fs_resize(sbi);
}
+#endif
+#ifdef WITH_SLOAD
static int do_sload(struct f2fs_sb_info *sbi)
{
if (!c.from_dir) {
@@ -808,6 +823,7 @@ static int do_sload(struct f2fs_sb_info *sbi)
return f2fs_sload(sbi);
}
+#endif
#if defined(__APPLE__)
static u64 get_boottime_ns()
--
2.29.2.576.ga3fc446d84-goog
Powered by blists - more mailing lists