diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-12-27 02:35:47 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-12-28 02:08:40 +0100 |
commit | 086821244b5113f00a0ef993b78dc56aae2a8f6c (patch) | |
tree | 296492582d2fc44697d98505907e3a0ab678451c /src/machine/image-dbus.c | |
parent | 1b9cebf6385b5ea0e5ea099da163687013ac7790 (diff) |
machined: add "machinectl remove" for removing images
Diffstat (limited to 'src/machine/image-dbus.c')
-rw-r--r-- | src/machine/image-dbus.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/machine/image-dbus.c b/src/machine/image-dbus.c index c8d1328fe9..be2369953c 100644 --- a/src/machine/image-dbus.c +++ b/src/machine/image-dbus.c @@ -196,7 +196,6 @@ static int property_get_mtime( void *userdata, sd_bus_error *error) { - _cleanup_(image_unrefp) Image *image = NULL; int r; @@ -214,6 +213,29 @@ static int property_get_mtime( return 1; } +static int method_remove( + sd_bus *bus, + sd_bus_message *message, + void *userdata, + sd_bus_error *error) { + + _cleanup_(image_unrefp) Image *image = NULL; + int r; + + assert(bus); + assert(message); + + r = image_find_by_bus_path_with_error(sd_bus_message_get_path(message), &image, error); + if (r < 0) + return r; + + r = image_remove(image); + if (r < 0) + return r; + + return sd_bus_reply_method_return(message, NULL); +} + const sd_bus_vtable image_vtable[] = { SD_BUS_VTABLE_START(0), SD_BUS_PROPERTY("Name", "s", property_get_name, 0, 0), @@ -222,6 +244,7 @@ const sd_bus_vtable image_vtable[] = { SD_BUS_PROPERTY("ReadOnly", "b", property_get_read_only, 0, 0), SD_BUS_PROPERTY("CreationTimestamp", "t", property_get_crtime, 0, 0), SD_BUS_PROPERTY("ModificationTimestamp", "t", property_get_mtime, 0, 0), + SD_BUS_METHOD("Remove", NULL, NULL, method_remove, 0), SD_BUS_VTABLE_END }; |