diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/unit-name.c | 13 | ||||
-rw-r--r-- | src/shared/unit-name.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c index 1440d2f2ea..91f464ee9c 100644 --- a/src/shared/unit-name.c +++ b/src/shared/unit-name.c @@ -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; +} diff --git a/src/shared/unit-name.h b/src/shared/unit-name.h index 4dfb9fa3ce..7aab2e557d 100644 --- a/src/shared/unit-name.h +++ b/src/shared/unit-name.h @@ -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 |