linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: "Steven J. Magnani" <steve.magnani@digidescorp.com>
Cc: Jan Kara <jack@suse.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	"Steven J . Magnani" <steve@digidescorp.com>
Subject: Re: [PATCH v2 1/2] udf: refactor VRS descriptor identification
Date: Thu, 11 Jul 2019 20:15:21 +0200	[thread overview]
Message-ID: <20190711181521.fqsbatc2oslo2v5t@pali> (raw)
In-Reply-To: <20190711133852.16887-1-steve@digidescorp.com>

[-- Attachment #1: Type: text/plain, Size: 1910 bytes --]

On Thursday 11 July 2019 08:38:51 Steven J. Magnani wrote:
> --- a/fs/udf/super.c	2019-07-10 18:57:41.192852154 -0500
> +++ b/fs/udf/super.c	2019-07-10 20:47:50.438352500 -0500
> @@ -685,16 +685,62 @@ out_unlock:
>  	return error;
>  }
>  
> -/* Check Volume Structure Descriptors (ECMA 167 2/9.1) */
> -/* We also check any "CD-ROM Volume Descriptor Set" (ECMA 167 2/8.3.1) */
> -static loff_t udf_check_vsd(struct super_block *sb)
> +static int identify_vsd(const struct volStructDesc *vsd)
> +{
> +	int vsd_id = 0;
> +
> +	if (!strncmp(vsd->stdIdent, VSD_STD_ID_CD001, VSD_STD_ID_LEN)) {

Hi! You probably want to use memcmp() instead of strncmp().

> +		switch (vsd->structType) {
> +		case 0:
> +			udf_debug("ISO9660 Boot Record found\n");
> +			break;
> +		case 1:
> +			udf_debug("ISO9660 Primary Volume Descriptor found\n");
> +			break;
> +		case 2:
> +			udf_debug("ISO9660 Supplementary Volume Descriptor found\n");
> +			break;
> +		case 3:
> +			udf_debug("ISO9660 Volume Partition Descriptor found\n");
> +			break;
> +		case 255:
> +			udf_debug("ISO9660 Volume Descriptor Set Terminator found\n");
> +			break;
> +		default:
> +			udf_debug("ISO9660 VRS (%u) found\n", vsd->structType);
> +			break;
> +		}
> +	} else if (!strncmp(vsd->stdIdent, VSD_STD_ID_BEA01, VSD_STD_ID_LEN))
> +		vsd_id = 1;
> +	else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR02, VSD_STD_ID_LEN))
> +		vsd_id = 2;
> +	else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR03, VSD_STD_ID_LEN))
> +		vsd_id = 3;
> +	else if (!strncmp(vsd->stdIdent, VSD_STD_ID_BOOT2, VSD_STD_ID_LEN))
> +		; /* vsd_id = 0 */
> +	else if (!strncmp(vsd->stdIdent, VSD_STD_ID_CDW02, VSD_STD_ID_LEN))
> +		; /* vsd_id = 0 */
> +	else {
> +		/* TEA01 or invalid id : end of volume recognition area */
> +		vsd_id = 255;
> +	}
> +
> +	return vsd_id;
> +}

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  parent reply	other threads:[~2019-07-11 18:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11 13:38 [PATCH v2 1/2] udf: refactor VRS descriptor identification Steven J. Magnani
2019-07-11 13:38 ` [PATCH v2 2/2] udf: support 2048-byte spacing of VRS descriptors on 4K media Steven J. Magnani
2019-07-11 15:04   ` Jan Kara
2019-07-11 15:56     ` Steve Magnani
2019-07-12  9:34       ` Jan Kara
2019-07-11 18:15 ` Pali Rohár [this message]
2019-07-12  9:35   ` [PATCH v2 1/2] udf: refactor VRS descriptor identification Jan Kara

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=20190711181521.fqsbatc2oslo2v5t@pali \
    --to=pali.rohar@gmail.com \
    --cc=jack@suse.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steve.magnani@digidescorp.com \
    --cc=steve@digidescorp.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).