chiark / gitweb /
sd-bus: rename sd_bus_get_owner_uid(), sd_bus_get_owner_machine_id() and sd_bus_get_p...
authorDaniel Mack <daniel@zonque.org>
Wed, 22 Oct 2014 17:17:24 +0000 (19:17 +0200)
committerDaniel Mack <daniel@zonque.org>
Wed, 22 Oct 2014 17:45:07 +0000 (19:45 +0200)
Clean up the function namespace by renaming the following:

  sd_bus_get_owner_uid()        → sd_bus_get_name_creds_uid()
  sd_bus_get_owner_machine_id() → sd_bus_get_name_machine_id()
  sd_bus_get_peer_creds()       → sd_bus_get_owner_creds()

man/sd_bus_creds_get_pid.xml
src/bus-proxyd/bus-proxyd.c
src/core/service.c
src/libsystemd/libsystemd.sym.m4
src/libsystemd/sd-bus/bus-control.c
src/libsystemd/sd-bus/bus-convenience.c
src/libsystemd/sd-bus/bus-track.c
src/libsystemd/sd-bus/busctl.c
src/libsystemd/sd-bus/sd-bus.c
src/systemd/sd-bus.h

index cc8603c..23763bd 100644 (file)
@@ -237,7 +237,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
     <citerefentry><refentrytitle>sd_bus_creds_new_from_pid</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
     in which case it will describe the specified process, or it may be
     created by
-    <citerefentry><refentrytitle>sd_bus_get_peer_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+    <citerefentry><refentrytitle>sd_bus_get_owner_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
     in which case it will describe the process at the other endpoint
     of a connection.
     </para>
@@ -410,7 +410,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
         <function>sd_bus_get_user_unit()</function>,
         <function>sd_bus_get_slice()</function>,
         <function>sd_bus_get_session()</function>, and
-        <function>sd_bus_get_owner_uid()</function> if the sender is not
+        <function>sd_bus_get_name_creds_uid()</function> if the sender is not
         part of a systemd system unit, systemd user unit, systemd
         slice, logind session, or a systemd user session.</para>
         </listitem>
