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=c8d1328fe9d8f9e984bf9a275dd25113d91aa396;hp=afb849b41afb5d263bb3ca77a8b91f225c7e0e1e;hb=003dffde2c1b93afbc9aff24b277276f65424406;hpb=ebeccf9eecf5939a2ef772c3160e89efcad96194 diff --git a/src/machine/image-dbus.c b/src/machine/image-dbus.c index afb849b41..c8d1328fe 100644 --- a/src/machine/image-dbus.c +++ b/src/machine/image-dbus.c @@ -22,7 +22,8 @@ #include "bus-label.h" #include "bus-common-errors.h" #include "strv.h" -#include "image.h" +#include "machine-image.h" +#include "image-dbus.h" static int image_find_by_bus_path(const char *path, Image **ret) { _cleanup_free_ char *e = NULL; @@ -159,12 +160,68 @@ static int property_get_read_only( return 1; } +static int property_get_crtime( + 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->crtime); + if (r < 0) + return r; + + return 1; +} + +static int property_get_mtime( + 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->mtime); + if (r < 0) + return r; + + return 1; +} + 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("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_VTABLE_END };