summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2017-11-20 13:30:20 +0100
committerKarel Zak2017-11-20 13:30:20 +0100
commit07306a030333938ed4b0c84d8304cba07cbd8e03 (patch)
tree1d62b8a023aa16b838cf36e31c7f394b9eb1d2dd
parenthwclock: fix debug regression (diff)
parentlibblkid: udf: Update copyright (diff)
downloadkernel-qcow2-util-linux-07306a030333938ed4b0c84d8304cba07cbd8e03.tar.gz
kernel-qcow2-util-linux-07306a030333938ed4b0c84d8304cba07cbd8e03.tar.xz
kernel-qcow2-util-linux-07306a030333938ed4b0c84d8304cba07cbd8e03.zip
Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux: libblkid: udf: Update copyright tests: Add UDF cd image created by mkudfiso 20100208 libblkid: udf: Use UDF revision field from LVD domain id "*OSTA UDF Compliant" as a fallback value for ID_FS_VERSION when LVIDIU is missing
-rw-r--r--libblkid/src/superblocks/udf.c27
-rw-r--r--tests/expected/blkid/low-probe-udf-cd-mkudfiso-201002087
-rw-r--r--tests/ts/blkid/images-fs/udf-cd-mkudfiso-20100208.img.xzbin0 -> 756 bytes
3 files changed, 27 insertions, 7 deletions
diff --git a/libblkid/src/superblocks/udf.c b/libblkid/src/superblocks/udf.c
index 7f98a15f8..756fbcf63 100644
--- a/libblkid/src/superblocks/udf.c
+++ b/libblkid/src/superblocks/udf.c
@@ -4,6 +4,7 @@
* Copyright (C) 2001 by Andreas Dilger
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
* Copyright (C) 2008 Karel Zak <kzak@redhat.com>
+ * Copyright (C) 2014-2017 Pali Rohár <pali.rohar@gmail.com>
*
* This file may be redistributed under the terms of the
* GNU Lesser General Public License.
@@ -68,7 +69,11 @@ struct volume_descriptor {
uint8_t desc_charset[64];
struct dstring128 logvol_id;
uint32_t logical_blocksize;
- uint8_t domain_id[32];
+ uint8_t domain_id_flags;
+ char domain_id[23];
+ uint16_t udf_rev;
+ uint8_t domain_suffix_flags;
+ uint8_t reserved[5];
uint8_t logical_contents_use[16];
uint32_t map_table_length;
uint32_t num_partition_maps;
@@ -184,6 +189,7 @@ static int probe_udf(blkid_probe pr,
uint32_t loc;
size_t i;
uint32_t vsd_len;
+ uint16_t udf_rev = 0;
int vsd_2048_valid = -1;
int have_label = 0;
int have_uuid = 0;
@@ -359,6 +365,12 @@ real_blksz:
lvid_loc = le32_to_cpu(vd->type.logical.lvid_location);
}
}
+ if (!udf_rev) {
+ /* UDF-2.60: 2.1.5.3: UDF revision field shall indicate revision of UDF document
+ * We use this field as fallback value for ID_FS_VERSION when LVIDIU is missing */
+ if (strncmp(vd->type.logical.domain_id, "*OSTA UDF Compliant", sizeof(vd->type.logical.domain_id)) == 0)
+ udf_rev = le16_to_cpu(vd->type.logical.udf_rev);
+ }
if (!have_logvolid || !have_label) {
/* LogicalVolumeIdentifier in UDF 2.01 specification:
* ===============================================================
@@ -423,7 +435,7 @@ real_blksz:
* until we find last one. This could be time consuming process and could
* lead to scanning lot of disk blocks. Because we use LVID only for UDF
* version, in the worst case we would report only wrong ID_FS_VERSION. */
- uint16_t udf_rev;
+ uint16_t lvidiu_udf_rev;
lvidiu = (struct logical_vol_integ_descriptor_imp_use *)
blkid_probe_get_buffer(pr,
(uint64_t) lvid_loc * bs + UDF_LVIDIU_OFFSET(*vd),
@@ -431,14 +443,15 @@ real_blksz:
if (!lvidiu)
return errno ? -errno : 1;
/* Use Minimum UDF Read Revision as ID_FS_VERSION */
- udf_rev = le16_to_cpu(lvidiu->min_udf_read_rev);
- if (udf_rev)
- blkid_probe_sprintf_version(pr, "%d.%02d",
- (int)(udf_rev >> 8),
- (int)(udf_rev & 0xFF));
+ lvidiu_udf_rev = le16_to_cpu(lvidiu->min_udf_read_rev);
+ if (lvidiu_udf_rev)
+ udf_rev = lvidiu_udf_rev;
}
}
+ if (udf_rev)
+ blkid_probe_sprintf_version(pr, "%d.%02d", (int)(udf_rev >> 8), (int)(udf_rev & 0xFF));
+
return 0;
}
diff --git a/tests/expected/blkid/low-probe-udf-cd-mkudfiso-20100208 b/tests/expected/blkid/low-probe-udf-cd-mkudfiso-20100208
new file mode 100644
index 000000000..f57dee08b
--- /dev/null
+++ b/tests/expected/blkid/low-probe-udf-cd-mkudfiso-20100208
@@ -0,0 +1,7 @@
+ID_FS_LABEL=Volume_Label
+ID_FS_LABEL_ENC=Volume\x20Label
+ID_FS_LOGICAL_VOLUME_ID=Volume Label
+ID_FS_TYPE=udf
+ID_FS_USAGE=filesystem
+ID_FS_VERSION=1.02
+ID_FS_VOLUME_ID=Volume Label
diff --git a/tests/ts/blkid/images-fs/udf-cd-mkudfiso-20100208.img.xz b/tests/ts/blkid/images-fs/udf-cd-mkudfiso-20100208.img.xz
new file mode 100644
index 000000000..1da9a2823
--- /dev/null
+++ b/tests/ts/blkid/images-fs/udf-cd-mkudfiso-20100208.img.xz
Binary files differ