lkml.org 
[lkml]   [2019]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/2] udf: refactor VRS descriptor identification
On Thu 11-07-19 20:15:21, Pali Rohár  wrote:
> 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().

There's no difference in functionality but I agree it makes more sense.
I'll modify the patch. Thanks for review!

Honza

>
> > + 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


--
Jan Kara <jack@suse.com>
SUSE Labs, CR

\
 
 \ /
  Last update: 2019-07-12 11:36    [W:0.055 / U:2.820 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site