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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user