chiark / gitweb /
hwclock: add taint flag for non-local hwclock
[elogind.git] / src / core / mount.c
index 7dbeaf9cf0b8bf45d290397432b9ddeadef7d58b..5f50d9557a0442ef2fb6671fc289eba41e471e73 100644 (file)
@@ -6,16 +6,16 @@
   Copyright 2010 Lennart Poettering
 
   systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
   (at your option) any later version.
 
   systemd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  General Public License for more details.
+  Lesser General Public License for more details.
 
-  You should have received a copy of the GNU General Public License
+  You should have received a copy of the GNU Lesser General Public License
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
@@ -263,6 +263,21 @@ static int mount_add_socket_links(Mount *m) {
         return 0;
 }
 
+static int mount_add_requires_mounts_links(Mount *m) {
+        Unit *other;
+        int r;
+
+        assert(m);
+
+        LIST_FOREACH(has_requires_mounts_for, other, UNIT(m)->manager->has_requires_mounts_for) {
+                r = unit_add_one_mount_link(other, m);
+                if (r < 0)
+                        return r;
+        }
+
+        return 0;
+}
+
 static char* mount_test_option(const char *haystack, const char *needle) {
         struct mntent me;
 
@@ -325,7 +340,7 @@ static int mount_add_fstab_links(Mount *m) {
         MountParameters *p;
         Unit *tu;
         int r;
-        bool noauto, nofail, handle, automount;
+        bool noauto, nofail, automount;
 
         assert(m);
 
@@ -343,11 +358,6 @@ static int mount_add_fstab_links(Mount *m) {
         automount =
                 mount_test_option(p->options, "comment=systemd.automount") ||
                 mount_test_option(p->options, "x-systemd-automount");
-        handle =
-                automount ||
-                mount_test_option(p->options, "comment=systemd.mount") ||
-                mount_test_option(p->options, "x-systemd-mount") ||
-                UNIT(m)->manager->mount_auto;
 
         if (mount_is_network(p)) {
                 target = SPECIAL_REMOTE_FS_TARGET;
@@ -391,7 +401,7 @@ static int mount_add_fstab_links(Mount *m) {
                 else /* automount + nofail */
                         return unit_add_two_dependencies(tu, UNIT_AFTER, UNIT_WANTS, am, true);
 
-        } else if (handle && !noauto) {
+        } else if (!noauto) {
 
                 /* Automatically add mount points that aren't natively
                  * configured to local-fs.target */
@@ -619,6 +629,10 @@ static int mount_load(Unit *u) {
                 if ((r = mount_add_path_links(m)) < 0)
                         return r;
 
+                r = mount_add_requires_mounts_links(m);
+                if (r < 0)
+                        return r;
+
                 if ((r = mount_add_automount_links(m)) < 0)
                         return r;
 
@@ -805,6 +819,8 @@ static int mount_spawn(Mount *m, ExecCommand *c, pid_t *_pid) {
                             UNIT(m)->manager->confirm_spawn,
                             UNIT(m)->cgroup_bondings,
                             UNIT(m)->cgroup_attributes,
+                            NULL,
+                            NULL,
                             &pid)) < 0)
                 goto fail;
 
@@ -875,7 +891,8 @@ static void mount_enter_signal(Mount *m, MountState state, MountResult f) {
                                 if ((r = set_put(pid_set, LONG_TO_PTR(m->control_pid))) < 0)
                                         goto fail;
 
-                        if ((r = cgroup_bonding_kill_list(UNIT(m)->cgroup_bondings, sig, true, pid_set)) < 0) {
+                        r = cgroup_bonding_kill_list(UNIT(m)->cgroup_bondings, sig, true, pid_set, NULL);
+                        if (r < 0) {
                                 if (r != -EAGAIN && r != -ESRCH && r != -ENOENT)
                                         log_warning("Failed to kill control group: %s", strerror(-r));
                         } else if (r > 0)
@@ -1535,8 +1552,9 @@ static int mount_load_etc_fstab(Manager *m) {
         assert(m);
 
         errno = 0;
-        if (!(f = setmntent("/etc/fstab", "r")))
-                return -errno;
+        f = setmntent("/etc/fstab", "r");
+        if (!f)
+                return errno == ENOENT ? 0 : -errno;
 
         while ((me = getmntent(f))) {
                 char *where, *what;
@@ -1571,7 +1589,6 @@ static int mount_load_etc_fstab(Manager *m) {
                                                  pri,
                                                  !!mount_test_option(me->mnt_opts, "noauto"),
                                                  !!mount_test_option(me->mnt_opts, "nofail"),
-                                                 !!mount_test_option(me->mnt_opts, "comment=systemd.swapon"),
                                                  false);
                 } else
                         k = mount_add_one(m, what, where, me->mnt_opts, me->mnt_type, me->mnt_passno, false, false);
@@ -1833,7 +1850,8 @@ static int mount_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError
                                 goto finish;
                         }
 
-                if ((q = cgroup_bonding_kill_list(UNIT(m)->cgroup_bondings, signo, false, pid_set)) < 0)
+                q = cgroup_bonding_kill_list(UNIT(m)->cgroup_bondings, signo, false, pid_set, NULL);
+                if (q < 0)
                         if (q != -EAGAIN && q != -ESRCH && q != -ENOENT)
                                 r = q;
         }