mirror of
https://github.com/troglobit/finit.git
synced 2026-10-19 11:09:35 +00:00
Fix #366: document fsck.* command line options and simplify code
As pointed out in #366, the configure options --enable-fastboot and --enable-fsckfix should just alter the default values of the two fsck command line options. This commit simplifies the code and makes it possible to override using the command line regardless of the two build options. Finally, add the two command line options to doc/cmdline.md Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
8904ca993e
commit
846806747b
3 files changed
+27
-6
No files matched your search
+17
@@ -62,8 +62,25 @@ static TAILQ_HEAD(, env_entry) env_list = TAILQ_HEAD_INITIALIZER(env_list);
|
||||
struct rlimit initial_rlimit[RLIMIT_NLIMITS];
|
||||
struct rlimit global_rlimit[RLIMIT_NLIMITS];
|
||||
|
||||
/*
|
||||
* --enable-fastboot => fsck_mode: NULL => no fsck by default
|
||||
* --enable-fsckfix => fsck_mode: "-f" + fsck_repair: "y"
|
||||
*/
|
||||
#ifdef FSCK_FIX
|
||||
# ifdef FAST_BOOT
|
||||
char *fsck_mode = NULL;
|
||||
# else
|
||||
char *fsck_mode = "-f";
|
||||
# endif
|
||||
char *fsck_repair = "-y";
|
||||
#else
|
||||
# ifdef FAST_BOOT
|
||||
char *fsck_mode = NULL;
|
||||
# else
|
||||
char *fsck_mode = "";
|
||||
# endif
|
||||
char *fsck_repair = "-p";
|
||||
#endif
|
||||
|
||||
char cgroup_current[16]; /* cgroup.NAME sets current cgroup for a set of services */
|
||||
|
||||
|
||||
+1
-6
@@ -255,11 +255,7 @@ static int fsck(int pass)
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef FSCK_FIX
|
||||
snprintf(cmd, sizeof(cmd), "fsck -yf %s", dev);
|
||||
#else
|
||||
snprintf(cmd, sizeof(cmd), "fsck %s %s %s", fsck_mode, fsck_repair, dev);
|
||||
#endif
|
||||
dbg("Running pass %d fsck command %s", pass, cmd);
|
||||
fsck_rc = run_interactive(cmd, "Checking filesystem %s", dev);
|
||||
/*
|
||||
@@ -282,7 +278,6 @@ static int fsck(int pass)
|
||||
static int fsck_all(void)
|
||||
{
|
||||
int rc = 0;
|
||||
#ifndef FAST_BOOT
|
||||
int pass;
|
||||
|
||||
if (!fsck_mode)
|
||||
@@ -293,7 +288,7 @@ static int fsck_all(void)
|
||||
if (rc)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user