discover-image: introduce bus_property_get_image_is_read_only() with BUS_DEFINE_PROPERTY_GET() macro

This also makes image_is_read_only() return bool.

Follow-up for ee327e086e.
This commit is contained in:
Yu Watanabe
2025-11-01 18:11:18 +09:00
parent cbd8a12bce
commit 7829c9cc48
4 changed files with 7 additions and 31 deletions
+3
View File
@@ -16,6 +16,7 @@
#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"
@@ -2220,3 +2221,5 @@ int image_root_pick(
*ret = TAKE_PTR(s);
return 0;
}
BUS_DEFINE_PROPERTY_GET(bus_property_get_image_is_read_only, "b", Image, (int) image_is_read_only);
+2 -1
View File
@@ -91,7 +91,7 @@ static inline bool image_is_hidden(const Image *i) {
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
@@ -102,6 +102,7 @@ static inline int image_is_read_only(const Image *i) {
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);