diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2022-10-13 21:26:16 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2022-11-15 13:27:15 +0100 |
commit | 22e932f4d15f59ae773370a41a1c01ec93f8915a (patch) | |
tree | 0bfee6687fc6f1a16b24b656c1534d4d80db776f /src/shared/gpt.h | |
parent | bef69ae8780da17a807881d078247259170f868e (diff) | |
download | systemd-22e932f4d15f59ae773370a41a1c01ec93f8915a.tar.gz |
gpt: Expose GptPartitionType and get rid of SECONDARY/OTHER
Instead of exposing just the partition type UUID, let's expose the
GptPartitionType struct, which has a lot more information available
in a much more accessible way.
Also, let's get rid of SECONDARY/OTHER in PartitionDesignator. These
were only there to support preferred architectures in dissect-image.c,
but we can easily handle that by comparing architectures when we decide
whether to override a partition. This is done in a new function
compare_arch().
Diffstat (limited to 'src/shared/gpt.h')
-rw-r--r-- | src/shared/gpt.h | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/src/shared/gpt.h b/src/shared/gpt.h index e0ab44a642..967e20e0af 100644 --- a/src/shared/gpt.h +++ b/src/shared/gpt.h @@ -12,28 +12,16 @@ 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, @@ -46,8 +34,6 @@ 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_; @@ -56,7 +42,6 @@ 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, char buffer[static SD_ID128_UUID_STRING_MAX]); -int gpt_partition_type_uuid_from_string(const char *s, sd_id128_t *ret); #define GPT_PARTITION_TYPE_UUID_TO_STRING_HARDER(id) \ gpt_partition_type_uuid_to_string_harder((id), (char[SD_ID128_UUID_STRING_MAX]) {}) @@ -74,15 +59,11 @@ extern const GptPartitionType gpt_partition_type_table[]; int gpt_partition_label_valid(const char *s); -bool gpt_partition_type_is_root(sd_id128_t id); -bool gpt_partition_type_is_root_verity(sd_id128_t id); -bool gpt_partition_type_is_root_verity_sig(sd_id128_t id); -bool gpt_partition_type_is_usr(sd_id128_t id); -bool gpt_partition_type_is_usr_verity(sd_id128_t id); -bool gpt_partition_type_is_usr_verity_sig(sd_id128_t id); +GptPartitionType gpt_partition_type_from_uuid(sd_id128_t id); +int gpt_partition_type_from_string(const char *s, GptPartitionType *ret); -const char *gpt_partition_type_mountpoint_nulstr(sd_id128_t id); +const char *gpt_partition_type_mountpoint_nulstr(GptPartitionType type); -bool gpt_partition_type_knows_read_only(sd_id128_t id); -bool gpt_partition_type_knows_growfs(sd_id128_t id); -bool gpt_partition_type_knows_no_auto(sd_id128_t id); +bool gpt_partition_type_knows_read_only(GptPartitionType type); +bool gpt_partition_type_knows_growfs(GptPartitionType type); +bool gpt_partition_type_knows_no_auto(GptPartitionType type); |