#include "uuid/uuid.h"
#include "probe.h"
+static int figure_label_len(const unsigned char *label, int len)
+{
+ const unsigned char *end = label + len - 1;
+
+ while ((*end == ' ' || *end == 0) && end >= label)
+ --end;
+ if (end >= label) {
+ label = label;
+ return end - label + 1;
+ }
+ return 0;
+}
+
/*
* This is a special case code to check for an MDRAID device. We do
* this special since it requires checking for a superblock at the end
}
if (vol_label && memcmp(vol_label, "NO NAME ", 11)) {
- const char *end = vol_label + 10;
-
- while (*end == ' ' && end >= vol_label)
- --end;
- if (end >= vol_label) {
- label = vol_label;
- label_len = end - vol_label + 1;
- }
+ label = vol_label;
+ label_len = figure_label_len(vol_label, 11);
}
/* We can't just print them as %04X, because they are unaligned */
return 0;
}
+static int probe_iso9660(int fd, blkid_cache cache __BLKID_ATTR((unused)),
+ blkid_dev dev __BLKID_ATTR((unused)),
+ struct blkid_magic *id __BLKID_ATTR((unused)),
+ unsigned char *buf)
+{
+ struct iso_volume_descriptor *iso;
+ const unsigned char *label;
+
+ iso = (struct iso_volume_descriptor *) buf;
+
+ label = iso->volume_id;
+
+ blkid_set_tag(dev, "LABEL", label, figure_label_len(label, 32));
+ return 0;
+}
+
+
static const char
*udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02",
"NSR03", "TEA01", 0 };
lseek(fd, bs*2048+32768, SEEK_SET);
if (read(fd, (char *)&isosb, sizeof(isosb)) != sizeof(isosb))
return 1;
- if (isosb.id[0])
+ if (isosb.vd_id[0])
break;
}
NSR01 for UDF 1.00
NSR02 for UDF 1.50
NSR03 for UDF 2.00 */
- if (!strncmp(isosb.id, "NSR0", 4))
+ if (!strncmp(isosb.vd_id, "NSR0", 4))
return 0;
for (m = udf_magic; *m; m++)
- if (!strncmp(*m, isosb.id, 5))
+ if (!strncmp(*m, isosb.vd_id, 5))
break;
if (*m == 0)
return 1;
{ "udf", 32, 1, 5, "NSR02", probe_udf },
{ "udf", 32, 1, 5, "NSR03", probe_udf },
{ "udf", 32, 1, 5, "TEA01", probe_udf },
- { "iso9660", 32, 1, 5, "CD001", 0 },
- { "iso9660", 32, 9, 5, "CDROM", 0 },
+ { "iso9660", 32, 1, 5, "CD001", probe_iso9660 },
+ { "iso9660", 32, 9, 5, "CDROM", probe_iso9660 },
{ "jfs", 32, 0, 4, "JFS1", probe_jfs },
{ "hfs", 1, 0, 2, "BD", 0 },
{ "ufs", 8, 0x55c, 4, "T\031\001\000", 0 },
#define ORACLE_ASM_DISK_LABEL_MARKED "ORCLDISK"
#define ORACLE_ASM_DISK_LABEL_OFFSET 32
-#define ISODCL(from, to) (to - from + 1)
struct iso_volume_descriptor {
- char type[ISODCL(1,1)]; /* 711 */
- char id[ISODCL(2,6)];
- char version[ISODCL(7,7)];
- char data[ISODCL(8,2048)];
+ unsigned char vd_type;
+ unsigned char vd_id[5];
+ unsigned char vd_version;
+ unsigned char flags;
+ unsigned char system_id[32];
+ unsigned char volume_id[32];
+ unsigned char unused[8];
+ unsigned char space_size[8];
+ unsigned char escape_sequences[8];
};
/*