chiark / gitweb /
core: hook up MountFlags= to the transient unit logic
authorLennart Poettering <lennart@poettering.net>
Tue, 22 Nov 2016 19:19:08 +0000 (20:19 +0100)
committerSven Eden <yamakuzure@gmx.net>
Mon, 17 Jul 2017 15:58:35 +0000 (17:58 +0200)
This makes "elogind-run -p MountFlags=shared -t /bin/sh" work, by making
MountFlags= to the list of properties that may be accessed transiently.

src/basic/mount-util.c
src/basic/mount-util.h

index 477342e71f433cb48c4c912d06e01e741ef700e1..61190e40ac15f51a70f8d6fa0b45af28f9492052 100644 (file)
@@ -219,7 +219,7 @@ int path_is_mount_point(const char *t, const char *root, int flags) {
          * /bin -> /usr/bin/ and /usr is a mount point, then the parent that we
          * look at needs to be /usr, not /. */
         if (flags & AT_SYMLINK_FOLLOW) {
          * /bin -> /usr/bin/ and /usr is a mount point, then the parent that we
          * look at needs to be /usr, not /. */
         if (flags & AT_SYMLINK_FOLLOW) {
-                r = chase_symlinks(t, root, &canonical);
+                r = chase_symlinks(t, root, 0, &canonical);
                 if (r < 0)
                         return r;
 
                 if (r < 0)
                         return r;
 
@@ -691,3 +691,35 @@ int umount_verbose(const char *what) {
         return 0;
 }
 #endif // 0
         return 0;
 }
 #endif // 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;
+}
index ea887e162f49dc9b1c09adec480fc76da8da8977..57cfc3628f46687bcbddb19b76c7c14e61fcbf94 100644 (file)
@@ -67,3 +67,6 @@ int mount_verbose(
                 const char *options);
 int umount_verbose(const char *where);
 #endif // 0
                 const char *options);
 int umount_verbose(const char *where);
 #endif // 0
+
+const char *mount_propagation_flags_to_string(unsigned long flags);
+unsigned long mount_propagation_flags_from_string(const char *name);