Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp661195ybi; Fri, 12 Jul 2019 02:36:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEuMqMvAeJ8AEFMTEOcoq4TatBq1ON+Pu3oKwFIpL3IibqsOIEVhElGr6k/xP5fy5sxe0R X-Received: by 2002:a63:2006:: with SMTP id g6mr9487567pgg.287.1562924218448; Fri, 12 Jul 2019 02:36:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562924218; cv=none; d=google.com; s=arc-20160816; b=ADZ+3PcnSiZ7+vM7JpQsPE2/NBP2nY+X5k71OqMwqbAByOkfQ4yXkKuXN0j4rmTlBf 9ZB727CsaxMPYZPrdkaPCTFLP82n5xEaiV4K4Jc1qLvnkghp2RvAfHjFZMPoytlbiMu6 lFdwJyEuhBO4LoSCPZMzT9nuOkuTIZjF3M2eauiHUHH+J7fw4Kk3rDnv5QebbBpnTBwn RQ0hd6OGB/jCGjDDOSrGv5FIr98zfj1YPdYKoBv4bcQWhXI03TtzprlZ5vQQuuetkN36 S/ZZ80k4b0XDxkxlb4gXtQ5xy4Q/K/HsZ6qp7z1YF3wetdvu1Vfix9mR7qUinK/ckt2M V1fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=UeZhZGEyfaPs7b5OV6FeWYzPFtGH3sOl5RblMT5w9zs=; b=d7qHIrs0zx2jAR8xOqMVAtT7iwVK5Zc3hPHqPEhKv7PTPPytE7E8XFsHFrmEFrv0aB FWM5WRgx6xmUyWXvrgYK97Af72lZECfNq0cChpnCJV04C1S25fU8GkGM6xtFmnmSGdza 3SM6e4hU0oWpLUAun1nKDbcFfL++rtMnSvkG+8RpiCesPOoaT1BdFZ3ylasGRsuclNUi H4l5M/e8gWTliBjwVpdUkVjOn5Q0z7wRJxNU7mZZFqyfCr+0vPobKb/6n6A9SZ7eAzc3 wBZItX1XmW2JuisXXQI/tkypvSy/qKLuQzpubYX3Xh+XYKVqW6NntZalX/0KNfFgbRel LEdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j185si7642469pfb.107.2019.07.12.02.36.43; Fri, 12 Jul 2019 02:36:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726623AbfGLJfq (ORCPT + 99 others); Fri, 12 Jul 2019 05:35:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:33582 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725987AbfGLJfq (ORCPT ); Fri, 12 Jul 2019 05:35:46 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 116FDAC1C; Fri, 12 Jul 2019 09:35:45 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id C913E1E43CA; Fri, 12 Jul 2019 11:35:44 +0200 (CEST) Date: Fri, 12 Jul 2019 11:35:44 +0200 From: Jan Kara To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: "Steven J. Magnani" , "Steven J . Magnani" , Jan Kara , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] udf: refactor VRS descriptor identification Message-ID: <20190712093544.GE906@quack2.suse.cz> References: <20190711133852.16887-1-steve@digidescorp.com> <20190711181521.fqsbatc2oslo2v5t@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190711181521.fqsbatc2oslo2v5t@pali> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 SUSE Labs, CR