lib: compile uuid_guid_get_str if CONFIG_LIB_UUID=y

Currently uuid_guid_get_str() is only built if
CONFIG_PARTITION_TYPE_GUID=y.

To make it usable for other GUIDs compile it if CONFIG_LIB_UUID=y.
The linker will take care of removing it if it is unused.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
Heinrich Schuchardt 2022-01-16 11:55:39 +01:00
parent 6a685753ce
commit c1528f324c

View File

@ -86,11 +86,11 @@ int uuid_str_valid(const char *uuid)
return 1; return 1;
} }
#ifdef CONFIG_PARTITION_TYPE_GUID
static const struct { static const struct {
const char *string; const char *string;
efi_guid_t guid; efi_guid_t guid;
} list_guid[] = { } list_guid[] = {
#ifdef CONFIG_PARTITION_TYPE_GUID
{"system", PARTITION_SYSTEM_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},
@ -100,6 +100,7 @@ static const struct {
{"swap", PARTITION_LINUX_SWAP_GUID}, {"swap", PARTITION_LINUX_SWAP_GUID},
{"lvm", PARTITION_LINUX_LVM_GUID}, {"lvm", PARTITION_LINUX_LVM_GUID},
{"u-boot-env", PARTITION_U_BOOT_ENVIRONMENT}, {"u-boot-env", PARTITION_U_BOOT_ENVIRONMENT},
#endif
}; };
/* /*
@ -139,7 +140,6 @@ const char *uuid_guid_get_str(const unsigned char *guid_bin)
} }
return NULL; return NULL;
} }
#endif
/* /*
* uuid_str_to_bin() - convert string UUID or GUID to big endian binary data. * uuid_str_to_bin() - convert string UUID or GUID to big endian binary data.