summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-02 23:30:19 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-02 23:32:34 +0100
commite821075a23fdfa3ca7738fc30bb2d4c430fe10c0 (patch)
tree37f970d8139c7796dda5ef0a295ee121ceabf349 /src/shared
parentf9638db8de2f915a5c5f6e4b7292494168eb4141 (diff)
bus: add .busname unit type to implement kdbus-style bus activation
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/special.h1
-rw-r--r--src/shared/unit-name.c12
-rw-r--r--src/shared/unit-name.h5
3 files changed, 9 insertions, 9 deletions
diff --git a/src/shared/special.h b/src/shared/special.h
index 6d252e7baa..2fe5db5558 100644
--- a/src/shared/special.h
+++ b/src/shared/special.h
@@ -46,6 +46,7 @@
/* Early boot targets */
#define SPECIAL_SYSINIT_TARGET "sysinit.target"
#define SPECIAL_SOCKETS_TARGET "sockets.target"
+#define SPECIAL_BUSNAMES_TARGET "busnames.target"
#define SPECIAL_TIMERS_TARGET "timers.target"
#define SPECIAL_PATHS_TARGET "paths.target"
#define SPECIAL_LOCAL_FS_TARGET "local-fs.target"
diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c
index 2335463777..178efefdbf 100644
--- a/src/shared/unit-name.c
+++ b/src/shared/unit-name.c
@@ -36,13 +36,14 @@
static const char* const unit_type_table[_UNIT_TYPE_MAX] = {
[UNIT_SERVICE] = "service",
[UNIT_SOCKET] = "socket",
+ [UNIT_BUSNAME] = "busname",
[UNIT_TARGET] = "target",
+ [UNIT_SNAPSHOT] = "snapshot",
[UNIT_DEVICE] = "device",
[UNIT_MOUNT] = "mount",
[UNIT_AUTOMOUNT] = "automount",
- [UNIT_SNAPSHOT] = "snapshot",
- [UNIT_TIMER] = "timer",
[UNIT_SWAP] = "swap",
+ [UNIT_TIMER] = "timer",
[UNIT_PATH] = "path",
[UNIT_SLICE] = "slice",
[UNIT_SCOPE] = "scope"
@@ -441,7 +442,7 @@ char *unit_name_from_path_instance(const char *prefix, const char *path, const c
}
char *unit_name_to_path(const char *name) {
- char *w, *e;
+ _cleanup_free_ char *w = NULL;
assert(name);
@@ -449,10 +450,7 @@ char *unit_name_to_path(const char *name) {
if (!w)
return NULL;
- e = unit_name_path_unescape(w);
- free(w);
-
- return e;
+ return unit_name_path_unescape(w);
}
char *unit_dbus_path_from_name(const char *name) {
diff --git a/src/shared/unit-name.h b/src/shared/unit-name.h
index 20138df089..57719d5448 100644
--- a/src/shared/unit-name.h
+++ b/src/shared/unit-name.h
@@ -33,13 +33,14 @@ typedef enum UnitLoadState UnitLoadState;
enum UnitType {
UNIT_SERVICE = 0,
UNIT_SOCKET,
+ UNIT_BUSNAME,
UNIT_TARGET,
+ UNIT_SNAPSHOT,
UNIT_DEVICE,
UNIT_MOUNT,
UNIT_AUTOMOUNT,
- UNIT_SNAPSHOT,
- UNIT_TIMER,
UNIT_SWAP,
+ UNIT_TIMER,
UNIT_PATH,
UNIT_SLICE,
UNIT_SCOPE,