From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D056620945B70 for ; Thu, 21 Sep 2017 19:47:12 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Sep 2017 19:50:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,426,1500966000"; d="scan'208";a="314907661" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 21 Sep 2017 19:50:19 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 21 Sep 2017 19:50:19 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 21 Sep 2017 19:50:19 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Fri, 22 Sep 2017 10:50:18 +0800 From: "Ni, Ruiyu" To: Paulo Alcantara , "edk2-devel@lists.01.org" CC: "Kinney, Michael D" , "Gao, Liming" , Laszlo Ersek Thread-Topic: [PATCH v3 1/2] MdePkg: Add UDF volume structure definitions Thread-Index: AQHTMjzJGwhPmXBM/kKpH673TnnD5KLANI2w Date: Fri, 22 Sep 2017 02:50:17 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BA65B1C@SHSMSX103.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v3 1/2] MdePkg: Add UDF volume structure definitions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Sep 2017 02:47:13 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Paulo, Comments below: #define UDF_TAG_ID(_Tag) \ (UDF_VOLUME_DESCRIPTOR_ID)((_Tag)->TagIdentifier) 1. I prefer to remove the UDF_TAG_ID macro. Adding type-cast to get TAG_ID = is very straightforward. =20 #define UDF_LVD_REVISION(_Lv) \ *(UINT16 *)(UINTN)(_Lv)->DomainIdentifier.IdentifierSuffix typedef struct { UINT8 Flags; UINT8 Identifier[23]; UINT8 IdentifierSuffix[8]; } UDF_ENTITY_ID; 2. Entity structure is defined by ECMA-167 spec and re-used by UDF spec. I think since we are creating UDF structure in udf.h, how about using = the below structure layout and removing the UDF_LVD_REVISION macro: Typedef struct { UINT8 Flags; UINT8 Identifier[23]; UINT16 UdfRevision; UINT8 DomainFlags; UINT8 Reserved[5]; } UDF_ENTITY_ID; I am not sure if there are other structures that are defined in ECMA spec a= nd re-used by UDF spec. I think we can apply the similar rules to those struct= ures as well. Thanks/Ray > -----Original Message----- > From: Paulo Alcantara [mailto:pcacjr@zytor.com] > Sent: Thursday, September 21, 2017 2:16 AM > To: edk2-devel@lists.01.org > Cc: Paulo Alcantara ; Kinney, Michael D > ; Gao, Liming ; Laszlo > Ersek ; Ni, Ruiyu > Subject: [PATCH v3 1/2] MdePkg: Add UDF volume structure definitions >=20 > This patch adds a few more UDF volume structures in order to detect an UD= F > file system which is supported by current EDK2 UDF file system > implementation in Partition driver. >=20 > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Laszlo Ersek > Cc: Ruiyu Ni > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Paulo Alcantara > --- > MdePkg/Include/IndustryStandard/Udf.h | 63 ++++++++++++++++++-- > 1 file changed, 59 insertions(+), 4 deletions(-) >=20 > diff --git a/MdePkg/Include/IndustryStandard/Udf.h > b/MdePkg/Include/IndustryStandard/Udf.h > index 0febb4bcda..002e87e150 100644 > --- a/MdePkg/Include/IndustryStandard/Udf.h > +++ b/MdePkg/Include/IndustryStandard/Udf.h > @@ -24,11 +24,28 @@ > #define UDF_LOGICAL_SECTOR_SIZE ((UINT64)(1ULL << > UDF_LOGICAL_SECTOR_SHIFT)) > #define UDF_VRS_START_OFFSET ((UINT64)(16ULL << > UDF_LOGICAL_SECTOR_SHIFT)) >=20 > -#define _GET_TAG_ID(_Pointer) \ > - (((UDF_DESCRIPTOR_TAG *)(_Pointer))->TagIdentifier) > +typedef enum { > + UdfPrimaryVolumeDescriptor =3D 1, > + UdfAnchorVolumeDescriptorPointer =3D 2, > + UdfVolumeDescriptorPointer =3D 3, > + UdfImplemenationUseVolumeDescriptor =3D 4, > + UdfPartitionDescriptor =3D 5, > + UdfLogicalVolumeDescriptor =3D 6, > + UdfUnallocatedSpaceDescriptor =3D 7, > + UdfTerminatingDescriptor =3D 8, > + UdfLogicalVolumeIntegrityDescriptor =3D 9, > + UdfFileSetDescriptor =3D 256, > + UdfFileIdentifierDescriptor =3D 257, > + UdfAllocationExtentDescriptor =3D 258, > + UdfFileEntry =3D 261, > + UdfExtendedFileEntry =3D 266, > +} UDF_VOLUME_DESCRIPTOR_ID; >=20 > -#define IS_AVDP(_Pointer) \ > - ((BOOLEAN)(_GET_TAG_ID (_Pointer) =3D=3D 2)) > +#define UDF_TAG_ID(_Tag) \ > + (UDF_VOLUME_DESCRIPTOR_ID)((_Tag)->TagIdentifier) > + > +#define UDF_LVD_REVISION(_Lv) \ > + *(UINT16 *)(UINTN)(_Lv)->DomainIdentifier.IdentifierSuffix >=20 > #pragma pack(1) >=20 > @@ -49,12 +66,50 @@ typedef struct { > } UDF_EXTENT_AD; >=20 > typedef struct { > + UINT8 CharacterSetType; > + UINT8 CharacterSetInfo[63]; > +} UDF_CHAR_SPEC; > + > +typedef struct { > + UINT8 Flags; > + UINT8 Identifier[23]; > + UINT8 IdentifierSuffix[8]; > +} UDF_ENTITY_ID; > + > +typedef struct { > + UINT32 LogicalBlockNumber; > + UINT16 PartitionReferenceNumber; > +} UDF_LB_ADDR; > + > +typedef struct { > + UINT32 ExtentLength; > + UDF_LB_ADDR ExtentLocation; > + UINT8 ImplementationUse[6]; > +} UDF_LONG_ALLOCATION_DESCRIPTOR; > + > +typedef struct { > UDF_DESCRIPTOR_TAG DescriptorTag; > UDF_EXTENT_AD MainVolumeDescriptorSequenceExtent; > UDF_EXTENT_AD ReserveVolumeDescriptorSequenceExtent; > UINT8 Reserved[480]; > } UDF_ANCHOR_VOLUME_DESCRIPTOR_POINTER; >=20 > +typedef struct { > + UDF_DESCRIPTOR_TAG DescriptorTag; > + UINT32 VolumeDescriptorSequenceNumber; > + UDF_CHAR_SPEC DescriptorCharacterSet; > + UINT8 LogicalVolumeIdentifier[128]; > + UINT32 LogicalBlockSize; > + UDF_ENTITY_ID DomainIdentifier; > + UDF_LONG_ALLOCATION_DESCRIPTOR LogicalVolumeContentsUse; > + UINT32 MapTableLength; > + UINT32 NumberOfPartitionMaps; > + UDF_ENTITY_ID ImplementationIdentifier; > + UINT8 ImplementationUse[128]; > + UDF_EXTENT_AD IntegritySequenceExtent; > + UINT8 PartitionMaps[6]; > +} UDF_LOGICAL_VOLUME_DESCRIPTOR; > + > #pragma pack() >=20 > #endif > -- > 2.11.0