summaryrefslogtreecommitdiffstats
path: root/src/shared/discover-image.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-10-10 16:04:51 +0200
committerLennart Poettering <lennart@poettering.net>2023-10-11 15:56:08 +0200
commita81fe93e9532bd3286f21ca0696208eb474f686c (patch)
treec929ab46ada06773313b0574ed263b9af517ad67 /src/shared/discover-image.h
parentdissect: image size can be unset, suppres in JSON output then (diff)
downloadsystemd-a81fe93e9532bd3286f21ca0696208eb474f686c.tar.xz
systemd-a81fe93e9532bd3286f21ca0696208eb474f686c.zip
dissect: allow confext/sysext to be in the same image
This reworks the image discovery logic, and conceptually allows DDIs that are both confext and sysext to exist. Previously we'd only extract one type of exension data from a DDI, with this we allow to extract both if both exist. This doesn't add support for true "multi-modal" DDIs, that qualify as various things at once, it just lays some ground work that ensures we at least can dissect such images. This reworks 484d26dac1e8e543fc9e300e3c1fa36be0769f7d quite a bit. This changes systemd-dissect's JSON output, but given the version with the fields it changes/dops has never been released (as the above patch was merged post-v254) this shouldn't be an issue.
Diffstat (limited to 'src/shared/discover-image.h')
-rw-r--r--src/shared/discover-image.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/shared/discover-image.h b/src/shared/discover-image.h
index edfb1412a4..bb046fae1e 100644
--- a/src/shared/discover-image.h
+++ b/src/shared/discover-image.h
@@ -45,7 +45,8 @@ typedef struct Image {
sd_id128_t machine_id;
char **machine_info;
char **os_release;
- char **extension_release;
+ char **sysext_release;
+ char **confext_release;
bool metadata_valid:1;
bool discoverable:1; /* true if we know for sure that image_find() would find the image given just the short name */
@@ -80,6 +81,17 @@ int image_read_metadata(Image *i, const ImagePolicy *image_policy);
bool image_in_search_path(ImageClass class, const char *root, const char *image);
+static inline char **image_extension_release(Image *image, ImageClass class) {
+ assert(image);
+
+ if (class == IMAGE_SYSEXT)
+ return image->sysext_release;
+ if (class == IMAGE_CONFEXT)
+ return image->confext_release;
+
+ return NULL;
+}
+
static inline bool IMAGE_IS_HIDDEN(const struct Image *i) {
assert(i);