From 09b6b09f44b36b52b8a20ba18446e3ec2926c110 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 28 Jan 2010 06:43:23 +0100 Subject: [PATCH] add new unit_add_dependency_by_name() call --- unit.c | 13 +++++++++++++ unit.h | 1 + 2 files changed, 14 insertions(+) diff --git a/unit.c b/unit.c index 40761209..a5f4ac76 100644 --- 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 a90baf02..a29c50ed 100644 --- 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); -- 2.39.5