From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on071c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe40::71c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D01F11A1DEB for ; Tue, 11 Oct 2016 02:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=GiyhqWvi34ufoyZSGY8tFD6c8N8yfHijtzjiZUvRN6Q=; b=UUUCHVCFa3p7yc0eOUJ/ATp3iZtaR8udCjWCw33qnRcTqTBq9tVbfiG+QqWqtQ9gjWwUtave0fOyow4rqhgzNlnTSubaqNK2saGlhj6VwNGnLblwixcNclH+Y3sRSKhA7yfD1a1+vjtdR4sXDZdR8xTTA+oy6/USQck2HjoQ55s= Received: from BY1PR03MB1355.namprd03.prod.outlook.com (10.162.109.25) by BY1PR03MB1353.namprd03.prod.outlook.com (10.162.109.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11; Tue, 11 Oct 2016 09:22:54 +0000 Received: from BY1PR03MB1355.namprd03.prod.outlook.com ([10.162.109.25]) by BY1PR03MB1355.namprd03.prod.outlook.com ([10.162.109.25]) with mapi id 15.01.0659.018; Tue, 11 Oct 2016 09:22:54 +0000 From: Sean Brogan To: Jiewen Yao , "edk2-devel@lists.01.org" CC: Michael D Kinney , Feng Tian , Chao Zhang , Liming Gao , Star Zeng Thread-Topic: [edk2] [PATCH V2 04/50] MdeModulePkg/Include: Add IniParsingLib header. Thread-Index: AQHSGxVW8cveS63n/02WbWjFoCWU/aCjC7Hw Date: Tue, 11 Oct 2016 09:22:53 +0000 Message-ID: References: <1475238128-22448-1-git-send-email-jiewen.yao@intel.com> <1475238128-22448-5-git-send-email-jiewen.yao@intel.com> In-Reply-To: <1475238128-22448-5-git-send-email-jiewen.yao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sean.brogan@microsoft.com; x-originating-ip: [50.46.222.147] x-ms-office365-filtering-correlation-id: 6b8c52a4-1964-4ba6-2008-08d3f1b82e43 x-microsoft-exchange-diagnostics: 1; BY1PR03MB1353; 7:PZdO+yZxrnSu2JxYDxE4N61tiXL5T723IulMmaLa5aP+d61971hAUUAIEbW81Q0HOWEj9DPcRakOYiQ5e5O5ZePrbP0Mcg5DmYZulO//QZTB0itLa+rlzCqihjsF4BTusWIoKLAkDk5Df/V57UxLUNrLU3uvbeF1YGCzzaDqumgNIgXG4BpopIYf+1nFCJhLFpbGkxH2EiS8CwYbxXMtCJnlHXeLm5U3l4KqbnUBSAN+V6+RJQa3gq1PmihgBs17KqIV0K45sT37urWLmVzhdQLQH8wTeP9Ybv9KZ1YEYsxWhnKjJ2gQ6gm7RlyJAdWzL899kr/VNcdQxUsF2W5YjG3+Ek9kZIcwUn0vQ6NCJVrXTSPv2PkUdlNGnVLcfwNG x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1353; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(61426038)(61427038); SRVR:BY1PR03MB1353; BCL:0; PCL:0; RULEID:; SRVR:BY1PR03MB1353; x-forefront-prvs: 00922518D8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(377454003)(13464003)(189002)(199003)(33656002)(9686002)(77096005)(15975445007)(15395725005)(2950100002)(92566002)(8936002)(305945005)(74316002)(4326007)(7736002)(7696004)(7846002)(2501003)(11100500001)(76576001)(3660700001)(5001770100001)(97736004)(3280700002)(122556002)(68736007)(2900100001)(99286002)(19580395003)(54356999)(101416001)(105586002)(87936001)(106116001)(106356001)(50986999)(76176999)(5002640100001)(16799955002)(86362001)(15188155005)(86612001)(19580405001)(5005710100001)(189998001)(8990500004)(2906002)(5660300001)(10400500002)(10290500002)(8676002)(10090500001)(66066001)(586003)(3846002)(6116002)(102836003)(81166006)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR03MB1353; H:BY1PR03MB1355.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2016 09:22:53.8926 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1353 Subject: Re: [PATCH V2 04/50] MdeModulePkg/Include: Add IniParsingLib header. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 09:22:56 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This is specific to your implementation and would again suggest moving to y= our new package. =20 =20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Jiewen Yao > Sent: Friday, September 30, 2016 5:21 AM > To: edk2-devel@lists.01.org > Cc: Michael D Kinney ; Feng Tian > ; Chao Zhang ; Liming Gao > ; Star Zeng > Subject: [edk2] [PATCH V2 04/50] MdeModulePkg/Include: Add IniParsingLib > header. >=20 > This library is used to parse the INI configuration file. > The INI configuration file is used in EDKII capsule image to describe the= capsule > information. >=20 > Detail format is documented in header file. >=20 > Cc: Feng Tian > Cc: Star Zeng > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Chao Zhang > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiewen Yao > Reviewed-by: Liming Gao > --- > MdeModulePkg/Include/Library/IniParsingLib.h | 166 ++++++++++++++++++++ > 1 file changed, 166 insertions(+) >=20 > diff --git a/MdeModulePkg/Include/Library/IniParsingLib.h > b/MdeModulePkg/Include/Library/IniParsingLib.h > new file mode 100644 > index 0000000..447a2e6 > --- /dev/null > +++ b/MdeModulePkg/Include/Library/IniParsingLib.h > @@ -0,0 +1,166 @@ > +/** @file > + INI configuration parsing library. > + > + The INI file format is: > + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + [SectionName] > + EntryName=3DEntryValue > + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > + Where: > + 1) SectionName is an ASCII string. The valid format is [A-Za-z0-9_= ]+ > + 2) EntryName is an ASCII string. The valid format is [A-Za-z0-9_]+ > + 3) EntryValue can be: > + 3.1) an ASCII String. The valid format is [A-Za-z0-9_]+ > + 3.2) a GUID. The valid format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxx= xxxxxx, > where x is [A-Fa-f0-9] > + 3.3) a decimal value. The valid format is [0-9]+ > + 3.4) a heximal value. The valid format is 0x[A-Fa-f0-9]+ > + 4) '#' or ';' can be used as comment at anywhere. > + 5) TAB(0x20) or SPACE(0x9) can be used as separator. > + 6) LF(\n, 0xA) or CR(\r, 0xD) can be used as line break. > + > +Copyright (c) 2016, Intel Corporation. All rights reserved.
This > +program and the accompanying materials are licensed and made available > +under the terms and conditions of the BSD License which accompanies > +this distribution. The full text of the license may be found at > +http://opensource.org/licenses/bsd-license.php > + > +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS > OR IMPLIED. > + > +**/ > + > + > +#ifndef __INI_PARSING_LIB_H__ > +#define __INI_PARSING_LIB_H__ > + > +/** > + Open an INI config file and return a context. > + > + @param DataBuffer Config raw file buffer. > + @param BufferSize Size of raw buffer. > + > + @return Config data buffer is opened and context is returned. > + @retval NULL No enough memory is allocated. > + @retval NULL Config data buffer is invalid. > +**/ > +VOID * > +EFIAPI > +OpenIniFile ( > + IN UINT8 *DataBuffer, > + IN UINTN BufferSize > + ); > + > +/** > + Get section entry string value. > + > + @param Context INI Config file context. > + @param SectionName Section name. > + @param EntryName Section entry name. > + @param EntryValue Point to the got entry string value. > + > + @retval EFI_SUCCESS Section entry string value is got. > + @retval EFI_NOT_FOUND Section is not found. > +**/ > +EFI_STATUS > +EFIAPI > +GetStringFromDataFile( > + IN VOID *Context, > + IN CHAR8 *SectionName, > + IN CHAR8 *EntryName, > + OUT CHAR8 **EntryValue > + ); > + > +/** > + Get section entry GUID value. > + > + @param Context INI Config file context. > + @param SectionName Section name. > + @param EntryName Section entry name. > + @param Guid Point to the got GUID value. > + > + @retval EFI_SUCCESS Section entry GUID value is got. > + @retval EFI_NOT_FOUND Section is not found. > +**/ > +EFI_STATUS > +EFIAPI > +GetGuidFromDataFile( > + IN VOID *Context, > + IN CHAR8 *SectionName, > + IN CHAR8 *EntryName, > + OUT EFI_GUID *Guid > + ); > + > +/** > + Get section entry decimal UINTN value. > + > + @param Context INI Config file context. > + @param SectionName Section name. > + @param EntryName Section entry name. > + @param Data Point to the got decimal UINTN value. > + > + @retval EFI_SUCCESS Section entry decimal UINTN value is got. > + @retval EFI_NOT_FOUND Section is not found. > +**/ > +EFI_STATUS > +EFIAPI > +GetDecimalUintnFromDataFile( > + IN VOID *Context, > + IN CHAR8 *SectionName, > + IN CHAR8 *EntryName, > + OUT UINTN *Data > + ); > + > +/** > + Get section entry heximal UINTN value. > + > + @param Context INI Config file context. > + @param SectionName Section name. > + @param EntryName Section entry name. > + @param Data Point to the got heximal UINTN value. > + > + @retval EFI_SUCCESS Section entry heximal UINTN value is got. > + @retval EFI_NOT_FOUND Section is not found. > +**/ > +EFI_STATUS > +EFIAPI > +GetHexUintnFromDataFile( > + IN VOID *Context, > + IN CHAR8 *SectionName, > + IN CHAR8 *EntryName, > + OUT UINTN *Data > + ); > + > +/** > + Get section entry heximal UINT64 value. > + > + @param Context INI Config file context. > + @param SectionName Section name. > + @param EntryName Section entry name. > + @param Data Point to the got heximal UINT64 value. > + > + @retval EFI_SUCCESS Section entry heximal UINT64 value is got. > + @retval EFI_NOT_FOUND Section is not found. > +**/ > +EFI_STATUS > +EFIAPI > +GetHexUint64FromDataFile( > + IN VOID *Context, > + IN CHAR8 *SectionName, > + IN CHAR8 *EntryName, > + OUT UINT64 *Data > + ); > + > +/** > + Close an INI config file and free the context. > + > + @param Context INI Config file context. > +**/ > +VOID > +EFIAPI > +CloseIniFile( > + IN VOID *Context > + ); > + > +#endif > + > -- > 2.7.4.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel