diff options
author | Simon Glass <sjg@chromium.org> | 2023-08-24 13:55:31 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-25 17:55:18 -0400 |
commit | c5f1d005f51783a5b34d6164ab66289eb1f4a45b (patch) | |
tree | ce2387e3ccb134d02bfd2c458546c420ca886c53 /disk/part_dos.c | |
parent | ade2316da3cd76abe7649d34abb84f1370fb942d (diff) |
part: Add accessors for struct disk_partition 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/part_dos.c')
-rw-r--r-- | disk/part_dos.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/disk/part_dos.c b/disk/part_dos.c index cc050ca8c4..3337438437 100644 --- a/disk/part_dos.c +++ b/disk/part_dos.c @@ -231,10 +231,8 @@ static int part_get_info_extended(struct blk_desc *desc, return -1; } -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - if (!ext_part_sector) + if (CONFIG_IS_ENABLED(PARTITION_UUIDS) && !ext_part_sector) disksig = get_unaligned_le32(&buffer[DOS_PART_DISKSIG_OFFSET]); -#endif ret = part_get_info_whole_disk(desc, &wdinfo); if (ret) @@ -263,9 +261,12 @@ static int part_get_info_extended(struct blk_desc *desc, /* sprintf(info->type, "%d, pt->sys_ind); */ strcpy((char *)info->type, "U-Boot"); info->bootable = get_bootable(pt); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - sprintf(info->uuid, "%08x-%02x", disksig, part_num); -#endif + if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) { + char str[12]; + + sprintf(str, "%08x-%02x", disksig, part_num); + disk_partition_set_uuid(info, str); + } info->sys_ind = pt->sys_ind; return 0; } @@ -302,9 +303,7 @@ static int part_get_info_extended(struct blk_desc *desc, info->blksz = DOS_PART_DEFAULT_SECTOR; info->bootable = 0; strcpy((char *)info->type, "U-Boot"); -#if CONFIG_IS_ENABLED(PARTITION_UUIDS) - info->uuid[0] = 0; -#endif + disk_partition_clr_uuid(info); return 0; } |