summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2012-06-13 18:22:08 +0200
committerMichal Schmidt <mschmidt@redhat.com>2012-06-13 18:42:02 +0200
commit48899192a7b28b6a338cc8ec18aa35ccd8867acb (patch)
treea5fa3b09e7339b04c51c107549f65846cecf26cf /src/shared
parent1c291cf34cb22c8ca5ec0db122bd5e8bfabe9ac5 (diff)
unit-name: introduce unit_dbus_path_from_name()
Use the same function in core and in systemctl. get_unit_path() in systemctl becomes unnecessary.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/unit-name.c13
-rw-r--r--src/shared/unit-name.h2
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