chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
68d5578
)
volume_id: rename UUID_64BIT_LE/BE
author
Kay Sievers
<kay.sievers@vrfy.org>
Sun, 6 May 2007 00:23:48 +0000
(
02:23
+0200)
committer
Kay Sievers
<kay.sievers@vrfy.org>
Sun, 6 May 2007 00:23:48 +0000
(
02:23
+0200)
extras/volume_id/lib/hfs.c
patch
|
blob
|
history
extras/volume_id/lib/ntfs.c
patch
|
blob
|
history
extras/volume_id/lib/util.c
patch
|
blob
|
history
extras/volume_id/lib/util.h
patch
|
blob
|
history
diff --git
a/extras/volume_id/lib/hfs.c
b/extras/volume_id/lib/hfs.c
index 8156008f6136e910116e171265b529fe38804626..70a6b4ae2cf8b5b3bc1c69f6f06586b7f204c4cb 100644
(file)
--- a/
extras/volume_id/lib/hfs.c
+++ b/
extras/volume_id/lib/hfs.c
@@
-160,7
+160,7
@@
static void hfsid_set_uuid(struct volume_id *id, const uint8_t *hfs_id)
volume_id_set_uuid(id, uuid, UUID_DCE);
#endif
volume_id_set_uuid(id, uuid, UUID_DCE);
#endif
- volume_id_set_uuid(id, hfs_id, 0, UUID_
HFS
);
+ volume_id_set_uuid(id, hfs_id, 0, UUID_
64BIT_BE
);
}
int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size)
}
int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size)
diff --git
a/extras/volume_id/lib/ntfs.c
b/extras/volume_id/lib/ntfs.c
index 6e91db687b53caa54cae3cdf25eddbd9a10e9762..9262454321b8607bf4be99abbbc5bf0cd33b6ae6 100644
(file)
--- a/
extras/volume_id/lib/ntfs.c
+++ b/
extras/volume_id/lib/ntfs.c
@@
-114,7
+114,7
@@
int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size)
if (memcmp(ns->oem_id, "NTFS", 4) != 0)
return -1;
if (memcmp(ns->oem_id, "NTFS", 4) != 0)
return -1;
- volume_id_set_uuid(id, ns->volume_serial, 0, UUID_
NTFS
);
+ volume_id_set_uuid(id, ns->volume_serial, 0, UUID_
64BIT_LE
);
sector_size = le16_to_cpu(ns->bytes_per_sector);
cluster_size = ns->sectors_per_cluster * sector_size;
sector_size = le16_to_cpu(ns->bytes_per_sector);
cluster_size = ns->sectors_per_cluster * sector_size;
diff --git
a/extras/volume_id/lib/util.c
b/extras/volume_id/lib/util.c
index d65fc2c1d653b1be6668c95eb97a2410d65ae88c..54d9fd0d80ce237fb4a4a3961a8c463823d50936 100644
(file)
--- a/
extras/volume_id/lib/util.c
+++ b/
extras/volume_id/lib/util.c
@@
-1,7
+1,7
@@
/*
* volume_id - reads filesystem label and uuid
*
/*
* volume_id - reads filesystem label and uuid
*
- * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2005
-2007
Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@
-124,22
+124,22
@@
void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, en
len = sizeof(id->uuid_raw);
switch(format) {
len = sizeof(id->uuid_raw);
switch(format) {
+ case UUID_STRING:
+ count = len;
+ break;
+ case UUID_HEX_STRING:
+ count = len;
+ break;
case UUID_DOS:
count = 4;
break;
case UUID_DOS:
count = 4;
break;
- case UUID_
NTFS
:
- case UUID_
HFS
:
+ case UUID_
64BIT_LE
:
+ case UUID_
64BIT_BE
:
count = 8;
break;
case UUID_DCE:
count = 16;
break;
count = 8;
break;
case UUID_DCE:
count = 16;
break;
- case UUID_HEX_STRING:
- count = len;
- break;
- case UUID_STRING:
- count = len;
- break;
case UUID_FOURINT:
count = 35;
break;
case UUID_FOURINT:
count = 35;
break;
@@
-159,12
+159,12
@@
set:
sprintf(id->uuid, "%02X%02X-%02X%02X",
buf[3], buf[2], buf[1], buf[0]);
break;
sprintf(id->uuid, "%02X%02X-%02X%02X",
buf[3], buf[2], buf[1], buf[0]);
break;
- case UUID_
NTFS
:
+ case UUID_
64BIT_LE
:
sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X",
buf[7], buf[6], buf[5], buf[4],
buf[3], buf[2], buf[1], buf[0]);
break;
sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X",
buf[7], buf[6], buf[5], buf[4],
buf[3], buf[2], buf[1], buf[0]);
break;
- case UUID_
HFS
:
+ case UUID_
64BIT_BE
:
sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X",
buf[0], buf[1], buf[2], buf[3],
buf[4], buf[5], buf[6], buf[7]);
sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X",
buf[0], buf[1], buf[2], buf[3],
buf[4], buf[5], buf[6], buf[7]);
@@
-179,8
+179,11
@@
set:
buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]);
break;
case UUID_HEX_STRING:
buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]);
break;
case UUID_HEX_STRING:
+ /* translate A..F to a..f */
+ memcpy(id->uuid, buf, count);
for (i = 0; i < count; i++)
for (i = 0; i < count; i++)
- id->uuid[i] = tolower(buf[i]);
+ if (id->uuid[i] >= 'A' && id->uuid[i] <= 'F')
+ id->uuid[i] = (id->uuid[i] - 'A') + 'a';
id->uuid[count] = '\0';
break;
case UUID_STRING:
id->uuid[count] = '\0';
break;
case UUID_STRING:
diff --git
a/extras/volume_id/lib/util.h
b/extras/volume_id/lib/util.h
index cd8dac557c1df727d889aa8f8cd3afa912a0e10e..1206116ce2e26e7c261401f1a3900f5f33b3dbde 100644
(file)
--- a/
extras/volume_id/lib/util.h
+++ b/
extras/volume_id/lib/util.h
@@
-63,12
+63,12
@@
#endif /* __BYTE_ORDER */
enum uuid_format {
#endif /* __BYTE_ORDER */
enum uuid_format {
- UUID_HEX_STRING,
UUID_STRING,
UUID_STRING,
+ UUID_HEX_STRING,
UUID_DCE,
UUID_DOS,
UUID_DCE,
UUID_DOS,
- UUID_
NTFS
,
- UUID_
HFS
,
+ UUID_
64BIT_LE
,
+ UUID_
64BIT_BE
,
UUID_FOURINT,
};
UUID_FOURINT,
};