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));
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:
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);
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)
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";
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),
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),
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));
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:
#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];
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;
}
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));
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;
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;
}
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";
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;
}
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);
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;
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;
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;
#endif /* __BYTE_ORDER */
enum uuid_format {
- UUID_DCE_STRING,
+ UUID_HEX_STRING,
+ UUID_STRING,
UUID_DCE,
UUID_DOS,
UUID_NTFS,
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);
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;
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";