aboutsummaryrefslogtreecommitdiff
path: root/util-linux/volume_id/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/volume_id/util.c')
-rw-r--r--util-linux/volume_id/util.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/util-linux/volume_id/util.c b/util-linux/volume_id/util.c
index 69e43dda8..061545fde 100644
--- a/util-linux/volume_id/util.c
+++ b/util-linux/volume_id/util.c
@@ -129,30 +129,14 @@ void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t
129 129
130void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count) 130void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count)
131{ 131{
132 volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count); 132 volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count);
133} 133}
134 134
135void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format) 135void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format)
136{ 136{
137 unsigned i; 137 unsigned i;
138 unsigned count = 0; 138 unsigned count = (format == UUID_DCE_STRING ? VOLUME_ID_UUID_SIZE : 4 << format);
139 139
140 switch (format) {
141 case UUID_DOS:
142 count = 4;
143 break;
144 case UUID_NTFS:
145 case UUID_HFS:
146 count = 8;
147 break;
148 case UUID_DCE:
149 count = 16;
150 break;
151 case UUID_DCE_STRING:
152 /* 36 is ok, id->uuid has one extra byte for NUL */
153 count = VOLUME_ID_UUID_SIZE;
154 break;
155 }
156// memcpy(id->uuid_raw, buf, count); 140// memcpy(id->uuid_raw, buf, count);
157// id->uuid_raw_len = count; 141// id->uuid_raw_len = count;
158 142
@@ -173,11 +157,6 @@ set:
173 buf[7], buf[6], buf[5], buf[4], 157 buf[7], buf[6], buf[5], buf[4],
174 buf[3], buf[2], buf[1], buf[0]); 158 buf[3], buf[2], buf[1], buf[0]);
175 break; 159 break;
176 case UUID_HFS:
177 sprintf(id->uuid, "%02X%02X%02X%02X%02X%02X%02X%02X",
178 buf[0], buf[1], buf[2], buf[3],
179 buf[4], buf[5], buf[6], buf[7]);
180 break;
181 case UUID_DCE: 160 case UUID_DCE:
182 sprintf(id->uuid, 161 sprintf(id->uuid,
183 "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", 162 "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",