fsck.c revision c343be283b7152554bac0c02493a4e1759c163f7
b5da077ddf01546c4a85688624d6957766d6c00cMichal Schmidt/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
b5da077ddf01546c4a85688624d6957766d6c00cMichal Schmidt This file is part of systemd.
along with systemd; If not, see <http://www.gnu.org/licenses/>.
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include "sd-bus.h"
#include "libudev.h"
#include "util.h"
#include "special.h"
#include "bus-util.h"
#include "bus-error.h"
#include "bus-errors.h"
#include "fileio.h"
#include "udev-util.h"
#include "path-util.h"
static bool arg_skip = false;
static bool arg_force = false;
static bool arg_show_progress = false;
/* Start these units only if we can replace base.target with it */
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
&error,
NULL,
arg_force = true;
arg_skip = true;
#ifdef HAVE_SYSV_COMPAT
arg_skip = true;
arg_force = true;
static void test_files(void) {
#ifdef HAVE_SYSV_COMPAT
log_error("Please pass 'fsck.mode=skip' on the kernel command line rather than creating /fastboot on the root file system.");
arg_skip = true;
log_error("Please pass 'fsck.mode=force' on the kernel command line rather than creating /forcefsck on the root file system.");
arg_force = true;
arg_show_progress = true;
static const int pass_table[] = {
if (pass <= 0)
bool locked = false;
int clear = 0;
return -errno;
if (!console)
return -ENOMEM;
while (!feof(f)) {
int pass, m;
usec_t t;
if (!locked) {
locked = true;
last = t;
if (m > clear)
clear = m;
if (clear > 0) {
for (j = 0; j < (unsigned) clear; j++)
int i = 0, r = EXIT_FAILURE, q;
bool root_directory;
return EXIT_FAILURE;
log_open();
test_files();
if (!udev) {
log_oom();
return EXIT_FAILURE;
root_directory = false;
return EXIT_FAILURE;
if (!udev_device) {
return EXIT_FAILURE;
return EXIT_FAILURE;
return EXIT_SUCCESS;
return EXIT_SUCCESS;
if (!udev_device) {
return EXIT_FAILURE;
if (!device) {
return EXIT_FAILURE;
root_directory = true;
if (type) {
if (r == -ENOENT) {
return EXIT_SUCCESS;
if (arg_show_progress)
return EXIT_FAILURE;
if (!root_directory)
if (arg_force)
if (pid < 0) {
goto finish;
} else if (pid == 0) {
if (progress_pipe[0] >= 0)
if (progress_pipe[0] >= 0) {
goto finish;
r = EXIT_SUCCESS;
r = EXIT_SUCCESS;