diff options
author | Simon Glass <sjg@chromium.org> | 2023-08-24 13:55:32 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-25 17:55:18 -0400 |
commit | bcd645428c340254a0f6e3b040fd36c3006fab6c (patch) | |
tree | c444be235be60afc52872daca36af79aa7abb5dc /disk | |
parent | c5f1d005f51783a5b34d6164ab66289eb1f4a45b (diff) |
part: Add accessors for struct disk_partition type_uuid
This field is only present when a CONFIG is set. To avoid annoying #ifdefs
in the source code, add accessors. Update all code to use it.
Note that the accessor is optional. It can be omitted if it is known that
the option is enabled.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'disk')
-rw-r--r-- | disk/part.c | 8 | ||||
-rw-r--r-- | disk/part_efi.c | 9 |
2 files changed, 7 insertions, 10 deletions
diff --git a/disk/part.c b/disk/part.c index 91c6ac42cc..72241b7b23 100644 --- a/disk/part.c +++ b/disk/part.c @@ -370,9 +370,7 @@ int part_get_info_by_type(struct blk_desc *desc, int part, int part_type, if (blk_enabled()) { /* The common case is no UUID support */ disk_partition_clr_uuid(info); -#ifdef CONFIG_PARTITION_TYPE_GUID - info->type_guid[0] = 0; -#endif + disk_partition_clr_type_guid(info); if (part_type == PART_TYPE_UNKNOWN) { drv = part_driver_lookup_type(desc); @@ -415,9 +413,7 @@ int part_get_info_whole_disk(struct blk_desc *desc, strcpy((char *)info->type, BOOT_PART_TYPE); strcpy((char *)info->name, "Whole Disk"); disk_partition_clr_uuid(info); -#ifdef CONFIG_PARTITION_TYPE_GUID - info->type_guid[0] = 0; -#endif + disk_partition_clr_type_guid(info); return 0; } diff --git a/disk/part_efi.c b/disk/part_efi.c index a6f7375cd3..2086752138 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -294,10 +294,11 @@ int part_get_info_efi(struct blk_desc *desc, int part, (char *)disk_partition_uuid(info), UUID_STR_FORMAT_GUID); } -#ifdef CONFIG_PARTITION_TYPE_GUID - uuid_bin_to_str(gpt_pte[part - 1].partition_type_guid.b, - info->type_guid, UUID_STR_FORMAT_GUID); -#endif + if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) { + uuid_bin_to_str(gpt_pte[part - 1].partition_type_guid.b, + (char *)disk_partition_type_uuid(info), + UUID_STR_FORMAT_GUID); + } log_debug("start 0x" LBAF ", size 0x" LBAF ", name %s\n", info->start, info->size, info->name); |