summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rw-r--r--extras/volume_id/lib/ext.c2
-rw-r--r--extras/volume_id/lib/fat.c4
-rw-r--r--extras/volume_id/lib/hfs.c2
-rw-r--r--extras/volume_id/lib/jfs.c2
-rw-r--r--extras/volume_id/lib/linux_raid.c6
-rw-r--r--extras/volume_id/lib/linux_swap.c2
-rw-r--r--extras/volume_id/lib/luks.c10
-rw-r--r--extras/volume_id/lib/netware.c2
-rw-r--r--extras/volume_id/lib/ntfs.c2
-rw-r--r--extras/volume_id/lib/ocfs.c4
-rw-r--r--extras/volume_id/lib/reiserfs.c4
-rw-r--r--extras/volume_id/lib/util.c19
-rw-r--r--extras/volume_id/lib/util.h5
-rw-r--r--extras/volume_id/lib/volume_id.c3
-rw-r--r--extras/volume_id/lib/xfs.c2
15 files changed, 41 insertions, 28 deletions
diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c
index 8b3af3aab0..e5f1e22f6e 100644
--- a/extras/volume_id/lib/ext.c
+++ b/extras/volume_id/lib/ext.c
@@ -93,7 +93,7 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size)
volume_id_set_label_raw(id, es->s_volume_name, 16);
volume_id_set_label_string(id, es->s_volume_name, 16);
- volume_id_set_uuid(id, es->s_uuid, UUID_DCE);
+ volume_id_set_uuid(id, es->s_uuid, 0, UUID_DCE);
snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u",
le32_to_cpu(es->s_rev_level), le16_to_cpu(es->s_minor_rev_level));
diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c
index 9a2e4784d8..6ed16ccee0 100644
--- a/extras/volume_id/lib/fat.c
+++ b/extras/volume_id/lib/fat.c
@@ -288,7 +288,7 @@ magic:
volume_id_set_label_raw(id, vs->type.fat.label, 11);
volume_id_set_label_string(id, vs->type.fat.label, 11);
}
- volume_id_set_uuid(id, vs->type.fat.serno, UUID_DOS);
+ volume_id_set_uuid(id, vs->type.fat.serno, 0, UUID_DOS);
goto found;
fat32:
@@ -366,7 +366,7 @@ fat32:
volume_id_set_label_raw(id, vs->type.fat32.label, 11);
volume_id_set_label_string(id, vs->type.fat32.label, 11);
}
- volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS);
+ volume_id_set_uuid(id, vs->type.fat32.serno, 0, UUID_DOS);
found:
volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c
index 303ad6b041..8156008f61 100644
--- 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, hfs_id, UUID_HFS);
+ volume_id_set_uuid(id, hfs_id, 0, UUID_HFS);
}
int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size)
diff --git a/extras/volume_id/lib/jfs.c b/extras/volume_id/lib/jfs.c
index 6d4124cd05..00b66cccc7 100644
--- a/extras/volume_id/lib/jfs.c
+++ b/extras/volume_id/lib/jfs.c
@@ -56,7 +56,7 @@ int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size)
volume_id_set_label_raw(id, js->label, 16);
volume_id_set_label_string(id, js->label, 16);
- volume_id_set_uuid(id, js->uuid, UUID_DCE);
+ volume_id_set_uuid(id, js->uuid, 0, UUID_DCE);
volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
id->type = "jfs";
diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c
index 6f37e2a358..6d1d19cb74 100644
--- a/extras/volume_id/lib/linux_raid.c
+++ b/extras/volume_id/lib/linux_raid.c
@@ -87,7 +87,7 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6
uuid.ints[2] = 0;
uuid.ints[3] = 0;
}
- volume_id_set_uuid(id, uuid.bytes, UUID_FOURINT);
+ volume_id_set_uuid(id, uuid.bytes, 0, UUID_FOURINT);
snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u",
le32_to_cpu(mdp0->major_version),
le32_to_cpu(mdp0->minor_version),
@@ -103,7 +103,7 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6
uuid.ints[2] = 0;
uuid.ints[3] = 0;
}
- volume_id_set_uuid(id, uuid.bytes, UUID_FOURINT);
+ volume_id_set_uuid(id, uuid.bytes, 0, UUID_FOURINT);
snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u",
be32_to_cpu(mdp0->major_version),
be32_to_cpu(mdp0->minor_version),
@@ -131,7 +131,7 @@ static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint6
if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC)
return -1;
- volume_id_set_uuid(id, mdp1->set_uuid, UUID_FOURINT);
+ volume_id_set_uuid(id, mdp1->set_uuid, 0, UUID_FOURINT);
volume_id_set_label_raw(id, mdp1->set_name, 32);
volume_id_set_label_string(id, mdp1->set_name, 32);
snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le32_to_cpu(mdp1->major_version));
diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c
index 8aca564d72..50d43ccce6 100644
--- a/extras/volume_id/lib/linux_swap.c
+++ b/extras/volume_id/lib/linux_swap.c
@@ -81,7 +81,7 @@ found_label:
if (sw != NULL) {
volume_id_set_label_raw(id, sw->volume_name, 16);
volume_id_set_label_string(id, sw->volume_name, 16);
- volume_id_set_uuid(id, sw->uuid, UUID_DCE);
+ volume_id_set_uuid(id, sw->uuid, 0, UUID_DCE);
}
found:
diff --git a/extras/volume_id/lib/luks.c b/extras/volume_id/lib/luks.c
index a141a0f5c3..231374e507 100644
--- a/extras/volume_id/lib/luks.c
+++ b/extras/volume_id/lib/luks.c
@@ -36,10 +36,10 @@
#define LUKS_SALTSIZE 32
#define LUKS_NUMKEYS 8
+#define LUKS_MAGIC_L 6
+#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1)
+#define UUID_STRING_L 40
static const uint8_t LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe};
-#define LUKS_MAGIC_L 6
-#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1)
-#define UUID_STRING_L 40
struct luks_phdr {
uint8_t magic[LUKS_MAGIC_L];
@@ -74,9 +74,7 @@ int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size)
return -1;
volume_id_set_usage(id, VOLUME_ID_CRYPTO);
- volume_id_set_uuid(id, header->uuid, UUID_DCE_STRING);
-
+ volume_id_set_uuid(id, header->uuid, 36, UUID_HEX_STRING);
id->type = "crypto_LUKS";
-
return 0;
}
diff --git a/extras/volume_id/lib/netware.c b/extras/volume_id/lib/netware.c
index 67af561331..4d157aaf5d 100644
--- a/extras/volume_id/lib/netware.c
+++ b/extras/volume_id/lib/netware.c
@@ -91,7 +91,7 @@ int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size)
if (memcmp(nw->SBH_Signature, "SPB5", 4) != 0)
return -1;
- volume_id_set_uuid(id, nw->SBH_PoolID, UUID_DCE);
+ volume_id_set_uuid(id, nw->SBH_PoolID, 0, UUID_DCE);
snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%02u",
le16_to_cpu(nw->SBH_VersionMediaMajor), le16_to_cpu(nw->SBH_VersionMediaMinor));
diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c
index f7675a3434..6e91db687b 100644
--- 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;
- volume_id_set_uuid(id, ns->volume_serial, UUID_NTFS);
+ volume_id_set_uuid(id, ns->volume_serial, 0, UUID_NTFS);
sector_size = le16_to_cpu(ns->bytes_per_sector);
cluster_size = ns->sectors_per_cluster * sector_size;
diff --git a/extras/volume_id/lib/ocfs.c b/extras/volume_id/lib/ocfs.c
index 349527b7e0..9f251f1794 100644
--- a/extras/volume_id/lib/ocfs.c
+++ b/extras/volume_id/lib/ocfs.c
@@ -156,7 +156,7 @@ int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size)
volume_id_set_label_string(id, osl->label, 64);
}
if (osl->vol_id_len == 16)
- volume_id_set_uuid(id, osl->vol_id, UUID_DCE);
+ volume_id_set_uuid(id, osl->vol_id, 0, UUID_DCE);
id->type = "ocfs";
return 0;
}
@@ -184,7 +184,7 @@ int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size)
volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
volume_id_set_label_raw(id, os->s_label, 64);
volume_id_set_label_string(id, os->s_label, 64);
- volume_id_set_uuid(id, os->s_uuid, UUID_DCE);
+ volume_id_set_uuid(id, os->s_uuid, 0, UUID_DCE);
snprintf(id->type_version, sizeof(id->type_version)-1,
"%u.%u", os->s_major_rev_level, os->s_minor_rev_level);
id->type = "ocfs2";
diff --git a/extras/volume_id/lib/reiserfs.c b/extras/volume_id/lib/reiserfs.c
index 1f219e5bde..18db63817a 100644
--- a/extras/volume_id/lib/reiserfs.c
+++ b/extras/volume_id/lib/reiserfs.c
@@ -88,7 +88,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size)
strcpy(id->type_version, "4");
volume_id_set_label_raw(id, rs4->label, 16);
volume_id_set_label_string(id, rs4->label, 16);
- volume_id_set_uuid(id, rs4->uuid, UUID_DCE);
+ volume_id_set_uuid(id, rs4->uuid, 0, UUID_DCE);
id->type = "reiser4";
goto found;
}
@@ -109,7 +109,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size)
found_label:
volume_id_set_label_raw(id, rs->label, 16);
volume_id_set_label_string(id, rs->label, 16);
- volume_id_set_uuid(id, rs->uuid, UUID_DCE);
+ volume_id_set_uuid(id, rs->uuid, 0, UUID_DCE);
found:
volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c
index 762e84e170..d65fc2c1d6 100644
--- 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);
}
-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;
+ if (len > sizeof(id->uuid_raw))
+ len = sizeof(id->uuid_raw);
+
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_STRING:
- count = 36;
+ case UUID_HEX_STRING:
+ count = len;
+ break;
+ case UUID_STRING:
+ count = len;
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;
- 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;
diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h
index 964e70196a..cd8dac557c 100644
--- a/extras/volume_id/lib/util.h
+++ b/extras/volume_id/lib/util.h
@@ -63,7 +63,8 @@
#endif /* __BYTE_ORDER */
enum uuid_format {
- UUID_DCE_STRING,
+ UUID_HEX_STRING,
+ UUID_STRING,
UUID_DCE,
UUID_DOS,
UUID_NTFS,
@@ -81,7 +82,7 @@ extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage
extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count);
extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count);
extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count);
-extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format);
+extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format);
extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len);
extern void volume_id_free_buffer(struct volume_id *id);
diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c
index bf009c7203..a66b4a5769 100644
--- a/extras/volume_id/lib/volume_id.c
+++ b/extras/volume_id/lib/volume_id.c
@@ -146,6 +146,9 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size)
if (volume_id_probe_linux_raid(id, off, size) == 0)
goto found;
+ if (volume_id_probe_ddf_raid(id, off, size) == 0)
+ goto found;
+
if (volume_id_probe_intel_software_raid(id, off, size) == 0)
goto found;
diff --git a/extras/volume_id/lib/xfs.c b/extras/volume_id/lib/xfs.c
index 5c1a82e1d3..9eac8273c8 100644
--- a/extras/volume_id/lib/xfs.c
+++ b/extras/volume_id/lib/xfs.c
@@ -56,7 +56,7 @@ int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size)
volume_id_set_label_raw(id, xs->fname, 12);
volume_id_set_label_string(id, xs->fname, 12);
- volume_id_set_uuid(id, xs->uuid, UUID_DCE);
+ volume_id_set_uuid(id, xs->uuid, 0, UUID_DCE);
volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
id->type = "xfs";