diff options
| author | Christoph Hellwig <hch@lst.de> | 2017-05-17 03:38:37 -0400 |
|---|---|---|
| committer | Christoph Hellwig <hch@lst.de> | 2017-06-05 10:59:14 -0400 |
| commit | 59b9c6291c4fcacf2e8290d79560aa78edbbbe2e (patch) | |
| tree | e35c783382f1ca47404a22908e23cb4075ae4521 | |
| parent | 01633fd254182eaa9372efa5c0688bf286e60d6b (diff) | |
partitions/ldm: switch to use uuid_t
And the uuid helpers.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| -rw-r--r-- | block/partitions/ldm.c | 10 | ||||
| -rw-r--r-- | block/partitions/ldm.h | 6 |
2 files changed, 7 insertions, 9 deletions
diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c index edcea70674c9..2a365c756648 100644 --- a/block/partitions/ldm.c +++ b/block/partitions/ldm.c | |||
| @@ -115,7 +115,7 @@ static bool ldm_parse_privhead(const u8 *data, struct privhead *ph) | |||
| 115 | ldm_error("PRIVHEAD disk size doesn't match real disk size"); | 115 | ldm_error("PRIVHEAD disk size doesn't match real disk size"); |
| 116 | return false; | 116 | return false; |
| 117 | } | 117 | } |
| 118 | if (uuid_be_to_bin(data + 0x0030, (uuid_be *)ph->disk_id)) { | 118 | if (uuid_parse(data + 0x0030, &ph->disk_id)) { |
| 119 | ldm_error("PRIVHEAD contains an invalid GUID."); | 119 | ldm_error("PRIVHEAD contains an invalid GUID."); |
| 120 | return false; | 120 | return false; |
| 121 | } | 121 | } |
| @@ -234,7 +234,7 @@ static bool ldm_compare_privheads (const struct privhead *ph1, | |||
| 234 | (ph1->logical_disk_size == ph2->logical_disk_size) && | 234 | (ph1->logical_disk_size == ph2->logical_disk_size) && |
| 235 | (ph1->config_start == ph2->config_start) && | 235 | (ph1->config_start == ph2->config_start) && |
| 236 | (ph1->config_size == ph2->config_size) && | 236 | (ph1->config_size == ph2->config_size) && |
| 237 | !memcmp (ph1->disk_id, ph2->disk_id, GUID_SIZE)); | 237 | uuid_equal(&ph1->disk_id, &ph2->disk_id)); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | /** | 240 | /** |
| @@ -557,7 +557,7 @@ static struct vblk * ldm_get_disk_objid (const struct ldmdb *ldb) | |||
| 557 | 557 | ||
| 558 | list_for_each (item, &ldb->v_disk) { | 558 | list_for_each (item, &ldb->v_disk) { |
| 559 | struct vblk *v = list_entry (item, struct vblk, list); | 559 | struct vblk *v = list_entry (item, struct vblk, list); |
| 560 | if (!memcmp (v->vblk.disk.disk_id, ldb->ph.disk_id, GUID_SIZE)) | 560 | if (uuid_equal(&v->vblk.disk.disk_id, &ldb->ph.disk_id)) |
| 561 | return v; | 561 | return v; |
| 562 | } | 562 | } |
| 563 | 563 | ||
| @@ -892,7 +892,7 @@ static bool ldm_parse_dsk3 (const u8 *buffer, int buflen, struct vblk *vb) | |||
| 892 | disk = &vb->vblk.disk; | 892 | disk = &vb->vblk.disk; |
| 893 | ldm_get_vstr (buffer + 0x18 + r_diskid, disk->alt_name, | 893 | ldm_get_vstr (buffer + 0x18 + r_diskid, disk->alt_name, |
| 894 | sizeof (disk->alt_name)); | 894 | sizeof (disk->alt_name)); |
| 895 | if (uuid_be_to_bin(buffer + 0x19 + r_name, (uuid_be *)disk->disk_id)) | 895 | if (uuid_parse(buffer + 0x19 + r_name, &disk->disk_id)) |
| 896 | return false; | 896 | return false; |
| 897 | 897 | ||
| 898 | return true; | 898 | return true; |
| @@ -927,7 +927,7 @@ static bool ldm_parse_dsk4 (const u8 *buffer, int buflen, struct vblk *vb) | |||
| 927 | return false; | 927 | return false; |
| 928 | 928 | ||
| 929 | disk = &vb->vblk.disk; | 929 | disk = &vb->vblk.disk; |
| 930 | memcpy (disk->disk_id, buffer + 0x18 + r_name, GUID_SIZE); | 930 | uuid_copy(&disk->disk_id, (uuid_t *)(buffer + 0x18 + r_name)); |
| 931 | return true; | 931 | return true; |
| 932 | } | 932 | } |
| 933 | 933 | ||
diff --git a/block/partitions/ldm.h b/block/partitions/ldm.h index 374242c0971a..f4c6055df956 100644 --- a/block/partitions/ldm.h +++ b/block/partitions/ldm.h | |||
| @@ -112,8 +112,6 @@ struct frag { /* VBLK Fragment handling */ | |||
| 112 | 112 | ||
| 113 | /* In memory LDM database structures. */ | 113 | /* In memory LDM database structures. */ |
| 114 | 114 | ||
| 115 | #define GUID_SIZE 16 | ||
| 116 | |||
| 117 | struct privhead { /* Offsets and sizes are in sectors. */ | 115 | struct privhead { /* Offsets and sizes are in sectors. */ |
| 118 | u16 ver_major; | 116 | u16 ver_major; |
| 119 | u16 ver_minor; | 117 | u16 ver_minor; |
| @@ -121,7 +119,7 @@ struct privhead { /* Offsets and sizes are in sectors. */ | |||
| 121 | u64 logical_disk_size; | 119 | u64 logical_disk_size; |
| 122 | u64 config_start; | 120 | u64 config_start; |
| 123 | u64 config_size; | 121 | u64 config_size; |
| 124 | u8 disk_id[GUID_SIZE]; | 122 | uuid_t disk_id; |
| 125 | }; | 123 | }; |
| 126 | 124 | ||
| 127 | struct tocblock { /* We have exactly two bitmaps. */ | 125 | struct tocblock { /* We have exactly two bitmaps. */ |
| @@ -154,7 +152,7 @@ struct vblk_dgrp { /* VBLK Disk Group */ | |||
| 154 | }; | 152 | }; |
| 155 | 153 | ||
| 156 | struct vblk_disk { /* VBLK Disk */ | 154 | struct vblk_disk { /* VBLK Disk */ |
| 157 | u8 disk_id[GUID_SIZE]; | 155 | uuid_t disk_id; |
| 158 | u8 alt_name[128]; | 156 | u8 alt_name[128]; |
| 159 | }; | 157 | }; |
| 160 | 158 | ||
