X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fmachine%2Fimage-dbus.c;h=cae7b227dd64866aaa136bebcb34576fc4edf0ba;hp=1030cd314f3b964342006e17c46ef85717c0dea2;hb=b6b1849830f5e4a6065c3b0c993668e500c954d3;hpb=814f000872fc2d254250831607bdca9b27e5705e diff --git a/src/machine/image-dbus.c b/src/machine/image-dbus.c index 1030cd314..cae7b227d 100644 --- a/src/machine/image-dbus.c +++ b/src/machine/image-dbus.c @@ -213,6 +213,111 @@ static int property_get_mtime( return 1; } +static int property_get_size( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *error) { + + _cleanup_(image_unrefp) Image *image = NULL; + int r; + + assert(bus); + assert(reply); + + r = image_find_by_bus_path_with_error(path, &image, error); + if (r < 0) + return r; + + r = sd_bus_message_append(reply, "t", image->size); + if (r < 0) + return r; + + return 1; +} + + +static int property_get_limit( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *error) { + + _cleanup_(image_unrefp) Image *image = NULL; + int r; + + assert(bus); + assert(reply); + + r = image_find_by_bus_path_with_error(path, &image, error); + if (r < 0) + return r; + + r = sd_bus_message_append(reply, "t", image->limit); + if (r < 0) + return r; + + return 1; +} + +static int property_get_size_exclusive( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *error) { + + _cleanup_(image_unrefp) Image *image = NULL; + int r; + + assert(bus); + assert(reply); + + r = image_find_by_bus_path_with_error(path, &image, error); + if (r < 0) + return r; + + r = sd_bus_message_append(reply, "t", image->size_exclusive); + if (r < 0) + return r; + + return 1; +} + +static int property_get_limit_exclusive( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *error) { + + _cleanup_(image_unrefp) Image *image = NULL; + int r; + + assert(bus); + assert(reply); + + r = image_find_by_bus_path_with_error(path, &image, error); + if (r < 0) + return r; + + r = sd_bus_message_append(reply, "t", image->limit_exclusive); + if (r < 0) + return r; + + return 1; +} + static int method_remove( sd_bus *bus, sd_bus_message *message, @@ -327,12 +432,16 @@ static int method_mark_read_only( const sd_bus_vtable image_vtable[] = { SD_BUS_VTABLE_START(0), - SD_BUS_PROPERTY("Name", "s", property_get_name, 0, 0), - SD_BUS_PROPERTY("Path", "s", property_get_path, 0, 0), - SD_BUS_PROPERTY("Type", "s", property_get_type, 0, 0), - 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_PROPERTY("Name", "s", property_get_name, 0, 0), + SD_BUS_PROPERTY("Path", "s", property_get_path, 0, 0), + SD_BUS_PROPERTY("Type", "s", property_get_type, 0, 0), + 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_PROPERTY("Size", "t", property_get_size, 0, 0), + SD_BUS_PROPERTY("Limit", "t", property_get_limit, 0, 0), + SD_BUS_PROPERTY("SizeExclusive", "t", property_get_size_exclusive, 0, 0), + SD_BUS_PROPERTY("LimitExclusive", "t", property_get_limit_exclusive, 0, 0), SD_BUS_METHOD("Remove", NULL, NULL, method_remove, 0), SD_BUS_METHOD("Rename", "s", NULL, method_rename, 0), SD_BUS_METHOD("Clone", "sb", NULL, method_clone, 0),