summaryrefslogtreecommitdiff
path: root/src/machine/machine-dbus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-29 18:35:10 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-29 18:36:25 +0200
commit190700621f95160d364f8ec1d3e360246c41ce75 (patch)
tree783c3b43bd6fd93892fada76f5c20112a4e73d7c /src/machine/machine-dbus.c
parentb53c3c2d24ed1398ee427139cd880b07bc35fa24 (diff)
sd-bus: drop bus parameter from message callback prototype
This should simplify the prototype a bit. The bus parameter is redundant in most cases, and in the few where it matters it can be derived from the message via sd_bus_message_get_bus().
Diffstat (limited to 'src/machine/machine-dbus.c')
-rw-r--r--src/machine/machine-dbus.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
index 2d710a9a9b..4e73467b06 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
@@ -121,11 +121,10 @@ static int property_get_netif(
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_class, machine_class, MachineClass);
-int bus_machine_method_terminate(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int bus_machine_method_terminate(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Machine *m = userdata;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -149,14 +148,13 @@ int bus_machine_method_terminate(sd_bus *bus, sd_bus_message *message, void *use
return sd_bus_reply_method_return(message, NULL);
}
-int bus_machine_method_kill(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int bus_machine_method_kill(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Machine *m = userdata;
const char *swho;
int32_t signo;
KillWho who;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -195,7 +193,7 @@ int bus_machine_method_kill(sd_bus *bus, sd_bus_message *message, void *userdata
return sd_bus_reply_method_return(message, NULL);
}
-int bus_machine_method_get_addresses(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int bus_machine_method_get_addresses(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_close_pair_ int pair[2] = { -1, -1 };
_cleanup_free_ char *us = NULL, *them = NULL;
@@ -206,7 +204,6 @@ int bus_machine_method_get_addresses(sd_bus *bus, sd_bus_message *message, void
pid_t child;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -338,10 +335,10 @@ int bus_machine_method_get_addresses(sd_bus *bus, sd_bus_message *message, void
if (r < 0)
return r;
- return sd_bus_send(bus, reply, NULL);
+ return sd_bus_send(sd_bus_message_get_bus(reply), reply, NULL);
}
-int bus_machine_method_get_os_release(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int bus_machine_method_get_os_release(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_close_ int mntns_fd = -1, root_fd = -1;
_cleanup_close_pair_ int pair[2] = { -1, -1 };
@@ -353,7 +350,6 @@ int bus_machine_method_get_os_release(sd_bus *bus, sd_bus_message *message, void
pid_t child;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -430,17 +426,16 @@ int bus_machine_method_get_os_release(sd_bus *bus, sd_bus_message *message, void
if (r < 0)
return r;
- return sd_bus_send(bus, reply, NULL);
+ return sd_bus_send(sd_bus_message_get_bus(reply), reply, NULL);
}
-int bus_machine_method_open_pty(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int bus_machine_method_open_pty(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_free_ char *pty_name = NULL;
_cleanup_close_ int master = -1;
Machine *m = userdata;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -463,10 +458,10 @@ int bus_machine_method_open_pty(sd_bus *bus, sd_bus_message *message, void *user
if (r < 0)
return r;
- return sd_bus_send(bus, reply, NULL);
+ return sd_bus_send(sd_bus_message_get_bus(reply), reply, NULL);
}
-int bus_machine_method_open_login(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int bus_machine_method_open_login(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_free_ char *pty_name = NULL, *getty = NULL;
_cleanup_bus_unref_ sd_bus *container_bus = NULL;
@@ -476,6 +471,9 @@ int bus_machine_method_open_login(sd_bus *bus, sd_bus_message *message, void *us
char *address;
int r;
+ assert(message);
+ assert(m);
+
if (m->class != MACHINE_CONTAINER)
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Opening logins is only supported on container machines.");
@@ -553,10 +551,10 @@ int bus_machine_method_open_login(sd_bus *bus, sd_bus_message *message, void *us
if (r < 0)
return r;
- return sd_bus_send(bus, reply, NULL);
+ return sd_bus_send(sd_bus_message_get_bus(reply), reply, NULL);
}
-int bus_machine_method_bind_mount(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int bus_machine_method_bind_mount(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_close_pair_ int errno_pipe_fd[2] = { -1, -1 };
char mount_slave[] = "/tmp/propagate.XXXXXX", *mount_tmp, *mount_outside, *p;
bool mount_slave_created = false, mount_slave_mounted = false,
@@ -569,6 +567,9 @@ int bus_machine_method_bind_mount(sd_bus *bus, sd_bus_message *message, void *us
siginfo_t si;
int r;
+ assert(message);
+ assert(m);
+
if (m->class != MACHINE_CONTAINER)
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Bind mounting is only supported on container machines.");
@@ -814,7 +815,7 @@ fail:
return 0;
}
-int bus_machine_method_copy(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int bus_machine_method_copy(sd_bus_message *message, void *userdata, sd_bus_error *error) {
const char *src, *dest, *host_path, *container_path, *host_basename, *host_dirname, *container_basename, *container_dirname;
_cleanup_close_pair_ int errno_pipe_fd[2] = { -1, -1 };
_cleanup_close_ int hostfd = -1;
@@ -825,6 +826,9 @@ int bus_machine_method_copy(sd_bus *bus, sd_bus_message *message, void *userdata
char *t;
int r;
+ assert(message);
+ assert(m);
+
if (m->n_operations >= MACHINE_OPERATIONS_MAX)
return sd_bus_error_setf(error, SD_BUS_ERROR_LIMITS_EXCEEDED, "Too many ongoing copies.");