]> err.no Git - systemd/commitdiff
add new unit_add_dependency_by_name() call
authorLennart Poettering <lennart@poettering.net>
Thu, 28 Jan 2010 05:43:23 +0000 (06:43 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 28 Jan 2010 05:43:23 +0000 (06:43 +0100)
unit.c
unit.h

diff --git a/unit.c b/unit.c
index 40761209202455c2efe3056843f077c84771c83a..a5f4ac76767d1c412db7d166b7d62a3559d860d3 100644 (file)
--- a/unit.c
+++ b/unit.c
@@ -836,6 +836,19 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other) {
         return 0;
 }
 
+int unit_add_dependency_by_name(Unit *u, UnitDependency d, const char *name) {
+        Unit *other;
+        int r;
+
+        if ((r = manager_load_unit(u->meta.manager, name, &other)) < 0)
+                return r;
+
+        if ((r = unit_add_dependency(u, d, other)) < 0)
+                return r;
+
+        return 0;
+}
+
 const char *unit_path(void) {
         char *e;
 
diff --git a/unit.h b/unit.h
index a90baf022af5541fe82752fccec10727359616c2..a29c50ed97864c1006528939e73eca44486d2dfa 100644 (file)
--- a/unit.h
+++ b/unit.h
@@ -196,6 +196,7 @@ void unit_free(Unit *u);
 
 int unit_add_name(Unit *u, const char *name);
 int unit_add_dependency(Unit *u, UnitDependency d, Unit *other);
+int unit_add_dependency_by_name(Unit *u, UnitDependency d, const char *name);
 
 void unit_add_to_load_queue(Unit *u);