DEFINE_STRING_TABLE_LOOKUP(partition_designator, PartitionDesignator);
+static const char *const partition_mountpoint_table[] = {
+ [PARTITION_ROOT] = "/\0",
+ [PARTITION_ROOT_SECONDARY] = "/\0",
+ [PARTITION_ROOT_OTHER] = "/\0",
+ [PARTITION_USR] = "/usr\0",
+ [PARTITION_USR_SECONDARY] = "/usr\0",
+ [PARTITION_USR_OTHER] = "/usr\0",
+ [PARTITION_HOME] = "/home\0",
+ [PARTITION_SRV] = "/srv\0",
+ [PARTITION_ESP] = "/efi\0/boot\0",
+ [PARTITION_XBOOTLDR] = "/boot\0",
+ [PARTITION_TMP] = "/var/tmp\0",
+ [PARTITION_VAR] = "/var\0",
+};
+
+DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(partition_mountpoint, PartitionDesignator);
+
#define _GPT_ARCH_SEXTET(arch, name) \
{ SD_GPT_ROOT_##arch, "root-" name, ARCHITECTURE_##arch, .designator = PARTITION_ROOT_OTHER }, \
{ SD_GPT_ROOT_##arch##_VERITY, "root-" name "-verity", ARCHITECTURE_##arch, .designator = PARTITION_ROOT_OTHER_VERITY }, \
PARTITION_USR_OTHER_VERITY_SIG);
}
+const char *gpt_partition_type_mountpoint_nulstr(sd_id128_t id) {
+ PartitionDesignator d = gpt_partition_type_from_uuid(id).designator;
+ if (d < 0)
+ return NULL;
+
+ return partition_mountpoint_to_string(d);
+}
+
bool gpt_partition_type_knows_read_only(sd_id128_t id) {
return gpt_partition_type_is_root(id) ||
gpt_partition_type_is_usr(id) ||
bool gpt_partition_type_is_usr_verity(sd_id128_t id);
bool gpt_partition_type_is_usr_verity_sig(sd_id128_t id);
+const char *gpt_partition_type_mountpoint_nulstr(sd_id128_t id);
+
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);