diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-10-20 14:22:23 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-10-20 14:22:23 +0200 |
commit | 2ba545f1a098fc5621d4d1f1049af2f40793819a (patch) | |
tree | af5f8d43e0b9b68815fe89ecbc4e716942bf67fe | |
parent | dcdf86bbb07de0022d48e1c3d3941cc7ac12d138 (diff) |
service: implement FsckPassNo= option
-rw-r--r-- | man/systemd.service.xml | 27 | ||||
-rw-r--r-- | src/load-fragment.c | 27 | ||||
-rw-r--r-- | units/fsck-root.service.in | 1 |
3 files changed, 55 insertions, 0 deletions
diff --git a/man/systemd.service.xml b/man/systemd.service.xml index 4473c3d945..2db146b719 100644 --- a/man/systemd.service.xml +++ b/man/systemd.service.xml @@ -638,6 +638,33 @@ refers to.</para></listitem> </varlistentry> + <varlistentry> + <term><varname>FsckPassNo=</varname></term> + <listitem><para>Set the fsck passno + priority to use to order this service + in relation to other file system + checking services. This option is only + necessary to fix ordering in relation + to fsck jobs automatically created for + all <filename>/etc/fstab</filename> + entries with a value in the fs_passno + column > 0. As such it should only be + used as option for fsck + services. Almost always it is a better + choice to add explicit ordering + directives via + <varname>After=</varname> or + <varname>Before=</varname>, + instead. For more details see + <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If + used, pass an integer value in the + same range as + <filename>/etc/fstab</filename>'s + fs_passno column. See + <citerefentry><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry> + for details.</para></listitem> + </varlistentry> + </variablelist> </refsect1> diff --git a/src/load-fragment.c b/src/load-fragment.c index 2b5c8e70dd..0502fc45d9 100644 --- a/src/load-fragment.c +++ b/src/load-fragment.c @@ -1002,6 +1002,32 @@ static int config_parse_sysv_priority( } #endif +static int config_parse_fsck_passno( + const char *filename, + unsigned line, + const char *section, + const char *lvalue, + const char *rvalue, + void *data, + void *userdata) { + + int *passno = data; + int r, i; + + assert(filename); + assert(lvalue); + assert(rvalue); + assert(data); + + if ((r = safe_atoi(rvalue, &i)) < 0 || i < 0) { + log_error("[%s:%u] Failed to parse fsck pass number, ignoring: %s", filename, line, rvalue); + return 0; + } + + *passno = (int) i; + return 0; +} + static DEFINE_CONFIG_PARSE_ENUM(config_parse_kill_mode, kill_mode, KillMode, "Failed to parse kill mode"); static int config_parse_kill_signal( @@ -1781,6 +1807,7 @@ static int load_from_path(Unit *u, const char *path) { { "BusName", config_parse_string_printf, &u->service.bus_name, "Service" }, { "NotifyAccess", config_parse_notify_access, &u->service.notify_access, "Service" }, { "Sockets", config_parse_service_sockets, &u->service, "Service" }, + { "FsckPassNo", config_parse_fsck_passno, &u->service.fsck_passno, "Service" }, EXEC_CONTEXT_CONFIG_ITEMS(u->service.exec_context, "Service"), { "ListenStream", config_parse_listen, &u->socket, "Socket" }, diff --git a/units/fsck-root.service.in b/units/fsck-root.service.in index 987503a2b8..8ddbda91a6 100644 --- a/units/fsck-root.service.in +++ b/units/fsck-root.service.in @@ -15,3 +15,4 @@ Before=local-fs.target shutdown.target remount-rootfs.service quotacheck.service Type=oneshot RemainAfterExit=no ExecStart=@rootlibexecdir@/systemd-fsck +FsckPassNo=1 |