All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jan Kara <jack@suse.cz>
Subject: [WIP PATCH 3/4] udf: Fix reading minUDFReadRev and minUDFWriteRev from UDF 2.00+ VAT discs
Date: Sun, 12 Jan 2020 18:59:32 +0100	[thread overview]
Message-ID: <20200112175933.5259-4-pali.rohar@gmail.com> (raw)
In-Reply-To: <20200112175933.5259-1-pali.rohar@gmail.com>

These two fields are stored in VAT and override previous values stored in
LVIDIU.

This change contains only implementation for UDF 2.00+. For UDF 1.50 there
is an optional structure "Logical Volume Extended Information" which is not
implemented in this change yet.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 fs/udf/super.c  | 11 ++++++++++-
 fs/udf/udf_sb.h |  2 ++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/fs/udf/super.c b/fs/udf/super.c
index e8661bf01..0dad63f88 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1223,6 +1223,10 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
 			le32_to_cpu(vat20->numFiles);
 		map->s_type_specific.s_virtual.s_num_dirs =
 			le32_to_cpu(vat20->numDirs);
+		map->s_type_specific.s_virtual.s_min_udf_read_rev =
+			le16_to_cpu(vat20->minUDFReadRev);
+		map->s_type_specific.s_virtual.s_min_udf_write_rev =
+			le16_to_cpu(vat20->minUDFWriteRev);
 		map->s_type_specific.s_virtual.s_start_offset =
 			le16_to_cpu(vat20->lengthHeader);
 		map->s_type_specific.s_virtual.s_num_entries =
@@ -2238,7 +2242,12 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
 			goto error_out;
 		}
 
-		if (sbi->s_lvd_udfrev >= 0x0102) { /* minUDFReadRev and minUDFWriteRev were introduced in UDF 1.02 */
+		if ((sbi->s_partmaps[sbi->s_partition].s_partition_type == UDF_VIRTUAL_MAP15 ||
+		     sbi->s_partmaps[sbi->s_partition].s_partition_type == UDF_VIRTUAL_MAP20) &&
+		     sbi->s_partmaps[sbi->s_partition].s_type_specific.s_virtual.s_has_additional_data) {
+			minUDFReadRev = sbi->s_partmaps[sbi->s_partition].s_type_specific.s_virtual.s_min_udf_read_rev;
+			minUDFWriteRev = sbi->s_partmaps[sbi->s_partition].s_type_specific.s_virtual.s_min_udf_write_rev;
+		} else if (sbi->s_lvd_udfrev >= 0x0102) { /* minUDFReadRev and minUDFWriteRev were introduced in UDF 1.02 */
 			minUDFReadRev = le16_to_cpu(lvidiu->minUDFReadRev);
 			minUDFWriteRev = le16_to_cpu(lvidiu->minUDFWriteRev);
 		} else {
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
index c74abbc84..baac0357b 100644
--- a/fs/udf/udf_sb.h
+++ b/fs/udf/udf_sb.h
@@ -81,6 +81,8 @@ struct udf_virtual_data {
 	bool	s_has_additional_data;
 	__u32	s_num_files;
 	__u32	s_num_dirs;
+	__u16	s_min_udf_read_rev;
+	__u16	s_min_udf_write_rev;
 };
 
 struct udf_bitmap {
-- 
2.20.1


  parent reply	other threads:[~2020-01-12 18:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-12 17:59 [WIP PATCH 0/4] Support for UDF 1.01 and 2.60 revisions Pali Rohár
2020-01-12 17:59 ` [WIP PATCH 1/4] udf: Do not access LVIDIU revision members when they are not filled Pali Rohár
2020-01-13 12:00   ` Jan Kara
2020-01-13 18:37     ` Pali Rohár
2020-01-14 12:01       ` Jan Kara
2020-01-12 17:59 ` [WIP PATCH 2/4] udf: Fix reading numFiles and numDirs from UDF 2.00+ VAT discs Pali Rohár
2020-01-13 11:58   ` Jan Kara
2020-01-13 18:11     ` Pali Rohár
2020-01-14 11:18       ` Jan Kara
2020-01-14 11:37         ` Jan Kara
2020-01-12 17:59 ` Pali Rohár [this message]
2020-01-12 17:59 ` [WIP PATCH 4/4] udf: Allow to read UDF 2.60 discs Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200112175933.5259-4-pali.rohar@gmail.com \
    --to=pali.rohar@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.