unit-name: introduce unit_dbus_path_from_name()

Use the same function in core and in systemctl.
get_unit_path() in systemctl becomes unnecessary.
This commit is contained in:
Michal Schmidt
2012-06-13 18:42:02 +02:00
parent 1c291cf34c
commit 48899192a7
4 changed files with 21 additions and 85 deletions
+13
View File
@@ -458,3 +458,16 @@ char *unit_name_path_unescape(const char *f) {
return e;
}
char *unit_dbus_path_from_name(const char *name) {
char *e, *p;
e = bus_path_escape(name);
if (!e)
return NULL;
p = strappend("/org/freedesktop/systemd1/unit/", e);
free(e);
return p;
}
+2
View File
@@ -54,4 +54,6 @@ char *unit_name_from_path(const char *path, const char *suffix);
char *unit_name_from_path_instance(const char *prefix, const char *path, const char *suffix);
char *unit_name_to_path(const char *name);
char *unit_dbus_path_from_name(const char *name);
#endif