chiark / gitweb /
sd-bus: rename "connection name" to "description" for the sd-bus API too
authorLennart Poettering <lennart@poettering.net>
Tue, 4 Nov 2014 15:13:49 +0000 (16:13 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 4 Nov 2014 15:13:49 +0000 (16:13 +0100)
kdbus recently renamed this concept, and so should we in what we expose
in userspace.

12 files changed:
src/bus-proxyd/bus-proxyd.c
src/libsystemd/libsystemd.sym.m4
src/libsystemd/sd-bus/bus-control.c
src/libsystemd/sd-bus/bus-creds.c
src/libsystemd/sd-bus/bus-creds.h
src/libsystemd/sd-bus/bus-dump.c
src/libsystemd/sd-bus/bus-internal.h
src/libsystemd/sd-bus/bus-kernel.c
src/libsystemd/sd-bus/busctl.c
src/libsystemd/sd-bus/sd-bus.c
src/libsystemd/sd-bus/test-bus-kernel.c
src/systemd/sd-bus.h

index 8cab102..d10de2f 100644 (file)
@@ -1192,7 +1192,7 @@ int main(int argc, char *argv[]) {
                 goto finish;
         }
 
-        r = sd_bus_set_name(a, "sd-proxy");
+        r = sd_bus_set_description(a, "sd-proxy");
         if (r < 0) {
                 log_error("Failed to set bus name: %s", strerror(-r));
                 goto finish;
index ab11448..c32d8d9 100644 (file)
@@ -179,7 +179,7 @@ global:
         sd_bus_set_anonymous;
         sd_bus_set_trusted;
         sd_bus_set_monitor;
-        sd_bus_set_name;
+        sd_bus_set_description;
         sd_bus_negotiate_fds;
         sd_bus_negotiate_timestamp;
         sd_bus_negotiate_creds;
@@ -192,7 +192,7 @@ global:
         sd_bus_can_send;
         sd_bus_get_server_id;
         sd_bus_get_owner_creds;
-        sd_bus_get_name;
+        sd_bus_get_description;
         sd_bus_send;
         sd_bus_send_to;
         sd_bus_call;
@@ -336,7 +336,7 @@ global:
         sd_bus_creds_get_audit_login_uid;
         sd_bus_creds_get_unique_name;
         sd_bus_creds_get_well_known_names;
-        sd_bus_creds_get_connection_name;
+        sd_bus_creds_get_description;
         sd_bus_error_free;
         sd_bus_error_set;
         sd_bus_error_setf;
index 5f57283..bb33b14 100644 (file)
@@ -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;
                 }
index 26c2545..d27ef1e 100644 (file)
@@ -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;
 }
 
index 81b852a..cf1f611 100644 (file)
@@ -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);
index b536641..b13bc4b 100644 (file)
@@ -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) {
index 57247d7..b1310a8 100644 (file)
@@ -309,7 +309,7 @@ struct sd_bus {
 
         char *cgroup_root;
 
-        char *connection_name;
+        char *description;
 
         size_t bloom_size;
         unsigned bloom_n_hash;
index e01b34e..11039b8 100644 (file)
@@ -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;
index faa0c60..d8122fd 100644 (file)
@@ -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
index 03ec603..318cf6b 100644 (file)
@@ -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;
 }
 
index 7bb8b0a..b138d39 100644 (file)
@@ -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);
 
index 21a6412..e6c9559 100644 (file)
@@ -73,7 +73,7 @@ enum {
         SD_BUS_CREDS_AUDIT_LOGIN_UID  = 1ULL << 21,
         SD_BUS_CREDS_UNIQUE_NAME      = 1ULL << 22,
         SD_BUS_CREDS_WELL_KNOWN_NAMES = 1ULL << 23,
-        SD_BUS_CREDS_CONNECTION_NAME  = 1ULL << 24,
+        SD_BUS_CREDS_DESCRIPTION      = 1ULL << 24,
         _SD_BUS_CREDS_ALL             = (1ULL << 25) -1,
 };
 
@@ -115,7 +115,7 @@ int sd_bus_set_bus_client(sd_bus *bus, int b);
 int sd_bus_set_server(sd_bus *bus, int b, sd_id128_t server_id);
 int sd_bus_set_anonymous(sd_bus *bus, int b);
 int sd_bus_set_trusted(sd_bus *bus, int b);
-int sd_bus_set_name(sd_bus *bus, const char *name);
+int sd_bus_set_description(sd_bus *bus, const char *description);
 int sd_bus_set_monitor(sd_bus *bus, int b);
 int sd_bus_negotiate_fds(sd_bus *bus, int b);
 int sd_bus_negotiate_timestamp(sd_bus *bus, int b);
@@ -132,7 +132,7 @@ int sd_bus_is_open(sd_bus *bus);
 int sd_bus_can_send(sd_bus *bus, char type);
 int sd_bus_get_server_id(sd_bus *bus, sd_id128_t *peer);
 int sd_bus_get_owner_creds(sd_bus *bus, uint64_t creds_mask, sd_bus_creds **ret);
-int sd_bus_get_name(sd_bus *bus, const char **name);
+int sd_bus_get_description(sd_bus *bus, const char **description);
 int sd_bus_get_tid(sd_bus *bus, pid_t *tid);
 
 int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *cookie);
@@ -322,7 +322,7 @@ int sd_bus_creds_get_audit_session_id(sd_bus_creds *c, uint32_t *sessionid);
 int sd_bus_creds_get_audit_login_uid(sd_bus_creds *c, uid_t *loginuid);
 int sd_bus_creds_get_unique_name(sd_bus_creds *c, const char **name);
 int sd_bus_creds_get_well_known_names(sd_bus_creds *c, char ***names);
-int sd_bus_creds_get_connection_name(sd_bus_creds *c, const char **name);
+int sd_bus_creds_get_description(sd_bus_creds *c, const char **name);
 
 /* Error structures */