summaryrefslogtreecommitdiff
path: root/src/machine
diff options
context:
space:
mode:
Diffstat (limited to 'src/machine')
-rw-r--r--src/machine/image-dbus.c10
-rw-r--r--src/machine/image-dbus.h10
-rw-r--r--src/machine/machine-dbus.c38
-rw-r--r--src/machine/machine-dbus.h16
-rw-r--r--src/machine/machinectl.c13
-rw-r--r--src/machine/machined-dbus.c135
-rw-r--r--src/machine/machined.h8
7 files changed, 107 insertions, 123 deletions
diff --git a/src/machine/image-dbus.c b/src/machine/image-dbus.c
index 12c879aff0..95d7bca4bf 100644
--- a/src/machine/image-dbus.c
+++ b/src/machine/image-dbus.c
@@ -28,7 +28,6 @@
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_type, image_type, ImageType);
int bus_image_method_remove(
- sd_bus *bus,
sd_bus_message *message,
void *userdata,
sd_bus_error *error) {
@@ -37,7 +36,6 @@ int bus_image_method_remove(
Manager *m = image->userdata;
int r;
- assert(bus);
assert(message);
assert(image);
@@ -62,7 +60,6 @@ int bus_image_method_remove(
}
int bus_image_method_rename(
- sd_bus *bus,
sd_bus_message *message,
void *userdata,
sd_bus_error *error) {
@@ -72,7 +69,6 @@ int bus_image_method_rename(
const char *new_name;
int r;
- assert(bus);
assert(message);
assert(image);
@@ -104,7 +100,6 @@ int bus_image_method_rename(
}
int bus_image_method_clone(
- sd_bus *bus,
sd_bus_message *message,
void *userdata,
sd_bus_error *error) {
@@ -114,7 +109,6 @@ int bus_image_method_clone(
const char *new_name;
int r, read_only;
- assert(bus);
assert(message);
assert(image);
@@ -146,7 +140,6 @@ int bus_image_method_clone(
}
int bus_image_method_mark_read_only(
- sd_bus *bus,
sd_bus_message *message,
void *userdata,
sd_bus_error *error) {
@@ -155,7 +148,6 @@ int bus_image_method_mark_read_only(
Manager *m = image->userdata;
int r, read_only;
- assert(bus);
assert(message);
r = sd_bus_message_read(message, "b", &read_only);
@@ -183,7 +175,6 @@ int bus_image_method_mark_read_only(
}
int bus_image_method_set_limit(
- sd_bus *bus,
sd_bus_message *message,
void *userdata,
sd_bus_error *error) {
@@ -193,7 +184,6 @@ int bus_image_method_set_limit(
uint64_t limit;
int r;
- assert(bus);
assert(message);
r = sd_bus_message_read(message, "t", &limit);
diff --git a/src/machine/image-dbus.h b/src/machine/image-dbus.h
index b9def6bc1b..d56d905c8e 100644
--- a/src/machine/image-dbus.h
+++ b/src/machine/image-dbus.h
@@ -30,8 +30,8 @@ char *image_bus_path(const char *name);
int image_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error);
int image_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error);
-int bus_image_method_remove(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int bus_image_method_rename(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int bus_image_method_clone(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int bus_image_method_mark_read_only(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int bus_image_method_set_limit(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
+int bus_image_method_remove(sd_bus_message *message, void *userdata, sd_bus_error *error);
+int bus_image_method_rename(sd_bus_message *message, void *userdata, sd_bus_error *error);
+int bus_image_method_clone(sd_bus_message *message, void *userdata, sd_bus_error *error);
+int bus_image_method_mark_read_only(sd_bus_message *message, void *userdata, sd_bus_error *error);
+int bus_image_method_set_limit(sd_bus_message *message, void *userdata, sd_bus_error *error);
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.");
diff --git a/src/machine/machine-dbus.h b/src/machine/machine-dbus.h
index 4eb24f9a1f..d309131860 100644
--- a/src/machine/machine-dbus.h
+++ b/src/machine/machine-dbus.h
@@ -29,14 +29,14 @@ char *machine_bus_path(Machine *s);
int machine_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error);
int machine_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error);
-int bus_machine_method_terminate(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int bus_machine_method_kill(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int bus_machine_method_get_addresses(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int bus_machine_method_get_os_release(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int bus_machine_method_open_pty(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int bus_machine_method_open_login(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int bus_machine_method_bind_mount(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int bus_machine_method_copy(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);
+int bus_machine_method_kill(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);
+int bus_machine_method_get_os_release(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);
+int bus_machine_method_open_login(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);
+int bus_machine_method_copy(sd_bus_message *message, void *userdata, sd_bus_error *error);
int machine_send_signal(Machine *m, bool new_machine);
int machine_send_create_reply(Machine *m, sd_bus_error *error);
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 26cd5b8002..ed7221800f 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -1115,11 +1115,10 @@ static int bind_mount(int argc, char *argv[], void *userdata) {
return 0;
}
-static int on_machine_removed(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
+static int on_machine_removed(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
PTYForward ** forward = (PTYForward**) userdata;
int r;
- assert(bus);
assert(m);
assert(forward);
@@ -1136,7 +1135,7 @@ static int on_machine_removed(sd_bus *bus, sd_bus_message *m, void *userdata, sd
}
/* On error, or when the forwarder is not initialized yet, quit immediately */
- sd_event_exit(sd_bus_get_event(bus), EXIT_FAILURE);
+ sd_event_exit(sd_bus_get_event(sd_bus_message_get_bus(m)), EXIT_FAILURE);
return 0;
}
@@ -1496,12 +1495,11 @@ static int enable_machine(int argc, char *argv[], void *userdata) {
return 0;
}
-static int match_log_message(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) {
+static int match_log_message(sd_bus_message *m, void *userdata, sd_bus_error *error) {
const char **our_path = userdata, *line;
unsigned priority;
int r;
- assert(bus);
assert(m);
assert(our_path);
@@ -1521,12 +1519,11 @@ static int match_log_message(sd_bus *bus, sd_bus_message *m, void *userdata, sd_
return 0;
}
-static int match_transfer_removed(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bus_error *error) {
+static int match_transfer_removed(sd_bus_message *m, void *userdata, sd_bus_error *error) {
const char **our_path = userdata, *path, *result;
uint32_t id;
int r;
- assert(bus);
assert(m);
assert(our_path);
@@ -1539,7 +1536,7 @@ static int match_transfer_removed(sd_bus *bus, sd_bus_message *m, void *userdata
if (!streq_ptr(*our_path, path))
return 0;
- sd_event_exit(sd_bus_get_event(bus), !streq_ptr(result, "done"));
+ sd_event_exit(sd_bus_get_event(sd_bus_message_get_bus(m)), !streq_ptr(result, "done"));
return 0;
}
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index 76109700a3..5036a63985 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -125,14 +125,13 @@ static int property_get_pool_limit(
return sd_bus_message_append(reply, "t", size);
}
-static int method_get_machine(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_get_machine(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
Manager *m = userdata;
Machine *machine;
const char *name;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -151,13 +150,12 @@ static int method_get_machine(sd_bus *bus, sd_bus_message *message, void *userda
return sd_bus_reply_method_return(message, "o", p);
}
-static int method_get_image(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_get_image(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
Manager *m = userdata;
const char *name;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -178,14 +176,13 @@ static int method_get_image(sd_bus *bus, sd_bus_message *message, void *userdata
return sd_bus_reply_method_return(message, "o", p);
}
-static int method_get_machine_by_pid(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_get_machine_by_pid(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
Manager *m = userdata;
Machine *machine = NULL;
pid_t pid;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -220,14 +217,13 @@ static int method_get_machine_by_pid(sd_bus *bus, sd_bus_message *message, void
return sd_bus_reply_method_return(message, "o", p);
}
-static int method_list_machines(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_list_machines(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
Manager *m = userdata;
Machine *machine;
Iterator i;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -259,7 +255,7 @@ static int method_list_machines(sd_bus *bus, sd_bus_message *message, void *user
if (r < 0)
return sd_bus_error_set_errno(error, r);
- return sd_bus_send(bus, reply, NULL);
+ return sd_bus_send(sd_bus_message_get_bus(message), reply, NULL);
}
static int method_create_or_register_machine(Manager *manager, sd_bus_message *message, bool read_network, Machine **_m, sd_bus_error *error) {
@@ -387,11 +383,14 @@ fail:
return r;
}
-static int method_create_machine_internal(sd_bus *bus, sd_bus_message *message, bool read_network, void *userdata, sd_bus_error *error) {
+static int method_create_machine_internal(sd_bus_message *message, bool read_network, void *userdata, sd_bus_error *error) {
Manager *manager = userdata;
Machine *m = NULL;
int r;
+ assert(message);
+ assert(manager);
+
r = method_create_or_register_machine(manager, message, read_network, &m, error);
if (r < 0)
return r;
@@ -412,20 +411,23 @@ fail:
return r;
}
-static int method_create_machine_with_network(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
- return method_create_machine_internal(bus, message, true, userdata, error);
+static int method_create_machine_with_network(sd_bus_message *message, void *userdata, sd_bus_error *error) {
+ return method_create_machine_internal(message, true, userdata, error);
}
-static int method_create_machine(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
- return method_create_machine_internal(bus, message, false, userdata, error);
+static int method_create_machine(sd_bus_message *message, void *userdata, sd_bus_error *error) {
+ return method_create_machine_internal(message, false, userdata, error);
}
-static int method_register_machine_internal(sd_bus *bus, sd_bus_message *message, bool read_network, void *userdata, sd_bus_error *error) {
+static int method_register_machine_internal(sd_bus_message *message, bool read_network, void *userdata, sd_bus_error *error) {
Manager *manager = userdata;
_cleanup_free_ char *p = NULL;
Machine *m = NULL;
int r;
+ assert(message);
+ assert(manager);
+
r = method_create_or_register_machine(manager, message, read_network, &m, error);
if (r < 0)
return r;
@@ -453,21 +455,20 @@ fail:
return r;
}
-static int method_register_machine_with_network(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
- return method_register_machine_internal(bus, message, true, userdata, error);
+static int method_register_machine_with_network(sd_bus_message *message, void *userdata, sd_bus_error *error) {
+ return method_register_machine_internal(message, true, userdata, error);
}
-static int method_register_machine(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
- return method_register_machine_internal(bus, message, false, userdata, error);
+static int method_register_machine(sd_bus_message *message, void *userdata, sd_bus_error *error) {
+ return method_register_machine_internal(message, false, userdata, error);
}
-static int method_terminate_machine(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_terminate_machine(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Machine *machine;
const char *name;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -479,16 +480,15 @@ static int method_terminate_machine(sd_bus *bus, sd_bus_message *message, void *
if (!machine)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_MACHINE, "No machine '%s' known", name);
- return bus_machine_method_terminate(bus, message, machine, error);
+ return bus_machine_method_terminate(message, machine, error);
}
-static int method_kill_machine(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_kill_machine(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Machine *machine;
const char *name;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -500,16 +500,15 @@ static int method_kill_machine(sd_bus *bus, sd_bus_message *message, void *userd
if (!machine)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_MACHINE, "No machine '%s' known", name);
- return bus_machine_method_kill(bus, message, machine, error);
+ return bus_machine_method_kill(message, machine, error);
}
-static int method_get_machine_addresses(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_get_machine_addresses(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Machine *machine;
const char *name;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -521,16 +520,15 @@ static int method_get_machine_addresses(sd_bus *bus, sd_bus_message *message, vo
if (!machine)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_MACHINE, "No machine '%s' known", name);
- return bus_machine_method_get_addresses(bus, message, machine, error);
+ return bus_machine_method_get_addresses(message, machine, error);
}
-static int method_get_machine_os_release(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_get_machine_os_release(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Machine *machine;
const char *name;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -542,10 +540,10 @@ static int method_get_machine_os_release(sd_bus *bus, sd_bus_message *message, v
if (!machine)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_MACHINE, "No machine '%s' known", name);
- return bus_machine_method_get_os_release(bus, message, machine, error);
+ return bus_machine_method_get_os_release(message, machine, error);
}
-static int method_list_images(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_list_images(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_(image_hashmap_freep) Hashmap *images = NULL;
Manager *m = userdata;
@@ -553,7 +551,6 @@ static int method_list_images(sd_bus *bus, sd_bus_message *message, void *userda
Iterator i;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -596,16 +593,15 @@ static int method_list_images(sd_bus *bus, sd_bus_message *message, void *userda
if (r < 0)
return r;
- return sd_bus_send(bus, reply, NULL);
+ return sd_bus_send(sd_bus_message_get_bus(message), reply, NULL);
}
-static int method_open_machine_pty(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_open_machine_pty(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Machine *machine;
const char *name;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -617,16 +613,15 @@ static int method_open_machine_pty(sd_bus *bus, sd_bus_message *message, void *u
if (!machine)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_MACHINE, "No machine '%s' known", name);
- return bus_machine_method_open_pty(bus, message, machine, error);
+ return bus_machine_method_open_pty(message, machine, error);
}
-static int method_open_machine_login(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_open_machine_login(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Machine *machine;
const char *name;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -638,16 +633,15 @@ static int method_open_machine_login(sd_bus *bus, sd_bus_message *message, void
if (!machine)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_MACHINE, "No machine '%s' known", name);
- return bus_machine_method_open_login(bus, message, machine, error);
+ return bus_machine_method_open_login(message, machine, error);
}
-static int method_bind_mount_machine(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_bind_mount_machine(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Machine *machine;
const char *name;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -659,16 +653,15 @@ static int method_bind_mount_machine(sd_bus *bus, sd_bus_message *message, void
if (!machine)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_MACHINE, "No machine '%s' known", name);
- return bus_machine_method_bind_mount(bus, message, machine, error);
+ return bus_machine_method_bind_mount(message, machine, error);
}
-static int method_copy_machine(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_copy_machine(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Machine *machine;
const char *name;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -680,15 +673,14 @@ static int method_copy_machine(sd_bus *bus, sd_bus_message *message, void *userd
if (!machine)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_MACHINE, "No machine '%s' known", name);
- return bus_machine_method_copy(bus, message, machine, error);
+ return bus_machine_method_copy(message, machine, error);
}
-static int method_remove_image(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_remove_image(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(image_unrefp) Image* i = NULL;
const char *name;
int r;
- assert(bus);
assert(message);
r = sd_bus_message_read(message, "s", &name);
@@ -705,15 +697,14 @@ static int method_remove_image(sd_bus *bus, sd_bus_message *message, void *userd
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_IMAGE, "No image '%s' known", name);
i->userdata = userdata;
- return bus_image_method_remove(bus, message, i, error);
+ return bus_image_method_remove(message, i, error);
}
-static int method_rename_image(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_rename_image(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(image_unrefp) Image* i = NULL;
const char *old_name;
int r;
- assert(bus);
assert(message);
r = sd_bus_message_read(message, "s", &old_name);
@@ -730,15 +721,16 @@ static int method_rename_image(sd_bus *bus, sd_bus_message *message, void *userd
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_IMAGE, "No image '%s' known", old_name);
i->userdata = userdata;
- return bus_image_method_rename(bus, message, i, error);
+ return bus_image_method_rename(message, i, error);
}
-static int method_clone_image(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_clone_image(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(image_unrefp) Image *i = NULL;
const char *old_name;
int r;
- assert(bus);
+ assert(message);
+
r = sd_bus_message_read(message, "s", &old_name);
if (r < 0)
return r;
@@ -753,15 +745,16 @@ static int method_clone_image(sd_bus *bus, sd_bus_message *message, void *userda
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_IMAGE, "No image '%s' known", old_name);
i->userdata = userdata;
- return bus_image_method_clone(bus, message, i, error);
+ return bus_image_method_clone(message, i, error);
}
-static int method_mark_image_read_only(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_mark_image_read_only(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(image_unrefp) Image *i = NULL;
const char *name;
int r;
- assert(bus);
+ assert(message);
+
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
return r;
@@ -776,15 +769,16 @@ static int method_mark_image_read_only(sd_bus *bus, sd_bus_message *message, voi
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_IMAGE, "No image '%s' known", name);
i->userdata = userdata;
- return bus_image_method_mark_read_only(bus, message, i, error);
+ return bus_image_method_mark_read_only(message, i, error);
}
-static int method_set_pool_limit(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_set_pool_limit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
uint64_t limit;
int r;
- assert(bus);
+ assert(message);
+
r = sd_bus_message_read(message, "t", &limit);
if (r < 0)
return r;
@@ -822,12 +816,13 @@ static int method_set_pool_limit(sd_bus *bus, sd_bus_message *message, void *use
return sd_bus_reply_method_return(message, NULL);
}
-static int method_set_image_limit(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+static int method_set_image_limit(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(image_unrefp) Image *i = NULL;
const char *name;
int r;
- assert(bus);
+ assert(message);
+
r = sd_bus_message_read(message, "s", &name);
if (r < 0)
return r;
@@ -842,7 +837,7 @@ static int method_set_image_limit(sd_bus *bus, sd_bus_message *message, void *us
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_IMAGE, "No image '%s' known", name);
i->userdata = userdata;
- return bus_image_method_set_limit(bus, message, i, error);
+ return bus_image_method_set_limit(message, i, error);
}
const sd_bus_vtable manager_vtable[] = {
@@ -879,14 +874,13 @@ const sd_bus_vtable manager_vtable[] = {
SD_BUS_VTABLE_END
};
-int match_job_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *error) {
const char *path, *result, *unit;
Manager *m = userdata;
Machine *machine;
uint32_t id;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -922,14 +916,13 @@ int match_job_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_b
return 0;
}
-int match_properties_changed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *unit = NULL;
const char *path, *interface;
Manager *m = userdata;
Machine *machine;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -983,13 +976,12 @@ int match_properties_changed(sd_bus *bus, sd_bus_message *message, void *userdat
return 0;
}
-int match_unit_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error) {
const char *path, *unit;
Manager *m = userdata;
Machine *machine;
int r;
- assert(bus);
assert(message);
assert(m);
@@ -1009,13 +1001,14 @@ int match_unit_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_
return 0;
}
-int match_reloading(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
+int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
Machine *machine;
Iterator i;
int b, r;
- assert(bus);
+ assert(message);
+ assert(m);
r = sd_bus_message_read(message, "b", &b);
if (r < 0) {
diff --git a/src/machine/machined.h b/src/machine/machined.h
index 0f3df17d7f..61dbefb5f1 100644
--- a/src/machine/machined.h
+++ b/src/machine/machined.h
@@ -65,10 +65,10 @@ int manager_get_machine_by_pid(Manager *m, pid_t pid, Machine **machine);
extern const sd_bus_vtable manager_vtable[];
-int match_reloading(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int match_unit_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int match_properties_changed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
-int match_job_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error);
+int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error);
+int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error);
+int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_error *error);
+int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *error);
int manager_start_scope(Manager *manager, const char *scope, pid_t pid, const char *slice, const char *description, sd_bus_message *more_properties, sd_bus_error *error, char **job);
int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job);