diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2022-09-27 12:20:20 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2022-11-10 16:40:33 +0100 |
commit | dd8940235f606c983c23e939b76d668cb47a1d5c (patch) | |
tree | c739d5689172fce4ac3724a1db4357e1268f0e93 /src/shared/gpt.h | |
parent | copy: Support passing a deny list of files/directories to not copy (diff) | |
download | systemd-dd8940235f606c983c23e939b76d668cb47a1d5c.tar.xz systemd-dd8940235f606c983c23e939b76d668cb47a1d5c.zip |
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 '')
-rw-r--r-- | src/shared/gpt.h | 50 |
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[]; |