index a9f64da..11d0e28 100644 (file)
@@ -186,7 +186,7 @@ static int rename_service(sd_bus *a, sd_bus *b) {
         assert(a);
         assert(b);
 
-        r = sd_bus_get_peer_creds(b, SD_BUS_CREDS_UID|SD_BUS_CREDS_PID|SD_BUS_CREDS_CMDLINE|SD_BUS_CREDS_COMM, &creds);
+        r = sd_bus_get_owner_creds(b, SD_BUS_CREDS_UID|SD_BUS_CREDS_PID|SD_BUS_CREDS_CMDLINE|SD_BUS_CREDS_COMM, &creds);
         if (r < 0)
                 return r;
 
@@ -454,7 +454,7 @@ static int get_creds_by_name(sd_bus *bus, const char *name, uint64_t mask, sd_bu
 
         assert_return(service_name_is_valid(name), -EINVAL);
 
-        r = sd_bus_get_owner(bus, name, mask, &c);
+        r = sd_bus_get_name_creds(bus, name, mask, &c);
         if (r == -ESRCH || r == -ENXIO)
                 return sd_bus_error_setf(error, SD_BUS_ERROR_NAME_HAS_NO_OWNER, "Name %s is currently not owned by anyone.", name);
         if (r < 0)
@@ -747,7 +747,7 @@ static int process_driver(sd_bus *a, sd_bus *b, sd_bus_message *m) {
                 if (!service_name_is_valid(arg0))
                         return synthetic_reply_method_errno(m, -EINVAL, NULL);
 
-                r = sd_bus_get_owner(a, arg0, 0, NULL);
+                r = sd_bus_get_name_creds(a, arg0, 0, NULL);
                 if (r == -ESRCH || r == -ENXIO) {
                         sd_bus_error_setf(&error, SD_BUS_ERROR_NAME_HAS_NO_OWNER, "Could not get owners of name '%s': no such name.", arg0);
                         return synthetic_reply_method_errno(m, r, &error);
@@ -811,7 +811,7 @@ static int process_driver(sd_bus *a, sd_bus *b, sd_bus_message *m) {
                 if (streq(name, "org.freedesktop.DBus"))
                         return synthetic_reply_method_return(m, "b", true);
 
-                r = sd_bus_get_owner(a, name, 0, NULL);
+                r = sd_bus_get_name_creds(a, name, 0, NULL);
                 if (r < 0 && r != -ESRCH && r != -ENXIO)
                         return synthetic_reply_method_errno(m, r, NULL);
 
@@ -895,7 +895,7 @@ static int process_driver(sd_bus *a, sd_bus *b, sd_bus_message *m) {
                 if (flags != 0)
                         return synthetic_reply_method_errno(m, -EINVAL, NULL);
 
-                r = sd_bus_get_owner(a, name, 0, NULL);
+                r = sd_bus_get_name_creds(a, name, 0, NULL);
                 if (r >= 0 || streq(name, "org.freedesktop.DBus"))
                         return synthetic_reply_method_return(m, "u", BUS_START_REPLY_ALREADY_RUNNING);
                 if (r != -ESRCH)
index 7676344..d160c4e 100644 (file)
@@ -2729,7 +2729,7 @@ static void service_bus_name_owner_change(
 
                 /* Try to acquire PID from bus service */
 
-                r = sd_bus_get_owner(u->manager->api_bus, name, SD_BUS_CREDS_PID, &creds);
+                r = sd_bus_get_name_creds(u->manager->api_bus, name, SD_BUS_CREDS_PID, &creds);
                 if (r >= 0)
                         r = sd_bus_creds_get_pid(creds, &pid);
                 if (r >= 0) {
index 87da7ac..ab11448 100644 (file)
@@ -191,7 +191,7 @@ global:
         sd_bus_is_open;
         sd_bus_can_send;
         sd_bus_get_server_id;
-        sd_bus_get_peer_creds;
+        sd_bus_get_owner_creds;
         sd_bus_get_name;
         sd_bus_send;
         sd_bus_send_to;
@@ -287,8 +287,8 @@ global:
         sd_bus_request_name;
         sd_bus_release_name;
         sd_bus_list_names;
-        sd_bus_get_owner;
-        sd_bus_get_owner_machine_id;
+        sd_bus_get_name_creds;
+        sd_bus_get_name_machine_id;
         sd_bus_call_method;
         sd_bus_get_property;
         sd_bus_get_property_trivial;
index b666067..96f59f9 100644 (file)
@@ -549,7 +549,7 @@ static int bus_populate_creds_from_items(sd_bus *bus,
         return 0;
 }
 
-static int bus_get_owner_kdbus(
+static int bus_get_name_creds_kdbus(
                 sd_bus *bus,
                 const char *name,
                 uint64_t mask,
@@ -627,7 +627,7 @@ fail:
         return r;
 }
 
-static int bus_get_owner_dbus1(
+static int bus_get_name_creds_dbus1(
                 sd_bus *bus,
                 const char *name,
                 uint64_t mask,
@@ -773,7 +773,7 @@ static int bus_get_owner_dbus1(
         return 0;
 }
 
-_public_ int sd_bus_get_owner(
+_public_ int sd_bus_get_name_creds(
                 sd_bus *bus,
                 const char *name,
                 uint64_t mask,
@@ -791,9 +791,9 @@ _public_ int sd_bus_get_owner(
                 return -ENOTCONN;
 
         if (bus->is_kernel)
-                return bus_get_owner_kdbus(bus, name, mask, creds);
+                return bus_get_name_creds_kdbus(bus, name, mask, creds);
         else
-                return bus_get_owner_dbus1(bus, name, mask, creds);
+                return bus_get_name_creds_dbus1(bus, name, mask, creds);
 }
 
 static int add_name_change_match(sd_bus *bus,
@@ -1245,7 +1245,7 @@ int bus_remove_match_internal(
                 return bus_remove_match_internal_dbus1(bus, match);
 }
 
-_public_ int sd_bus_get_owner_machine_id(sd_bus *bus, const char *name, sd_id128_t *machine) {
+_public_ int sd_bus_get_name_machine_id(sd_bus *bus, const char *name, sd_id128_t *machine) {
         _cleanup_bus_message_unref_ sd_bus_message *reply = NULL, *m = NULL;
         const char *mid;
         int r;
index f88836b..8081a2f 100644 (file)
@@ -465,9 +465,9 @@ _public_ int sd_bus_query_sender_creds(sd_bus_message *call, uint64_t mask, sd_b
                  * to get it from the sender or peer */
 
                 if (call->sender)
-                        return sd_bus_get_owner(call->bus, call->sender, mask, creds);
+                        return sd_bus_get_name_creds(call->bus, call->sender, mask, creds);
                 else
-                        return sd_bus_get_peer_creds(call->bus, mask, creds);
+                        return sd_bus_get_owner_creds(call->bus, mask, creds);
         }
 
         return bus_creds_extend_by_pid(c, mask, creds);
index 4b6a8bf..f3b593d 100644 (file)
@@ -188,7 +188,7 @@ _public_ int sd_bus_track_add_name(sd_bus_track *track, const char *name) {
 
         /* Second, check if it is currently existing, or maybe
          * doesn't, or maybe disappeared already. */
-        r = sd_bus_get_owner(track->bus, n, 0, NULL);
+        r = sd_bus_get_name_creds(track->bus, n, 0, NULL);
         if (r < 0) {
                 hashmap_remove(track->names, n);
                 return r;
index f06b745..fdc275c 100644 (file)
@@ -142,7 +142,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
 
                 printf("%-*s", (int) max_i, *i);
 
-                r = sd_bus_get_owner(bus, *i,
+                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);
@@ -210,7 +210,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
                         printf("          - -               -                -             -                         -          -                  ");
 
                 if (arg_show_machine) {
-                        r = sd_bus_get_owner_machine_id(bus, *i, &mid);
+                        r = sd_bus_get_name_machine_id(bus, *i, &mid);
                         if (r >= 0) {
                                 char m[SD_ID128_STRING_MAX];
                                 printf(" %s\n", sd_id128_to_string(mid, m));
@@ -306,7 +306,7 @@ static int status(sd_bus *bus, char *argv[]) {
 
         r = parse_pid(argv[1], &pid);
         if (r < 0)
-                r = sd_bus_get_owner(bus, argv[1], _SD_BUS_CREDS_ALL, &creds);
+                r = sd_bus_get_name_creds(bus, argv[1], _SD_BUS_CREDS_ALL, &creds);
         else
                 r = sd_bus_creds_new_from_pid(&creds, pid, _SD_BUS_CREDS_ALL);
 
index 549f9e0..9ec1565 100644 (file)
@@ -3300,7 +3300,7 @@ _public_ int sd_bus_path_decode(const char *path, const char *prefix, char **ext
         return 1;
 }
 
-_public_ int sd_bus_get_peer_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **ret) {
+_public_ int sd_bus_get_owner_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **ret) {
         sd_bus_creds *c;
         pid_t pid = 0;
         int r;
index 9d13e94..18acfc2 100644 (file)
@@ -131,7 +131,7 @@ sd_bus *sd_bus_unref(sd_bus *bus);
 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_peer_creds(sd_bus *bus, uint64_t creds_mask, sd_bus_creds **ret);
+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_tid(sd_bus *bus, pid_t *tid);
 
@@ -260,8 +260,8 @@ int sd_bus_get_unique_name(sd_bus *bus, const char **unique);
 int sd_bus_request_name(sd_bus *bus, const char *name, uint64_t flags);
 int sd_bus_release_name(sd_bus *bus, const char *name);
 int sd_bus_list_names(sd_bus *bus, char ***acquired, char ***activatable); /* free the results */
-int sd_bus_get_owner(sd_bus *bus, const char *name, uint64_t mask, sd_bus_creds **creds); /* unref the result! */
-int sd_bus_get_owner_machine_id(sd_bus *bus, const char *name, sd_id128_t *machine);
+int sd_bus_get_name_creds(sd_bus *bus, const char *name, uint64_t mask, sd_bus_creds **creds); /* unref the result! */
+int sd_bus_get_name_machine_id(sd_bus *bus, const char *name, sd_id128_t *machine);
 
 /* Convenience calls */