lib/uuid.c: use unique name for PARTITION_SYSTEM_GUID

The name defined for PARTITION_SYSTEM_GUID in list_guid[] depends on
configuration options. It is "system" if CONFIG_PARTITION_TYPE_GUID is
enabled or "System Partition" if CONFIG_CMD_EFIDEBUG or CONFIG_EFI are
enabled. In addition, the unit test in test/common/print.c is incorrect
because it expects only "system" (or a hex GUID).

Make things more consistent by using a clear and unique name: "EFI
System Partition" whatever the configuration, and update the unit test
accordingly.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Jerome Forissier 2025-04-16 09:48:20 +02:00 committed by Tom Rini
parent 8c98b57d72
commit d54e1004b8
2 changed files with 8 additions and 9 deletions

View File

@ -67,8 +67,11 @@ static const struct {
efi_guid_t guid; efi_guid_t guid;
} list_guid[] = { } list_guid[] = {
#ifndef USE_HOSTCC #ifndef USE_HOSTCC
#if defined(CONFIG_PARTITION_TYPE_GUID) || defined(CONFIG_CMD_EFIDEBUG) || \
defined(CONFIG_EFI)
{"EFI System Partition", PARTITION_SYSTEM_GUID},
#endif
#ifdef CONFIG_PARTITION_TYPE_GUID #ifdef CONFIG_PARTITION_TYPE_GUID
{"system", PARTITION_SYSTEM_GUID},
{"mbr", LEGACY_MBR_PARTITION_GUID}, {"mbr", LEGACY_MBR_PARTITION_GUID},
{"msft", PARTITION_MSFT_RESERVED_GUID}, {"msft", PARTITION_MSFT_RESERVED_GUID},
{"data", PARTITION_BASIC_DATA_GUID}, {"data", PARTITION_BASIC_DATA_GUID},
@ -182,10 +185,6 @@ static const struct {
{ {
"TCG2", "TCG2",
EFI_TCG2_PROTOCOL_GUID, EFI_TCG2_PROTOCOL_GUID,
},
{
"System Partition",
PARTITION_SYSTEM_GUID
}, },
{ {
"Firmware Management", "Firmware Management",

View File

@ -45,11 +45,11 @@ static int print_guid(struct unit_test_state *uts)
sprintf(str, "%pUL", guid); sprintf(str, "%pUL", guid);
ut_asserteq_str("04030201-0605-0807-090A-0B0C0D0E0F10", str); ut_asserteq_str("04030201-0605-0807-090A-0B0C0D0E0F10", str);
sprintf(str, "%pUs", guid_esp); sprintf(str, "%pUs", guid_esp);
if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) { /* brace needed */ if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID) ||
ut_asserteq_str("system", str); IS_ENABLED(CONFIG_CMD_EFIDEBUG) || IS_ENABLED(CONFIG_EFI))
} else { ut_asserteq_str("EFI System Partition", str);
else
ut_asserteq_str("c12a7328-f81f-11d2-ba4b-00a0c93ec93b", str); ut_asserteq_str("c12a7328-f81f-11d2-ba4b-00a0c93ec93b", str);
}
ret = snprintf(str, 4, "%pUL", guid); ret = snprintf(str, 4, "%pUL", guid);
ut_asserteq(0, str[3]); ut_asserteq(0, str[3]);
ut_asserteq(36, ret); ut_asserteq(36, ret);