]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
discover-image: add stringification helpers for ImageClass
authorLennart Poettering <lennart@poettering.net>
Tue, 29 Nov 2022 15:38:48 +0000 (16:38 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 7 Dec 2022 16:44:35 +0000 (17:44 +0100)
src/shared/discover-image.c
src/shared/discover-image.h

index 9a7a1c990a74b6b1b4d9c5b072f639c00db61b05..43582d0dd3ac656311ccbfe4f686a8042c3565c5 100644 (file)
@@ -1303,3 +1303,11 @@ static const char* const image_type_table[_IMAGE_TYPE_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP(image_type, ImageType);
+
+static const char* const image_class_table[_IMAGE_CLASS_MAX] = {
+        [IMAGE_MACHINE] = "machine",
+        [IMAGE_PORTABLE] = "portable",
+        [IMAGE_EXTENSION] = "extension",
+};
+
+DEFINE_STRING_TABLE_LOOKUP(image_class, ImageClass);
index 3726e98d30c3d4224d8d656247c2a25dd3d1a288..3286061d61f9c6401a2e6e4df33baf290377413d 100644 (file)
@@ -76,6 +76,9 @@ int image_read_only(Image *i, bool b);
 const char* image_type_to_string(ImageType t) _const_;
 ImageType image_type_from_string(const char *s) _pure_;
 
+const char* image_class_to_string(ImageClass cl) _const_;
+ImageClass image_class_from_string(const char *s) _pure_;
+
 int image_path_lock(const char *path, int operation, LockFile *global, LockFile *local);
 int image_name_lock(const char *name, int operation, LockFile *ret);