]> err.no Git - systemd/commitdiff
units: introduce umount.target for unmounting all file systems
authorLennart Poettering <lennart@poettering.net>
Sat, 10 Jul 2010 00:41:06 +0000 (02:41 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 10 Jul 2010 00:41:06 +0000 (02:41 +0200)
Makefile.am
fixme
src/automount.c
src/mount.c
src/special.h
units/umount.target [new file with mode: 0644]

index f6ae7d62c7ea3c1cedd6838185f078511b6adb68..57b8aa525c881957cfedf162c901135a039b2b93 100644 (file)
@@ -126,6 +126,7 @@ dist_systemunit_DATA = \
        units/rpcbind.target \
        units/rtc-set.target \
        units/shutdown.target \
+       units/umount.target \
        units/sigpwr.target \
        units/sockets.target \
        units/swap.target \
diff --git a/fixme b/fixme
index cd5a23f98dd18459318ba0df195109139f59905b..3b3d0f7c8657c25981e10a9c7afffb8dfac7fa50 100644 (file)
--- a/fixme
+++ b/fixme
@@ -35,8 +35,6 @@
 
 * selinux
 
-* introduce umount.target
-
 * pull in umount.target and shutdown.target from emergency.service (?)
 
 * Show exit status auf auxiliary programs in systemctl status
index 39eb3dd01aafd677e64624c8f1b8745b0e422acc..b5003b3a756babf4a5f77979dd67662cbbf3ade2 100644 (file)
@@ -36,6 +36,7 @@
 #include "unit-name.h"
 #include "dbus-automount.h"
 #include "bus-errors.h"
+#include "special.h"
 
 static const UnitActiveState state_translation_table[_AUTOMOUNT_STATE_MAX] = {
         [AUTOMOUNT_DEAD] = UNIT_INACTIVE,
@@ -194,6 +195,10 @@ static int automount_load(Unit *u) {
 
                 if ((r = unit_add_dependency(u, UNIT_BEFORE, UNIT(a->mount), true)) < 0)
                         return r;
+
+                if (a->meta.default_dependencies)
+                        if ((r = unit_add_two_dependencies_by_name(UNIT(a), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+                                return r;
         }
 
         return automount_verify(a);
index 498732eef18d5c49b38d23600a21d4627676f79c..57c258f9f255908b86eba0d664f7b68fd2e76407 100644 (file)
@@ -367,6 +367,10 @@ static int mount_load(Unit *u) {
 
                 if ((r = unit_add_default_cgroup(u)) < 0)
                         return r;
+
+                if (m->meta.default_dependencies && !path_equal(m->where, "/"))
+                        if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+                                return r;
         }
 
         return mount_verify(m);
index 9ddabde3a48dcddab8e2acebb0c46ccdb58f9659..5ecdd3ccfa1d21c34f679c7be08da3a24b783b76 100644 (file)
@@ -29,6 +29,7 @@
  * it to bring all services down that want to be brought down on
  * system shutdown. */
 #define SPECIAL_SHUTDOWN_TARGET "shutdown.target"
+#define SPECIAL_UMOUNT_TARGET "umount.target"
 
 #define SPECIAL_LOGGER_SOCKET "systemd-logger.socket"
 
diff --git a/units/umount.target b/units/umount.target
new file mode 100644 (file)
index 0000000..a5f31e0
--- /dev/null
@@ -0,0 +1,12 @@
+#  This file is part of systemd.
+#
+#  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
+#  (at your option) any later version.
+
+# See systemd.special(7) for details
+
+[Unit]
+Description=Unmount All Filesystems
+OnlyByDependency=yes