summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-04 16:13:49 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-04 16:13:49 +0100
commit455971c1493fc6dc3125d235cf4ea6102cac626d (patch)
tree4fe3367db4487eebbbffb2516d757fdddf07efba /src/libsystemd/sd-bus
parent635f9f0d95d1cc460f2c59a8fe26ecc358420544 (diff)
sd-bus: rename "connection name" to "description" for the sd-bus API too
kdbus recently renamed this concept, and so should we in what we expose in userspace.
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r--src/libsystemd/sd-bus/bus-control.c8
-rw-r--r--src/libsystemd/sd-bus/bus-creds.c18
-rw-r--r--src/libsystemd/sd-bus/bus-creds.h2
-rw-r--r--src/libsystemd/sd-bus/bus-dump.c6
-rw-r--r--src/libsystemd/sd-bus/bus-internal.h2
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c16
-rw-r--r--src/libsystemd/sd-bus/busctl.c6
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c18
-rw-r--r--src/libsystemd/sd-bus/test-bus-kernel.c6
9 files changed, 41 insertions, 41 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index 5f57283c27..bb33b14ff8 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -535,12 +535,12 @@ static int bus_populate_creds_from_items(sd_bus *bus,
break;
case KDBUS_ITEM_CONN_DESCRIPTION:
- if ((mask & SD_BUS_CREDS_CONNECTION_NAME)) {
- c->conn_name = strdup(item->str);
- if (!c->conn_name)
+ if ((mask & SD_BUS_CREDS_DESCRIPTION)) {
+ c->description = strdup(item->str);
+ if (!c->description)
return -ENOMEM;
- c->mask |= SD_BUS_CREDS_CONNECTION_NAME;
+ c->mask |= SD_BUS_CREDS_DESCRIPTION;
}
break;
}
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c
index 26c25452bb..d27ef1edbf 100644
--- a/src/libsystemd/sd-bus/bus-creds.c
+++ b/src/libsystemd/sd-bus/bus-creds.c
@@ -49,7 +49,7 @@ void bus_creds_done(sd_bus_creds *c) {
free(c->unit);
free(c->user_unit);
free(c->slice);
- free(c->unescaped_conn_name);
+ free(c->unescaped_description);
strv_free(c->cmdline_array);
strv_free(c->well_known_names);
@@ -94,7 +94,7 @@ _public_ sd_bus_creds *sd_bus_creds_unref(sd_bus_creds *c) {
free(c->label);
free(c->unique_name);
free(c->cgroup_root);
- free(c->conn_name);
+ free(c->description);
free(c);
}
} else {
@@ -465,22 +465,22 @@ _public_ int sd_bus_creds_get_well_known_names(sd_bus_creds *c, char ***well_kno
return 0;
}
-_public_ int sd_bus_creds_get_connection_name(sd_bus_creds *c, const char **ret) {
+_public_ int sd_bus_creds_get_description(sd_bus_creds *c, const char **ret) {
assert_return(c, -EINVAL);
assert_return(ret, -EINVAL);
- if (!(c->mask & SD_BUS_CREDS_CONNECTION_NAME))
+ if (!(c->mask & SD_BUS_CREDS_DESCRIPTION))
return -ENODATA;
- assert(c->conn_name);
+ assert(c->description);
- if (!c->unescaped_conn_name) {
- c->unescaped_conn_name = bus_label_unescape(c->conn_name);
- if (!c->unescaped_conn_name)
+ if (!c->unescaped_description) {
+ c->unescaped_description = bus_label_unescape(c->description);
+ if (!c->unescaped_description)
return -ENOMEM;
}
- *ret = c->unescaped_conn_name;
+ *ret = c->unescaped_description;
return 0;
}
diff --git a/src/libsystemd/sd-bus/bus-creds.h b/src/libsystemd/sd-bus/bus-creds.h
index 81b852a596..cf1f611237 100644
--- a/src/libsystemd/sd-bus/bus-creds.h
+++ b/src/libsystemd/sd-bus/bus-creds.h
@@ -65,7 +65,7 @@ struct sd_bus_creds {
char *cgroup_root;
- char *conn_name, *unescaped_conn_name;
+ char *description, *unescaped_description;
};
sd_bus_creds* bus_creds_new(void);
diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c
index b536641eb9..b13bc4b119 100644
--- a/src/libsystemd/sd-bus/bus-dump.c
+++ b/src/libsystemd/sd-bus/bus-dump.c
@@ -348,10 +348,10 @@ int bus_creds_dump(sd_bus_creds *c, FILE *f) {
if (c->mask & SD_BUS_CREDS_SELINUX_CONTEXT)
fprintf(f, " Label=%s", c->label);
- if (c->mask & SD_BUS_CREDS_CONNECTION_NAME)
- fprintf(f, " ConnectionName=%s", c->conn_name);
+ if (c->mask & SD_BUS_CREDS_DESCRIPTION)
+ fprintf(f, " Description=%s", c->description);
- if (c->mask & (SD_BUS_CREDS_SELINUX_CONTEXT|SD_BUS_CREDS_CONNECTION_NAME))
+ if (c->mask & (SD_BUS_CREDS_SELINUX_CONTEXT|SD_BUS_CREDS_DESCRIPTION))
fputs("\n", f);
if (sd_bus_creds_get_cmdline(c, &cmdline) >= 0) {
diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h
index 57247d7df9..b1310a8640 100644
--- a/src/libsystemd/sd-bus/bus-internal.h
+++ b/src/libsystemd/sd-bus/bus-internal.h
@@ -309,7 +309,7 @@ struct sd_bus {
char *cgroup_root;
- char *connection_name;
+ char *description;
size_t bloom_size;
unsigned bloom_n_hash;
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index e01b34e397..11039b8e13 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -598,8 +598,8 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
break;
case KDBUS_ITEM_CONN_DESCRIPTION:
- m->creds.conn_name = d->str;
- m->creds.mask |= SD_BUS_CREDS_CONNECTION_NAME & bus->creds_mask;
+ m->creds.description = d->str;
+ m->creds.mask |= SD_BUS_CREDS_DESCRIPTION & bus->creds_mask;
break;
case KDBUS_ITEM_FDS:
@@ -666,8 +666,8 @@ int bus_kernel_take_fd(sd_bus *b) {
b->use_memfd = 1;
- if (b->connection_name) {
- g = bus_label_escape(b->connection_name);
+ if (b->description) {
+ g = bus_label_escape(b->description);
if (!g)
return -ENOMEM;
@@ -700,8 +700,8 @@ int bus_kernel_take_fd(sd_bus *b) {
name = g;
}
- b->connection_name = bus_label_unescape(name);
- if (!b->connection_name)
+ b->description = bus_label_unescape(name);
+ if (!b->description)
return -ENOMEM;
}
@@ -1123,7 +1123,7 @@ int bus_kernel_pop_memfd(sd_bus *bus, void **address, size_t *mapped, size_t *al
assert_se(pthread_mutex_unlock(&bus->memfd_cache_mutex) >= 0);
- r = memfd_new(bus->connection_name);
+ r = memfd_new(bus->description);
if (r < 0)
return r;
@@ -1255,7 +1255,7 @@ int kdbus_translate_attach_flags(uint64_t mask, uint64_t *kdbus_mask) {
if (mask & SD_BUS_CREDS_WELL_KNOWN_NAMES)
m |= KDBUS_ATTACH_NAMES;
- if (mask & SD_BUS_CREDS_CONNECTION_NAME)
+ if (mask & SD_BUS_CREDS_DESCRIPTION)
m |= KDBUS_ATTACH_CONN_DESCRIPTION;
*kdbus_mask = m;
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index faa0c60917..d8122fdfcf 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -110,7 +110,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
if (arg_legend) {
printf("%-*s %*s %-*s %-*s %-*s %-*s %-*s %-*s",
- (int) max_i, "NAME", 10, "PID", 15, "PROCESS", 16, "USER", 13, "CONNECTION", 25, "UNIT", 10, "SESSION", 19, "CONNECTION-NAME");
+ (int) max_i, "NAME", 10, "PID", 15, "PROCESS", 16, "USER", 13, "CONNECTION", 25, "UNIT", 10, "SESSION", 19, "DESCRIPTION");
if (arg_show_machine)
puts(" MACHINE");
@@ -146,7 +146,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
r = sd_bus_get_name_creds(bus, *i,
SD_BUS_CREDS_UID|SD_BUS_CREDS_PID|SD_BUS_CREDS_COMM|
SD_BUS_CREDS_UNIQUE_NAME|SD_BUS_CREDS_UNIT|SD_BUS_CREDS_SESSION|
- SD_BUS_CREDS_CONNECTION_NAME, &creds);
+ SD_BUS_CREDS_DESCRIPTION, &creds);
if (r >= 0) {
const char *unique, *session, *unit, *cn;
pid_t pid;
@@ -201,7 +201,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
else
fputs(" - ", stdout);
- r = sd_bus_creds_get_connection_name(creds, &cn);
+ r = sd_bus_creds_get_description(creds, &cn);
if (r >= 0)
printf(" %-19s", cn);
else
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 03ec6036fa..318cf6bae5 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -129,7 +129,7 @@ static void bus_free(sd_bus *b) {
free(b->machine);
free(b->fake_label);
free(b->cgroup_root);
- free(b->connection_name);
+ free(b->description);
free(b->exec_path);
strv_free(b->exec_argv);
@@ -323,20 +323,20 @@ _public_ int sd_bus_set_trusted(sd_bus *bus, int b) {
return 0;
}
-_public_ int sd_bus_set_name(sd_bus *bus, const char *name) {
+_public_ int sd_bus_set_description(sd_bus *bus, const char *description) {
char *n;
assert_return(bus, -EINVAL);
- assert_return(name, -EINVAL);
+ assert_return(description, -EINVAL);
assert_return(bus->state == BUS_UNSET, -EPERM);
assert_return(!bus_pid_changed(bus), -ECHILD);
- n = strdup(name);
+ n = strdup(description);
if (!n)
return -ENOMEM;
- free(bus->connection_name);
- bus->connection_name = n;
+ free(bus->description);
+ bus->description = n;
return 0;
}
@@ -3322,12 +3322,12 @@ _public_ int sd_bus_try_close(sd_bus *bus) {
return 0;
}
-_public_ int sd_bus_get_name(sd_bus *bus, const char **name) {
+_public_ int sd_bus_get_description(sd_bus *bus, const char **description) {
assert_return(bus, -EINVAL);
- assert_return(name, -EINVAL);
+ assert_return(description, -EINVAL);
assert_return(!bus_pid_changed(bus), -ECHILD);
- *name = bus->connection_name;
+ *description = bus->description;
return 0;
}
diff --git a/src/libsystemd/sd-bus/test-bus-kernel.c b/src/libsystemd/sd-bus/test-bus-kernel.c
index 7bb8b0a540..b138d390d9 100644
--- a/src/libsystemd/sd-bus/test-bus-kernel.c
+++ b/src/libsystemd/sd-bus/test-bus-kernel.c
@@ -60,7 +60,7 @@ int main(int argc, char *argv[]) {
r = sd_bus_new(&b);
assert_se(r >= 0);
- r = sd_bus_set_name(a, "a");
+ r = sd_bus_set_description(a, "a");
assert_se(r >= 0);
r = sd_bus_set_address(a, address);
@@ -85,7 +85,7 @@ int main(int argc, char *argv[]) {
assert_se(r >= 0);
printf("unique a: %s\n", ua);
- r = sd_bus_get_name(a, &nn);
+ r = sd_bus_get_description(a, &nn);
assert_se(r >= 0);
printf("name of a: %s\n", nn);
@@ -93,7 +93,7 @@ int main(int argc, char *argv[]) {
assert_se(r >= 0);
printf("unique b: %s\n", ub);
- r = sd_bus_get_name(b, &nn);
+ r = sd_bus_get_description(b, &nn);
assert_se(r >= 0);
printf("name of b: %s\n", nn);