aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2023-09-02 09:35:22 +0200
committerTom Rini <trini@konsulko.com>2023-09-11 16:29:43 -0400
commit396f315520bcbcc2b710ab696326b239577c1ad2 (patch)
tree557b61bce4a900db4fd84bf1c31d7ccd5ff601ff /cmd
parent782c7f1bdb0a25e1851a47ff1aba9f71162c2f9d (diff)
downloadu-boot-396f315520bcbcc2b710ab696326b239577c1ad2.zip
u-boot-396f315520bcbcc2b710ab696326b239577c1ad2.tar.gz
u-boot-396f315520bcbcc2b710ab696326b239577c1ad2.tar.bz2
cmd: gpt: use UUID accessor more consistently
disk_partition_uuid() and disk_partition_set_uuid() were introduced to let us avoid the usage of #ifdef when dealing with the field uuid of struct disk_partition. In allocate_disk_part() commit c5f1d005f517 ("part: Add accessors for struct disk_partition uuid") missed to use the setter. print_gpt_info() and create_gpt_partitions_list() are further functions where we should use the getter. Fixes: c5f1d005f517 ("part: Add accessors for struct disk_partition uuid") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gpt.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/cmd/gpt.c b/cmd/gpt.c
index d4068ee..96cd8ef 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -220,10 +220,9 @@ static struct disk_part *allocate_disk_part(struct disk_partition *info,
UUID_STR_LEN);
newpart->gpt_part_info.type_guid[UUID_STR_LEN] = '\0';
#endif
- if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) {
- strlcpy(newpart->gpt_part_info.uuid, disk_partition_uuid(info),
- UUID_STR_LEN + 1);
- }
+ if (IS_ENABLED(CONFIG_PARTITION_UUIDS))
+ disk_partition_set_uuid(&newpart->gpt_part_info,
+ disk_partition_uuid(info));
newpart->partnum = partnum;
return newpart;
@@ -262,9 +261,9 @@ static void print_gpt_info(void)
#ifdef CONFIG_PARTITION_TYPE_GUID
printf("Type GUID %s\n", curr->gpt_part_info.type_guid);
#endif
-#ifdef CONFIG_PARTITION_UUIDS
- printf("UUID %s\n", curr->gpt_part_info.uuid);
-#endif
+ if (CONFIG_IS_ENABLED(PARTITION_UUIDS))
+ printf("UUID %s\n",
+ disk_partition_uuid(&curr->gpt_part_info));
printf("\n");
}
}
@@ -314,9 +313,12 @@ static int create_gpt_partitions_list(int numparts, const char *guid,
strncat(partitions_list, curr->gpt_part_info.type_guid,
UUID_STR_LEN + 1);
#endif
- strcat(partitions_list, ",uuid=");
- strncat(partitions_list, curr->gpt_part_info.uuid,
- UUID_STR_LEN + 1);
+ if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) {
+ strcat(partitions_list, ",uuid=");
+ strncat(partitions_list,
+ disk_partition_uuid(&curr->gpt_part_info),
+ UUID_STR_LEN + 1);
+ }
if (curr->gpt_part_info.bootable & PART_BOOTABLE)
strcat(partitions_list, ",bootable");
strcat(partitions_list, ";");