chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
volume_id: add internal UUID_STRING
[elogind.git]
/
extras
/
volume_id
/
lib
/
util.c
diff --git
a/extras/volume_id/lib/util.c
b/extras/volume_id/lib/util.c
index 762e84e170ca19eb7b1f492beb79eda9545febc9..d65fc2c1d653b1be6668c95eb97a2410d65ae88c 100644
(file)
--- a/
extras/volume_id/lib/util.c
+++ b/
extras/volume_id/lib/util.c
@@
-115,11
+115,14
@@
void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enu
volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count);
}
volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count);
}
-void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format)
+void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf,
size_t len,
enum uuid_format format)
{
unsigned int i;
unsigned int count = 0;
{
unsigned int i;
unsigned int count = 0;
+ if (len > sizeof(id->uuid_raw))
+ len = sizeof(id->uuid_raw);
+
switch(format) {
case UUID_DOS:
count = 4;
switch(format) {
case UUID_DOS:
count = 4;
@@
-131,8
+134,11
@@
void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_form
case UUID_DCE:
count = 16;
break;
case UUID_DCE:
count = 16;
break;
- case UUID_DCE_STRING:
- count = 36;
+ case UUID_HEX_STRING:
+ count = len;
+ break;
+ case UUID_STRING:
+ count = len;
break;
case UUID_FOURINT:
count = 35;
break;
case UUID_FOURINT:
count = 35;
@@
-172,7
+178,12
@@
set:
buf[8], buf[9],
buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]);
break;
buf[8], buf[9],
buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]);
break;
- case UUID_DCE_STRING:
+ case UUID_HEX_STRING:
+ for (i = 0; i < count; i++)
+ id->uuid[i] = tolower(buf[i]);
+ id->uuid[count] = '\0';
+ break;
+ case UUID_STRING:
memcpy(id->uuid, buf, count);
id->uuid[count] = '\0';
break;
memcpy(id->uuid, buf, count);
id->uuid[count] = '\0';
break;