aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-11-08 19:12:25 -0500
committerJens Axboe <axboe@kernel.dk>2012-11-23 08:28:53 -0500
commit1ad7e89940d5ac411928189e1a4a01901dbf590f (patch)
tree64bfe2bceb4d157320465d529869783443e031bf /block
parentd48c152a41c8cd6de832397b4ea6f0429ad86318 (diff)
block: store partition_meta_info.uuid as a string
This will allow other types of UUID to be stored here, aside from true UUIDs. This also simplifies code that uses this field, since it's usually constructed from a, used as a, or compared to other, strings. Note: A simplistic approach here would be to set uuid_str[36]=0 whenever a /PARTNROFF option was found to be present. However, this modifies the input string, and causes subsequent calls to devt_from_partuuid() not to see the /PARTNROFF option, which causes different results. In order to avoid misleading future maintainers, this parameter is marked const. Signed-off-by: Stephen Warren <swarren@nvidia.com> Cc: Tejun Heo <tj@kernel.org> Cc: Will Drewry <wad@chromium.org> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/genhd.c8
-rw-r--r--block/partitions/efi.c7
2 files changed, 2 insertions, 13 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 6cace663a80e..b281f3a2d26a 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -743,7 +743,6 @@ void __init printk_all_partitions(void)
743 struct hd_struct *part; 743 struct hd_struct *part;
744 char name_buf[BDEVNAME_SIZE]; 744 char name_buf[BDEVNAME_SIZE];
745 char devt_buf[BDEVT_SIZE]; 745 char devt_buf[BDEVT_SIZE];
746 char uuid_buf[PARTITION_META_INFO_UUIDLTH * 2 + 5];
747 746
748 /* 747 /*
749 * Don't show empty devices or things that have been 748 * Don't show empty devices or things that have been
@@ -762,16 +761,11 @@ void __init printk_all_partitions(void)
762 while ((part = disk_part_iter_next(&piter))) { 761 while ((part = disk_part_iter_next(&piter))) {
763 bool is_part0 = part == &disk->part0; 762 bool is_part0 = part == &disk->part0;
764 763
765 uuid_buf[0] = '\0';
766 if (part->info)
767 snprintf(uuid_buf, sizeof(uuid_buf), "%pU",
768 part->info->uuid);
769
770 printk("%s%s %10llu %s %s", is_part0 ? "" : " ", 764 printk("%s%s %10llu %s %s", is_part0 ? "" : " ",
771 bdevt_str(part_devt(part), devt_buf), 765 bdevt_str(part_devt(part), devt_buf),
772 (unsigned long long)part_nr_sects_read(part) >> 1 766 (unsigned long long)part_nr_sects_read(part) >> 1
773 , disk_name(disk, part->partno, name_buf), 767 , disk_name(disk, part->partno, name_buf),
774 uuid_buf); 768 part->info ? part->info->uuid : "");
775 if (is_part0) { 769 if (is_part0) {
776 if (disk->driverfs_dev != NULL && 770 if (disk->driverfs_dev != NULL &&
777 disk->driverfs_dev->driver != NULL) 771 disk->driverfs_dev->driver != NULL)
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index 6296b403c67a..b62fb88b8711 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -620,7 +620,6 @@ int efi_partition(struct parsed_partitions *state)
620 gpt_entry *ptes = NULL; 620 gpt_entry *ptes = NULL;
621 u32 i; 621 u32 i;
622 unsigned ssz = bdev_logical_block_size(state->bdev) / 512; 622 unsigned ssz = bdev_logical_block_size(state->bdev) / 512;
623 u8 unparsed_guid[37];
624 623
625 if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) { 624 if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) {
626 kfree(gpt); 625 kfree(gpt);
@@ -649,11 +648,7 @@ int efi_partition(struct parsed_partitions *state)
649 state->parts[i + 1].flags = ADDPART_FLAG_RAID; 648 state->parts[i + 1].flags = ADDPART_FLAG_RAID;
650 649
651 info = &state->parts[i + 1].info; 650 info = &state->parts[i + 1].info;
652 /* Instead of doing a manual swap to big endian, reuse the 651 efi_guid_unparse(&ptes[i].unique_partition_guid, info->uuid);
653 * common ASCII hex format as the interim.
654 */
655 efi_guid_unparse(&ptes[i].unique_partition_guid, unparsed_guid);
656 part_pack_uuid(unparsed_guid, info->uuid);
657 652
658 /* Naively convert UTF16-LE to 7 bits. */ 653 /* Naively convert UTF16-LE to 7 bits. */
659 label_max = min(sizeof(info->volname) - 1, 654 label_max = min(sizeof(info->volname) - 1,