summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-06-16 01:02:27 +0200
committerLennart Poettering <lennart@poettering.net>2014-06-16 01:02:27 +0200
commit2dbd4a9454f127f600e5764b7883a472eeb32be0 (patch)
tree3af334a02a790f15e2be2b1b86ec9132fb82f136
parent8eb5a6e001afd3da22fe4c16fe786a362d46733e (diff)
mount: add new SloppyOptions= setting for mount units, mapping to mount(8)'s "-s" switch
-rw-r--r--man/systemd.mount.xml15
-rw-r--r--src/core/dbus-mount.c1
-rw-r--r--src/core/load-fragment-gperf.gperf.m41
-rw-r--r--src/core/mount.c4
-rw-r--r--src/core/mount.h2
5 files changed, 21 insertions, 2 deletions
diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml
index 657cf11be3..2fbad37283 100644
--- a/man/systemd.mount.xml
+++ b/man/systemd.mount.xml
@@ -251,6 +251,21 @@
</varlistentry>
<varlistentry>
+ <term><varname>SloppyOptions=</varname></term>
+
+ <listitem><para>Takes a boolean
+ argument. If true parsing of the
+ options specified in
+ <varname>Options=</varname> is
+ relaxed, and unknown mount options are
+ tolerated. This corresponds with
+ <citerefentry><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>'s
+ <parameter>-s</parameter>
+ switch. Defaults to
+ off.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><varname>DirectoryMode=</varname></term>
<listitem><para>Directories of mount
points (and any parent directories)
diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c
index e27019d71a..53fe4edc34 100644
--- a/src/core/dbus-mount.c
+++ b/src/core/dbus-mount.c
@@ -117,6 +117,7 @@ const sd_bus_vtable bus_mount_vtable[] = {
SD_BUS_PROPERTY("TimeoutUSec", "t", bus_property_get_usec, offsetof(Mount, timeout_usec), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("ControlPID", "u", bus_property_get_pid, offsetof(Mount, control_pid), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("DirectoryMode", "u", bus_property_get_mode, offsetof(Mount, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST),
+ SD_BUS_PROPERTY("SloppyOptions", "b", bus_property_get_bool, offsetof(Mount, sloppy_options), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Mount, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
BUS_EXEC_COMMAND_VTABLE("ExecMount", offsetof(Mount, exec_command[MOUNT_EXEC_MOUNT]), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION),
BUS_EXEC_COMMAND_VTABLE("ExecUnmount", offsetof(Mount, exec_command[MOUNT_EXEC_UNMOUNT]), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION),
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
index d97c5c6f5b..3471ccbe0a 100644
--- a/src/core/load-fragment-gperf.gperf.m4
+++ b/src/core/load-fragment-gperf.gperf.m4
@@ -274,6 +274,7 @@ Mount.Options, config_parse_string, 0,
Mount.Type, config_parse_string, 0, offsetof(Mount, parameters_fragment.fstype)
Mount.TimeoutSec, config_parse_sec, 0, offsetof(Mount, timeout_usec)
Mount.DirectoryMode, config_parse_mode, 0, offsetof(Mount, directory_mode)
+Mount.SloppyOptions, config_parse_bool, 0, offsetof(Mount, sloppy_options)
EXEC_CONTEXT_CONFIG_ITEMS(Mount)m4_dnl
CGROUP_CONTEXT_CONFIG_ITEMS(Mount)m4_dnl
KILL_CONTEXT_CONFIG_ITEMS(Mount)m4_dnl
diff --git a/src/core/mount.c b/src/core/mount.c
index ca21ec7d0e..aea2ab17c9 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -935,7 +935,7 @@ static void mount_enter_mounting(Mount *m) {
r = exec_command_set(
m->control_command,
"/bin/mount",
- "-n",
+ m->sloppy_options ? "-ns" : "-n",
m->parameters_fragment.what,
m->where,
"-t", m->parameters_fragment.fstype ? m->parameters_fragment.fstype : "auto",
@@ -983,7 +983,7 @@ static void mount_enter_remounting(Mount *m) {
r = exec_command_set(
m->control_command,
"/bin/mount",
- "-n",
+ m->sloppy_options ? "-ns" : "-n",
m->parameters_fragment.what,
m->where,
"-t", m->parameters_fragment.fstype ? m->parameters_fragment.fstype : "auto",
diff --git a/src/core/mount.h b/src/core/mount.h
index a53423cc27..2dcb663cb1 100644
--- a/src/core/mount.h
+++ b/src/core/mount.h
@@ -88,6 +88,8 @@ struct Mount {
bool just_mounted:1;
bool just_changed:1;
+ bool sloppy_options;
+
MountResult result;
MountResult reload_result;