return 0;
}
+static char
+*udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02",
+ "NSR03", "TEA01", 0 };
+
+static int probe_udf(int fd, blkid_cache cache, blkid_dev dev,
+ struct blkid_magic *id, unsigned char *buf)
+{
+ int j, bs;
+ struct iso_volume_descriptor isosb;
+ char **m;
+
+ /* determine the block size by scanning in 2K increments
+ (block sizes larger than 2K will be null padded) */
+ for (bs = 1; bs < 16; bs++) {
+ lseek(fd, bs*2048+32768, SEEK_SET);
+ if (read(fd, (char *)&isosb, sizeof(isosb)) != sizeof(isosb))
+ return 1;
+ if (isosb.id[0])
+ break;
+ }
+
+ /* Scan up to another 64 blocks looking for additional VSD's */
+ for (j = 1; j < 64; j++) {
+ if (j > 1) {
+ lseek(fd, j*bs*2048+32768, SEEK_SET);
+ if (read(fd, (char *)&isosb, sizeof(isosb))
+ != sizeof(isosb))
+ return 1;
+ }
+ /* If we find NSR0x then call it udf:
+ NSR01 for UDF 1.00
+ NSR02 for UDF 1.50
+ NSR03 for UDF 2.00 */
+ if (!strncmp(isosb.id, "NSR0", 4))
+ return 0;
+ for (m = udf_magic; *m; m++)
+ if (!strncmp(*m, isosb.id, 5))
+ break;
+ if (*m == 0)
+ return 1;
+ }
+ return 1;
+}
+
/*
* BLKID_BLK_OFFS is at least as large as the highest bim_kboff defined
* in the type_array table below + bim_kbalign.
{ "bfs", 0, 0, 4, "\316\372\173\033", 0 },
{ "cramfs", 0, 0, 4, "E=\315\034", 0 },
{ "qnx4", 0, 4, 6, "QNX4FS", 0 },
+ { "udf", 32, 1, 5, "BEA01", probe_udf },
+ { "udf", 32, 1, 5, "BOOT2", probe_udf },
+ { "udf", 32, 1, 5, "CD001", probe_udf },
+ { "udf", 32, 1, 5, "CDW02", probe_udf },
+ { "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 },
- { "udf", 32, 1, 5, "BEA01", 0 },
- { "udf", 32, 1, 5, "BOOT2", 0 },
- { "udf", 32, 1, 5, "CD001", 0 },
- { "udf", 32, 1, 5, "CDW02", 0 },
- { "udf", 32, 1, 5, "NSR02", 0 },
- { "udf", 32, 1, 5, "NSR03", 0 },
- { "udf", 32, 1, 5, "TEA01", 0 },
{ "jfs", 32, 0, 4, "JFS1", probe_jfs },
{ "hfs", 1, 0, 2, "BD", 0 },
{ "ufs", 8, 0x55c, 4, "T\031\001\000", 0 },