From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 BFB671A1E43 for ; Wed, 26 Oct 2016 14:48:59 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP; 26 Oct 2016 14:48:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,551,1473145200"; d="scan'208";a="24034454" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga006.fm.intel.com with ESMTP; 26 Oct 2016 14:48:59 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 26 Oct 2016 14:48:59 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.170]) by FMSMSX153.amr.corp.intel.com ([169.254.9.16]) with mapi id 14.03.0248.002; Wed, 26 Oct 2016 14:48:58 -0700 From: "Carsey, Jaben" To: Laszlo Ersek , edk2-devel-01 CC: Ard Biesheuvel , Cecil Sheng , "Zhang, Chao B" , "Bi, Dandan" , Daryl McDaniel , "Wei, David" , "Dong, Eric" , "Tian, Feng" , Gary Lin , "Fan, Jeff" , "Wu, Jiaxin" , "Justen, Jordan L" , "Gao, Liming" , "Kinney, Michael D" , "Ni, Ruiyu" , "Fu, Siyuan" , "Zeng, Star" , "Carsey, Jaben" Thread-Topic: [PATCH 00/47] edk2: centralize and adopt ARRAY_SIZE() Thread-Index: AQHSL7vmdbGzxSNXH02R+4jKmCgQ8aC7Rc6Q Date: Wed, 26 Oct 2016 21:48:58 +0000 Message-ID: References: <20161026190504.9888-1-lersek@redhat.com> In-Reply-To: <20161026190504.9888-1-lersek@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTUwZjc2ZDMtNjA3Ni00MDA1LWJiM2EtYjk5MmZkYmQ2M2JhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlEwYjcralBIekZUaWhPS0dJdEJzY1RxWlYyYlJONWxoclNxQ1lkRFAyV1U9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Subject: Re: [PATCH 00/47] edk2: centralize and adopt ARRAY_SIZE() 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: Wed, 26 Oct 2016 21:49:00 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable For 05, 39, 41, 42 Reviewed-by: Jaben Carsey > -----Original Message----- > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Wednesday, October 26, 2016 12:04 PM > To: edk2-devel-01 > Cc: Ard Biesheuvel ; Cecil Sheng > ; Zhang, Chao B ; Bi, > Dandan ; Daryl McDaniel lists@mc2research.org>; Wei, David ; Dong, Eric > ; Tian, Feng ; Gary Lin > ; Carsey, Jaben ; Fan, Jeff > ; Wu, Jiaxin ; Justen, Jordan L > ; Gao, Liming ; Kinney, > Michael D ; Ni, Ruiyu ; > Fu, Siyuan ; Zeng, Star ; Tim H= e > > Subject: [PATCH 00/47] edk2: centralize and adopt ARRAY_SIZE() > Importance: High >=20 > I'm sure most of us have wished at some point that ARRAY_SIZE() > had existed in a central header file, like it does in many other > open source projects. This series implements that. >=20 > Patches 01-04 round up the modules that #define ARRAY_SIZE() just > for themselves, and wrap their definitions in #ifndef ARRAY_SIZE. >=20 > Patch 05 defines ARRAY_SIZE() in "MdePkg/Include/Base.h". This > flips the previously modified modules to MdePkg's macro definition. >=20 > Patches 06-09 modify the same set of modules as patches 01-04 do; this > time the (now unused) module-local ARRAY_SIZE() macro definitions are > eliminated. >=20 > The rest of the patches (10-47) migrate the edk2 tree to ARRAY_SIZE(), > covering the most obvious open-coded ARRAY_SIZE() expressions. These > expressions were located and converted with the following shell > pipeline: >=20 > git ls-files \ > | xargs --no-run-if-empty -- \ > sed --regexp-extended --in-place \ > --expression=3D's,sizeof \(([a-zA-Z0-9_]+)\) / sizeof > \((\*\1|\1\[0\])\),ARRAY_SIZE (\1),g' \ > -- >=20 > This pipeline lists all tracked files with "git". The pathnames are then > composed with "xargs" into maximal length "sed" command lines, and those > "sed" commands are run. >=20 > Here the "sed" stream editor filters and modifies all the listed files > in place. The extended regular expression replaces the following two > patterns: >=20 > sizeof (ArrayName) / sizeof (*ArrayName) > sizeof (ArrayName) / sizeof (ArrayName[0]) >=20 > with >=20 > ARRAY_SIZE (ArrayName) >=20 > The regexp uses a backreference in the match, ensuring that the sizeof > operator in the dividend and the sizeof operator in the divisor both > refer to the same ArrayName. If there are multiple occurrences on the > same line, the sed command replaces all of them. >=20 > I collected the changes into patches manually, and I reviewed them all. >=20 > I test-built all of the modified packages, repeating the command >=20 > build -a X64 -t GCC48 -b DEBUG -p FooPkg/FooPkg.dsc >=20 > as many times as necessary. Two packages were impossible to build like > this: Nt32Pkg and Vlv2TbltDevicePkg, so I couldn't build-test them. >=20 > I did some light-weight testing with OVMF: boot with Secure Boot > enabled, S3 suspend/resume with and without SMM. I also booted > ArmVirtQemu once. >=20 > Repository: https://github.com/lersek/edk2.git > Branch: array_size >=20 > Cc: Ard Biesheuvel > Cc: Cecil Sheng > Cc: Chao Zhang > Cc: Dandan Bi > Cc: Daryl McDaniel > Cc: David Wei > Cc: Eric Dong > Cc: Feng Tian > Cc: Gary Lin > Cc: Jaben Carsey > Cc: Jeff Fan > Cc: Jiaxin Wu > Cc: Jordan Justen > Cc: Liming Gao > Cc: Michael D Kinney > Cc: Ruiyu Ni > Cc: Siyuan Fu > Cc: Star Zeng > Cc: Tim He >=20 > Thanks > Laszlo >=20 > Laszlo Ersek (47): > MdeModulePkg/RegularExpressionDxe: guard the definition of ARRAY_SIZE > NetworkPkg/IpsecConfig: guard the definition of ARRAY_SIZE > OvmfPkg/PlatformBootManagerLib: guard the definition of ARRAY_SIZE > OvmfPkg/XenBusDxe: guard the definition of ARRAY_SIZE > MdePkg/Include/Base.h: introduce the ARRAY_SIZE() function-like macro > MdeModulePkg/RegularExpressionDxe: remove module-local ARRAY_SIZE > macro > NetworkPkg/IpsecConfig: remove module-local ARRAY_SIZE macro > OvmfPkg/PlatformBootManagerLib: remove module-local ARRAY_SIZE > macro > OvmfPkg/XenBusDxe: remove module-local ARRAY_SIZE macro > ArmVirtPkg/NorFlashQemuLib: rebase to ARRAY_SIZE() > DuetPkg/DuetBdsLib: rebase to ARRAY_SIZE() > EdkCompatibilityPkg/FrameworkHiiOnUefiHiiThunk: rebase to ARRAY_SIZE() > EdkCompatibilityPkg/Sample/Tools: rebase to ARRAY_SIZE() > FatPkg/EnhancedFatDxe: rebase to ARRAY_SIZE() > IntelFrameworkModulePkg/LegacyBootManagerLib: rebase to > ARRAY_SIZE() > IntelFrameworkModulePkg/BdsDxe: rebase to ARRAY_SIZE() > MdeModulePkg/MemoryProfileInfo: rebase to ARRAY_SIZE() > MdeModulePkg/PciBusDxe: rebase to ARRAY_SIZE() > MdeModulePkg/PciHostBridgeDxe: rebase to ARRAY_SIZE() > MdeModulePkg/UsbBusDxe: rebase to ARRAY_SIZE() > MdeModulePkg/Core/Dxe: rebase to ARRAY_SIZE() > MdeModulePkg/Core/PiSmmCore: rebase to ARRAY_SIZE() > MdeModulePkg/BootMaintenanceManagerUiLib: rebase to ARRAY_SIZE() > MdeModulePkg/BootManagerUiLib: rebase to ARRAY_SIZE() > MdeModulePkg/UefiBootManagerLib: rebase to ARRAY_SIZE() > MdeModulePkg/VarCheckHiiLib: rebase to ARRAY_SIZE() > MdeModulePkg/Logo: rebase to ARRAY_SIZE() > MdeModulePkg/BdsDxe: rebase to ARRAY_SIZE() > MdeModulePkg/DisplayEngineDxe: rebase to ARRAY_SIZE() > MdeModulePkg/EbcDxe: rebase to ARRAY_SIZE() > MdeModulePkg/Tcp4Dxe: rebase to ARRAY_SIZE() > MdeModulePkg/Variable/RuntimeDxe: rebase to ARRAY_SIZE() > NetworkPkg/IScsiDxe: rebase to ARRAY_SIZE() > NetworkPkg/TcpDxe: rebase to ARRAY_SIZE() > Nt32Pkg/WinNtSerialIoDxe: rebase to ARRAY_SIZE() > OptionRomPkg/AtapiPassThruDxe: rebase to ARRAY_SIZE() > OvmfPkg/QemuBootOrderLib: rebase to ARRAY_SIZE() > OvmfPkg/QemuVideoDxe: rebase to ARRAY_SIZE() > PerformancePkg/Dp_App: rebase to ARRAY_SIZE() > SecurityPkg/AuthVariableLib: rebase to ARRAY_SIZE() > ShellPkg/UefiDpLib: rebase to ARRAY_SIZE() > ShellPkg/UefiShellLevel2CommandsLib: rebase to ARRAY_SIZE() > Vlv2TbltDevicePkg/FirmwareUpdate: rebase to ARRAY_SIZE() > Vlv2TbltDevicePkg/PlatformInitPei: rebase to ARRAY_SIZE() > Vlv2TbltDevicePkg/PlatformPei: rebase to ARRAY_SIZE() > Vlv2TbltDevicePkg/PlatformSetupDxe: rebase to ARRAY_SIZE() > Vlv2TbltDevicePkg/SmBiosMiscDxe: rebase to ARRAY_SIZE() >=20 > ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c = | 2 > +- > DuetPkg/Library/DuetBdsLib/BdsPlatform.c = | 2 +- >=20 > EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/OpcodeCr > eation.c | 2 +- > EdkCompatibilityPkg/Sample/Tools/Source/EfiRom/EfiRom.c = | 4 > ++-- > EdkCompatibilityPkg/Sample/Tools/Source/HiiPack/IfrParse.c = | 2 > +- > FatPkg/EnhancedFatDxe/DirectoryManage.c = | 4 ++-- > FatPkg/EnhancedFatDxe/FileName.c = | 4 ++-- > FatPkg/EnhancedFatDxe/Hash.c = | 4 ++-- > IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBm.c > | 2 +- > IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c = | 2 > +- > IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BBSsupport.c > | 4 ++-- > IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c > | 8 ++++---- > IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c > | 2 +- > IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c > | 6 +++--- > IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c > | 10 +++++----- > IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c > | 2 +- > IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c > | 2 +- > MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.c > | 6 +++--- > MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c = | 2 +- > MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c = | 2 > +- > MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c = | 4 ++-- > MdeModulePkg/Core/Dxe/Mem/Pool.c = | 2 +- > MdeModulePkg/Core/PiSmmCore/Pool.c = | 2 +- > MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c = | 6 > +++--- >=20 > MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance. > c | 8 ++++---- > MdeModulePkg/Library/BootMaintenanceManagerUiLib/ConsoleOption.c > | 8 ++++---- > MdeModulePkg/Library/BootMaintenanceManagerUiLib/UpdatePage.c > | 12 ++++++------ > MdeModulePkg/Library/BootMaintenanceManagerUiLib/Variable.c > | 2 +- > MdeModulePkg/Library/BootManagerUiLib/BootManager.c = | 6 > +++--- > MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c > | 2 +- > MdeModulePkg/Library/UefiBootManagerLib/BmConsole.c = | 2 > +- > MdeModulePkg/Library/UefiBootManagerLib/BmHotkey.c = | 2 > +- > MdeModulePkg/Library/UefiBootManagerLib/BmLoadOption.c = | > 4 ++-- > MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGen.c = | 4 > ++-- > MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiLibNullClass.c = | > 2 +- > MdeModulePkg/Logo/Logo.c = | 2 +- > MdeModulePkg/Universal/BdsDxe/BdsEntry.c = | 2 +- > MdeModulePkg/Universal/DisplayEngineDxe/FormDisplay.c = | 4 > ++-- > MdeModulePkg/Universal/DisplayEngineDxe/InputHandler.c = | 6 > +++--- > MdeModulePkg/Universal/EbcDxe/EbcExecute.c = | 2 +- > MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c = | > 2 +- > MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.h > | 2 -- > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c = | 2 > +- > MdePkg/Include/Base.h = | 13 +++++++++++++ > NetworkPkg/Application/IpsecConfig/IpSecConfig.h = | 2 -- > NetworkPkg/IScsiDxe/IScsiConfig.c = | 4 ++-- > NetworkPkg/IScsiDxe/IScsiDriver.c = | 2 +- > NetworkPkg/IScsiDxe/IScsiMisc.c = | 6 +++--- > NetworkPkg/TcpDxe/TcpOutput.c = | 2 +- > Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c = | 2 +- > OptionRomPkg/AtapiPassThruDxe/AtapiPassThru.c = | 4 ++-- > OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c = | 5 -- > --- > OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c = | > 12 ++++++------ > OvmfPkg/QemuVideoDxe/Initialize.c = | 4 ++-- > OvmfPkg/XenBusDxe/XenStore.c = | 1 - > PerformancePkg/Dp_App/Dp.c = | 2 +- > PerformancePkg/Dp_App/DpTrace.c = | 10 +++++----- > SecurityPkg/Library/AuthVariableLib/AuthVariableLib.c = | 4 ++-- > ShellPkg/Library/UefiDpLib/DpTrace.c = | 10 +++++----- > ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c = | 2 +- > Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c > | 2 +- > Vlv2TbltDevicePkg/PlatformInitPei/FlashMap.c = | 2 +- > Vlv2TbltDevicePkg/PlatformPei/BootMode.c = | 6 +++--- > Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c = | 2 > +- > Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c > | 2 +- > 65 files changed, 131 insertions(+), 128 deletions(-) >=20 > -- > 2.9.2