summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-10 02:41:06 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-10 02:41:06 +0200
commit4e67ddd6b39c2847cc399ab0874427baa7ea8935 (patch)
tree075d2522de569fb8a32651ad0728aeb720c8eed1
parentb8131a87ccdd9376882ca0a8dd3cfe45172e4c46 (diff)
units: introduce umount.target for unmounting all file systems
-rw-r--r--Makefile.am1
-rw-r--r--fixme2
-rw-r--r--src/automount.c5
-rw-r--r--src/mount.c4
-rw-r--r--src/special.h1
-rw-r--r--units/umount.target12
6 files changed, 23 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index f6ae7d62c7..57b8aa525c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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 cd5a23f98d..3b3d0f7c86 100644
--- 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
diff --git a/src/automount.c b/src/automount.c
index 39eb3dd01a..b5003b3a75 100644
--- a/src/automount.c
+++ b/src/automount.c
@@ -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);
diff --git a/src/mount.c b/src/mount.c
index 498732eef1..57c258f9f2 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -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);
diff --git a/src/special.h b/src/special.h
index 9ddabde3a4..5ecdd3ccfa 100644
--- a/src/special.h
+++ b/src/special.h
@@ -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
index 0000000000..a5f31e04cb
--- /dev/null
+++ b/units/umount.target
@@ -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