summaryrefslogtreecommitdiff
path: root/disk
diff options
context:
space:
mode:
authorPrzemyslaw Marczak <p.marczak@samsung.com>2014-04-02 10:20:03 +0200
committerTom Rini <trini@ti.com>2014-04-02 15:44:40 -0400
commitd718ded056eefb6239bd2e0a57b7f6d99c6e9e4b (patch)
tree8bca8bbb10a74b782dc34a2f1b773bb6afa50e75 /disk
parenta96a0e6153e3d9071c1a4516bf3e94c4cd96c77c (diff)
downloadu-boot-d718ded056eefb6239bd2e0a57b7f6d99c6e9e4b.tar.gz
u-boot-d718ded056eefb6239bd2e0a57b7f6d99c6e9e4b.tar.bz2
u-boot-d718ded056eefb6239bd2e0a57b7f6d99c6e9e4b.zip
lib: uuid: code refactor for proper maintain between uuid bin and string
Changes in lib/uuid.c to: - uuid_str_to_bin() - uuid_bin_to_str() New parameter is added to specify input/output string format in listed functions This change allows easy recognize which UUID type is or should be stored in given string array. Binary data of UUID and GUID is always stored in big endian, only string representations are different as follows. String byte: 0 36 String char: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx string UUID: be be be be be string GUID: le le le be be This patch also updates functions calls and declarations in a whole code. Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Stephen Warren <swarren@nvidia.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: trini@ti.com
Diffstat (limited to 'disk')
-rw-r--r--disk/part_efi.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/disk/part_efi.c b/disk/part_efi.c
index a280ab5be5..216a2920c2 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -100,8 +100,8 @@ void print_part_efi(block_dev_desc_t * dev_desc)
printf("Part\tStart LBA\tEnd LBA\t\tName\n");
printf("\tAttributes\n");
- printf("\tType UUID\n");
- printf("\tPartition UUID\n");
+ printf("\tType GUID\n");
+ printf("\tPartition GUID\n");
for (i = 0; i < le32_to_cpu(gpt_head->num_partition_entries); i++) {
/* Stop at the first non valid PTE */
@@ -114,11 +114,11 @@ void print_part_efi(block_dev_desc_t * dev_desc)
print_efiname(&gpt_pte[i]));
printf("\tattrs:\t0x%016llx\n", gpt_pte[i].attributes.raw);
uuid_bin = (unsigned char *)gpt_pte[i].partition_type_guid.b;
- uuid_bin_to_str(uuid_bin, uuid);
+ uuid_bin_to_str(uuid_bin, uuid, UUID_STR_FORMAT_GUID);
printf("\ttype:\t%s\n", uuid);
uuid_bin = (unsigned char *)gpt_pte[i].unique_partition_guid.b;
- uuid_bin_to_str(uuid_bin, uuid);
- printf("\tuuid:\t%s\n", uuid);
+ uuid_bin_to_str(uuid_bin, uuid, UUID_STR_FORMAT_GUID);
+ printf("\tguid:\t%s\n", uuid);
}
/* Remember to free pte */
@@ -165,7 +165,8 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
sprintf((char *)info->type, "U-Boot");
info->bootable = is_bootable(&gpt_pte[part - 1]);
#ifdef CONFIG_PARTITION_UUIDS
- uuid_bin_to_str(gpt_pte[part - 1].unique_partition_guid.b, info->uuid);
+ uuid_bin_to_str(gpt_pte[part - 1].unique_partition_guid.b, info->uuid,
+ UUID_STR_FORMAT_GUID);
#endif
debug("%s: start 0x" LBAF ", size 0x" LBAF ", name %s", __func__,
@@ -323,7 +324,7 @@ int gpt_fill_pte(gpt_header *gpt_h, gpt_entry *gpt_e,
str_uuid = partitions[i].uuid;
bin_uuid = gpt_e[i].unique_partition_guid.b;
- if (uuid_str_to_bin(str_uuid, bin_uuid)) {
+ if (uuid_str_to_bin(str_uuid, bin_uuid, UUID_STR_FORMAT_STD)) {
printf("Partition no. %d: invalid guid: %s\n",
i, str_uuid);
return -1;
@@ -370,7 +371,7 @@ int gpt_fill_header(block_dev_desc_t *dev_desc, gpt_header *gpt_h,
gpt_h->header_crc32 = 0;
gpt_h->partition_entry_array_crc32 = 0;
- if (uuid_str_to_bin(str_guid, gpt_h->disk_guid.b))
+ if (uuid_str_to_bin(str_guid, gpt_h->disk_guid.b, UUID_STR_FORMAT_GUID))
return -1;
return 0;