From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 524A0803A7 for ; Thu, 9 Mar 2017 22:17:40 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP; 09 Mar 2017 22:17:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,139,1486454400"; d="scan'208";a="1106902904" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga001.jf.intel.com with ESMTP; 09 Mar 2017 22:17:39 -0800 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 9 Mar 2017 22:17:39 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 9 Mar 2017 22:17:39 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.132]) with mapi id 14.03.0248.002; Fri, 10 Mar 2017 14:17:36 +0800 From: "Zeng, Star" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Wu, Hao A" , "Zeng, Star" Thread-Topic: [edk2] [PATCH] MdeModulePkg/PlatVarCleanupLib: Add lib destructor for unclosed event Thread-Index: AQHSmWW3OCub1AwVbE2L57vqG7hgCKGNmSeg Date: Fri, 10 Mar 2017 06:17:35 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B832ABF@shsmsx102.ccr.corp.intel.com> References: <20170310061520.22376-1-hao.a.wu@intel.com> In-Reply-To: <20170310061520.22376-1-hao.a.wu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/PlatVarCleanupLib: Add lib destructor for unclosed event 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: Fri, 10 Mar 2017 06:17:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Hao = Wu Sent: Friday, March 10, 2017 2:15 PM To: edk2-devel@lists.01.org Cc: Wu, Hao A ; Zeng, Star Subject: [edk2] [PATCH] MdeModulePkg/PlatVarCleanupLib: Add lib destructor = for unclosed event Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu --- MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c | 33 = ++++++++++++++++++-- MdeModulePkg/Library/PlatformVarCleanupLib/PlatformVarCleanupLib.inf | 3 = +- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c= b/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c index b96f8ddd83..c5fd30e219 100644 --- a/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c +++ b/MdeModulePkg/Library/PlatformVarCleanupLib/PlatVarCleanupLib.c @@ -1,7 +1,7 @@ /** @file Sample platform variable cleanup library implementation. =20 -Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -22,6 +22,8 @@ EDKII_VAR_CHECK_PROTOCOL *mVarCheck =3D NULL; /// BOOLEAN mEndOfDxe =3D FALSE; =20 +EFI_EVENT mPlatVarCleanupLibEndOfDxeEvent =3D NULL; + LIST_ENTRY mUserVariableList =3D INITIALIZE_LIST_HEAD_VAR= IABLE (mUserVariableList); UINT16 mUserVariableCount =3D 0; UINT16 mMarkedUserVariableCount =3D 0; @@ -1229,7 +1231,6 @@ PlatformVarCleanupLibConstructor ( ) { EFI_STATUS Status; - EFI_EVENT Event; =20 mLastVarErrorFlag =3D InternalGetVarErrorFlag (); DEBUG ((EFI_D_INFO, "mLastVarErrorFlag - 0x%02x\n", mLastVarErrorFlag));= @@ -1243,10 +1244,36 @@ PlatformVarCleanupLibConstructor ( PlatformVarCleanupEndOfDxeEvent, NULL, &gEfiEndOfDxeEventGroupGuid, - &Event + &mPlatVarCleanupLibEndOfDxeEvent ); ASSERT_EFI_ERROR (Status); =20 return EFI_SUCCESS; } =20 +/** + The destructor function closes the End of DXE event. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The destructor completed successfully. + +**/ +EFI_STATUS +EFIAPI +PlatformVarCleanupLibDestructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // + // Close the End of DXE event. + // + Status =3D gBS->CloseEvent (mPlatVarCleanupLibEndOfDxeEvent); + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} diff --git a/MdeModulePkg/Library/PlatformVarCleanupLib/PlatformVarCleanupL= ib.inf b/MdeModulePkg/Library/PlatformVarCleanupLib/PlatformVarCleanupLib.i= nf index a3498cca50..6e7fcb6a5c 100644 --- a/MdeModulePkg/Library/PlatformVarCleanupLib/PlatformVarCleanupLib.inf +++ b/MdeModulePkg/Library/PlatformVarCleanupLib/PlatformVarCleanupLib.i +++ nf @@ -1,7 +1,7 @@ ## @file # Sample platform variable cleanup library instance. # -# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2017, Intel Corporation. All rights=20 +reserved.
# # This program and the accompanying materials # are licensed and made a= vailable under the terms and conditions @@ -23,6 +23,7 @@ VERSION_STRING =3D 1.0 LIBRARY_CLASS =3D PlatformVarCleanupLib|DXE_DRIVER DXE_R= UNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER CONSTRUCTOR =3D PlatformVarCleanupLibConstructor + DESTRUCTOR =3D PlatformVarCleanupLibDestructor =20 # # The following information is for reference only and not required by the = build tools. -- 2.12.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel