summaryrefslogtreecommitdiffstats
path: root/src/basic/mount-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-11-22 20:19:08 +0100
committerLennart Poettering <lennart@poettering.net>2016-12-13 21:22:13 +0100
commit835552511ef5edec94b567441251ada2a37ea333 (patch)
tree120f0cd18708151cbdfe34e74792e6d24c3da42e /src/basic/mount-util.c
parentMerge pull request #4877 from evverx/fix-machine-id (diff)
downloadsystemd-835552511ef5edec94b567441251ada2a37ea333.tar.xz
systemd-835552511ef5edec94b567441251ada2a37ea333.zip
core: hook up MountFlags= to the transient unit logic
This makes "systemd-run -p MountFlags=shared -t /bin/sh" work, by making MountFlags= to the list of properties that may be accessed transiently.
Diffstat (limited to 'src/basic/mount-util.c')
-rw-r--r--src/basic/mount-util.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c
index 352c3505fb..8970050408 100644
--- a/src/basic/mount-util.c
+++ b/src/basic/mount-util.c
@@ -689,3 +689,35 @@ int umount_verbose(const char *what) {
return log_error_errno(errno, "Failed to unmount %s: %m", what);
return 0;
}
+
+const char *mount_propagation_flags_to_string(unsigned long flags) {
+
+ switch (flags & (MS_SHARED|MS_SLAVE|MS_PRIVATE)) {
+
+ case MS_SHARED:
+ return "shared";
+
+ case MS_SLAVE:
+ return "slave";
+
+ case MS_PRIVATE:
+ return "private";
+ }
+
+ return NULL;
+}
+
+unsigned long mount_propagation_flags_from_string(const char *name) {
+
+ if (isempty(name))
+ return 0;
+
+ if (streq(name, "shared"))
+ return MS_SHARED;
+ if (streq(name, "slave"))
+ return MS_SLAVE;
+ if (streq(name, "private"))
+ return MS_PRIVATE;
+
+ return 0;
+}