diff options
author | Pali Rohár | 2017-11-16 18:53:52 +0100 |
---|---|---|
committer | Pali Rohár | 2017-11-16 18:53:52 +0100 |
commit | 06d9f4763f6177662965ba134f092698270fe15e (patch) | |
tree | 79b806e0db0af73844dffada54be2437632d4779 /libblkid/src/superblocks/udf.c | |
parent | bash-completion: (umount) use findmnt, escape a space in paths (diff) | |
download | kernel-qcow2-util-linux-06d9f4763f6177662965ba134f092698270fe15e.tar.gz kernel-qcow2-util-linux-06d9f4763f6177662965ba134f092698270fe15e.tar.xz kernel-qcow2-util-linux-06d9f4763f6177662965ba134f092698270fe15e.zip |
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
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Diffstat (limited to 'libblkid/src/superblocks/udf.c')
-rw-r--r-- | libblkid/src/superblocks/udf.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/libblkid/src/superblocks/udf.c b/libblkid/src/superblocks/udf.c index 7f98a15f8..e250a2033 100644 --- a/libblkid/src/superblocks/udf.c +++ b/libblkid/src/superblocks/udf.c @@ -68,7 +68,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 +188,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 +364,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 +434,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 +442,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; } |