From: Lennart Poettering Date: Fri, 29 Jan 2010 00:49:34 +0000 (+0100) Subject: add api for choose the id name for a service X-Git-Tag: 0.git+20100605+dfd8ee-1~359 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ae97ec11506cce808232abd0979e20aed2fd625;p=systemd add api for choose the id name for a service --- diff --git a/unit.c b/unit.c index c8a6f669..dbdd7e66 100644 --- a/unit.c +++ b/unit.c @@ -155,6 +155,21 @@ int unit_add_name(Unit *u, const char *text) { return 0; } +int unit_choose_id(Unit *u, const char *name) { + char *s; + + assert(u); + assert(name); + + /* Selects one of the names of this unit as the id */ + + if (!(s = set_get(u->meta.names, (char*) name))) + return -ENOENT; + + u->meta.id = s; + return 0; +} + void unit_add_to_load_queue(Unit *u) { assert(u); diff --git a/unit.h b/unit.h index 7ab2ccdf..8505d275 100644 --- a/unit.h +++ b/unit.h @@ -201,6 +201,8 @@ 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); +int unit_choose_id(Unit *u, const char *name); + void unit_add_to_load_queue(Unit *u); int unit_merge(Unit *u, Unit *other);