diff options
author | Luca Boccassi <luca.boccassi@microsoft.com> | 2021-01-21 18:36:33 +0000 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@microsoft.com> | 2021-01-21 18:37:00 +0000 |
commit | af477139522060f6165221597ce6509dbde91791 (patch) | |
tree | 7aea65e0bf434fa9df4c81678ceb7bd18416c8dd /src/core/dbus-manager.c | |
parent | 70599967664129bbd1aa5d460e3cb0beeb95dd13 (diff) | |
download | systemd-af477139522060f6165221597ce6509dbde91791.tar.gz |
pid1: add DBUS method to mount image inside a running service namespace
Follow the same pattern as the BindMount method.
Diffstat (limited to 'src/core/dbus-manager.c')
-rw-r--r-- | src/core/dbus-manager.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 4b88f0d9f0..eeb74353da 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -731,6 +731,11 @@ static int method_bind_mount_unit(sd_bus_message *message, void *userdata, sd_bu return method_generic_unit_operation(message, userdata, error, bus_service_method_bind_mount, GENERIC_UNIT_VALIDATE_LOADED); } +static int method_mount_image_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { + /* Only add mounts on fully loaded units */ + return method_generic_unit_operation(message, userdata, error, bus_service_method_mount_image, GENERIC_UNIT_VALIDATE_LOADED); +} + static int method_ref_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { /* Only allow reffing of fully loaded units, and make sure reffing a unit loads it. */ return method_generic_unit_operation(message, userdata, error, bus_unit_method_ref, GENERIC_UNIT_LOAD|GENERIC_UNIT_VALIDATE_LOADED); @@ -2776,6 +2781,17 @@ const sd_bus_vtable bus_manager_vtable[] = { NULL,, method_bind_mount_unit, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD_WITH_NAMES("MountImageUnit", + "sssbba(ss)", + SD_BUS_PARAM(name) + SD_BUS_PARAM(source) + SD_BUS_PARAM(destination) + SD_BUS_PARAM(read_only) + SD_BUS_PARAM(mkdir) + SD_BUS_PARAM(options), + NULL,, + method_mount_image_unit, + SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD_WITH_NAMES("RefUnit", "s", SD_BUS_PARAM(name), |