summaryrefslogtreecommitdiffstats
path: root/libblkid/src/superblocks
diff options
context:
space:
mode:
authorPali Rohár2017-06-14 23:15:14 +0200
committerPali Rohár2017-06-14 23:15:14 +0200
commit501aeb60a4914d8e4b273eb1529d70bc6ffaa077 (patch)
treeedfcd678c0a177ca21f7d04135abdffb83a96146 /libblkid/src/superblocks
parentwall: don't use gid_t when allocate grounps array (diff)
downloadkernel-qcow2-util-linux-501aeb60a4914d8e4b273eb1529d70bc6ffaa077.tar.gz
kernel-qcow2-util-linux-501aeb60a4914d8e4b273eb1529d70bc6ffaa077.tar.xz
kernel-qcow2-util-linux-501aeb60a4914d8e4b273eb1529d70bc6ffaa077.zip
libblkid: udf: Fix detection of UDF images with block size 1024 and 4096
When detecting block size of UDF filesystem, try to use also block size 512, 1024, 2048 and 4096. This would allow blkid to detect UDF filesystem in image file created from 4K hard disk (which should have UDF block size 4096). Before this patch only UDF images with block size of 512 and 2048 were detected as only block size from blkid_probe_get_sectorsize() and 2048 were used (blkid_probe_get_sectorsize() returns for disk images 512).
Diffstat (limited to 'libblkid/src/superblocks')
-rw-r--r--libblkid/src/superblocks/udf.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libblkid/src/superblocks/udf.c b/libblkid/src/superblocks/udf.c
index f908001ad..602cf408e 100644
--- a/libblkid/src/superblocks/udf.c
+++ b/libblkid/src/superblocks/udf.c
@@ -127,7 +127,7 @@ static int probe_udf(blkid_probe pr,
struct volume_descriptor *vd;
struct volume_structure_descriptor *vsd;
unsigned int bs;
- unsigned int pbs[2];
+ unsigned int pbs[5];
unsigned int b;
unsigned int type;
unsigned int count;
@@ -141,9 +141,12 @@ static int probe_udf(blkid_probe pr,
/* The block size of a UDF filesystem is that of the underlying
* storage; we check later on for the special case of image files,
- * which may have the 2048-byte block size of optical media. */
+ * which may have any block size valid for UDF filesystem */
pbs[0] = blkid_probe_get_sectorsize(pr);
- pbs[1] = 0x800;
+ pbs[1] = 512;
+ pbs[2] = 1024;
+ pbs[3] = 2048;
+ pbs[4] = 4096;
/* check for a Volume Structure Descriptor (VSD); each is
* 2048 bytes long */
@@ -168,8 +171,6 @@ nsr:
sizeof(*vsd));
if (!vsd)
return errno ? -errno : 1;
- if (vsd->id[0] == '\0')
- return 1;
if (memcmp(vsd->id, "NSR02", 5) == 0)
goto anchor;
if (memcmp(vsd->id, "NSR03", 5) == 0)
@@ -179,7 +180,7 @@ nsr:
anchor:
/* read Anchor Volume Descriptor (AVDP), checking block size */
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < 5; i++) {
vd = (struct volume_descriptor *)
blkid_probe_get_buffer(pr, 256 * pbs[i], sizeof(*vd));
if (!vd)