summaryrefslogtreecommitdiff
path: root/src/shared/gpt.h
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2022-09-27 12:20:20 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2022-11-10 16:40:33 +0100
commitdd8940235f606c983c23e939b76d668cb47a1d5c (patch)
treec739d5689172fce4ac3724a1db4357e1268f0e93 /src/shared/gpt.h
parenta424958aa6a95ce037976a9b065e4c88e97992c7 (diff)
downloadsystemd-dd8940235f606c983c23e939b76d668cb47a1d5c.tar.gz
gpt: Replace bitfields with designator field in GptPartitionType
To achieve this we move the PartitionDesignator enum from dissect-image.h to gpt.h
Diffstat (limited to 'src/shared/gpt.h')
-rw-r--r--src/shared/gpt.h50
1 files changed, 43 insertions, 7 deletions
diff --git a/src/shared/gpt.h b/src/shared/gpt.h
index f673194d4a..70e79550db 100644
--- a/src/shared/gpt.h
+++ b/src/shared/gpt.h
@@ -10,6 +10,48 @@
/* maximum length of gpt label */
#define GPT_LABEL_MAX 36
+typedef enum PartitionDesignator {
+ PARTITION_ROOT, /* Primary architecture */
+ PARTITION_ROOT_SECONDARY, /* Secondary architecture */
+ PARTITION_ROOT_OTHER, /* Any architecture not covered by the primary or secondary architecture. */
+ PARTITION_USR,
+ PARTITION_USR_SECONDARY,
+ PARTITION_USR_OTHER,
+ PARTITION_HOME,
+ PARTITION_SRV,
+ PARTITION_ESP,
+ PARTITION_XBOOTLDR,
+ PARTITION_SWAP,
+ PARTITION_ROOT_VERITY, /* verity data for the PARTITION_ROOT partition */
+ PARTITION_ROOT_SECONDARY_VERITY, /* verity data for the PARTITION_ROOT_SECONDARY partition */
+ PARTITION_ROOT_OTHER_VERITY,
+ PARTITION_USR_VERITY,
+ PARTITION_USR_SECONDARY_VERITY,
+ PARTITION_USR_OTHER_VERITY,
+ PARTITION_ROOT_VERITY_SIG, /* PKCS#7 signature for root hash for the PARTITION_ROOT partition */
+ PARTITION_ROOT_SECONDARY_VERITY_SIG, /* ditto for the PARTITION_ROOT_SECONDARY partition */
+ PARTITION_ROOT_OTHER_VERITY_SIG,
+ PARTITION_USR_VERITY_SIG,
+ PARTITION_USR_SECONDARY_VERITY_SIG,
+ PARTITION_USR_OTHER_VERITY_SIG,
+ PARTITION_TMP,
+ PARTITION_VAR,
+ PARTITION_USER_HOME,
+ PARTITION_LINUX_GENERIC,
+ _PARTITION_DESIGNATOR_MAX,
+ _PARTITION_DESIGNATOR_INVALID = -EINVAL,
+} PartitionDesignator;
+
+bool partition_designator_is_versioned(PartitionDesignator d);
+
+PartitionDesignator partition_verity_of(PartitionDesignator p);
+PartitionDesignator partition_verity_sig_of(PartitionDesignator p);
+PartitionDesignator partition_root_of_arch(Architecture arch);
+PartitionDesignator partition_usr_of_arch(Architecture arch);
+
+const char* partition_designator_to_string(PartitionDesignator d) _const_;
+PartitionDesignator partition_designator_from_string(const char *name) _pure_;
+
const char *gpt_partition_type_uuid_to_string(sd_id128_t id);
const char *gpt_partition_type_uuid_to_string_harder(
sd_id128_t id,
@@ -25,13 +67,7 @@ typedef struct GptPartitionType {
sd_id128_t uuid;
const char *name;
Architecture arch;
-
- bool is_root:1;
- bool is_root_verity:1;
- bool is_root_verity_sig:1;
- bool is_usr:1;
- bool is_usr_verity:1;
- bool is_usr_verity_sig:1;
+ PartitionDesignator designator;
} GptPartitionType;
extern const GptPartitionType gpt_partition_type_table[];