static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_type, image_type, ImageType);
-static int property_get_read_only(
- sd_bus *bus,
- const char *path,
- const char *interface,
- const char *property,
- sd_bus_message *reply,
- void *userdata,
- sd_bus_error *error) {
-
- Image *image = ASSERT_PTR(userdata);
-
- return sd_bus_message_append(ASSERT_PTR(reply), "b", image_is_read_only(image));
-}
-
int bus_image_method_remove(
sd_bus_message *message,
void *userdata,
SD_BUS_PROPERTY("Name", "s", NULL, offsetof(Image, name), 0),
SD_BUS_PROPERTY("Path", "s", NULL, offsetof(Image, path), 0),
SD_BUS_PROPERTY("Type", "s", property_get_type, offsetof(Image, type), 0),
- SD_BUS_PROPERTY("ReadOnly", "b", property_get_read_only, 0, 0),
+ SD_BUS_PROPERTY("ReadOnly", "b", bus_property_get_image_is_read_only, 0, 0),
SD_BUS_PROPERTY("CreationTimestamp", "t", NULL, offsetof(Image, crtime), 0),
SD_BUS_PROPERTY("ModificationTimestamp", "t", NULL, offsetof(Image, mtime), 0),
SD_BUS_PROPERTY("Usage", "t", NULL, offsetof(Image, usage), 0),
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_type, image_type, ImageType);
-static int property_get_read_only(
- sd_bus *bus,
- const char *path,
- const char *interface,
- const char *property,
- sd_bus_message *reply,
- void *userdata,
- sd_bus_error *error) {
-
- Image *image = ASSERT_PTR(userdata);
-
- return sd_bus_message_append(ASSERT_PTR(reply), "b", image_is_read_only(image));
-}
-
int bus_image_common_get_os_release(
Manager *m,
sd_bus_message *message,
SD_BUS_PROPERTY("Name", "s", NULL, offsetof(Image, name), 0),
SD_BUS_PROPERTY("Path", "s", NULL, offsetof(Image, path), 0),
SD_BUS_PROPERTY("Type", "s", property_get_type, offsetof(Image, type), 0),
- SD_BUS_PROPERTY("ReadOnly", "b", property_get_read_only, 0, 0),
+ SD_BUS_PROPERTY("ReadOnly", "b", bus_property_get_image_is_read_only, 0, 0),
SD_BUS_PROPERTY("CreationTimestamp", "t", NULL, offsetof(Image, crtime), 0),
SD_BUS_PROPERTY("ModificationTimestamp", "t", NULL, offsetof(Image, mtime), 0),
SD_BUS_PROPERTY("Usage", "t", NULL, offsetof(Image, usage), 0),
#include "alloc-util.h"
#include "blockdev-util.h"
#include "btrfs-util.h"
+#include "bus-get-properties.h"
#include "chase.h"
#include "chattr-util.h"
#include "copy.h"
*ret = TAKE_PTR(s);
return 0;
}
+
+BUS_DEFINE_PROPERTY_GET(bus_property_get_image_is_read_only, "b", Image, (int) image_is_read_only);
return i->name && i->name[0] == '.';
}
-static inline int image_is_read_only(const Image *i) {
+static inline bool image_is_read_only(const Image *i) {
assert(i);
/* We enforce the rule that hidden images are always read-only too. If people want to change hidden
return i->read_only;
}
+int bus_property_get_image_is_read_only(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *reterr_error);
bool image_is_vendor(const Image *i);
bool image_is_host(const Image *i);