From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.99]) by mx.groups.io with SMTP id smtpd.web10.605.1586562185706100293 for ; Fri, 10 Apr 2020 16:43:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=LJUTeojX; spf=pass (domain: microsoft.com, ip: 40.107.220.99, mailfrom: bret.barkelew@microsoft.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nvl0RYilRTYOG8uRpP/C1BnJwLFWrPo5px950oXpLy7rqghRpL9k0TZCYhK+dkhaQoDQLnmpU8OLkWWSNho25yLT0sXgg03LfZHUk4Yzdh/upWTQzhljV5QRNUDx0GQ5pbnkXMApkmTEjAnJyTXlyZ0BdnhGGj+BnX1uCvnby2PC0RKJC0K/qXqJCMpqHNXhlUGUyKIZFHwJ6e7Za/cNVR+AlifGyV0Tp0z786w+8MU7J59eb/t/MgEUUGSX50ZwNqHdLqFXtN9mrq8skGZUCF3cWK8tQjGTVD2/w//WMBuSOxKVrct35J6KjXTxlMTJ3DzDfXyDj4BhZpYCnVgnxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9ci3OVS1abPm78D+51kwVjw36zLg6Tk4DV4Posd/lfg=; b=GgPx4i2W9+sOsqh4uT0Mdmws5+lLWvEDvSv+b3pKNtwqyFHSYl4jOR/OBa7au2Rc/wuYDy9XV9H7rUZWPf9+oVHv6FsTUScRnepHRnPQsbbX+HBO+JP6Xf3EJjeUxA40RAeoU3XXUlwJoVDkP/xQePuwHDi6d7V9HwzLTqFBn6dRZaayoywWa0azIJiFkW1V8WrkjrSDvxaxxe/woZJH9PkYlq7EQ9x4lCETIv/PGGnISYTB1SdckPJ9YA0XSP7LbSnCSTRsZT1n9tp29mqw16d7Wbb4Ncg9aNbTobWp7oJ3x947YfHZWHLVAF+9jNdVnijmfEti/fgK5j4djjBkpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9ci3OVS1abPm78D+51kwVjw36zLg6Tk4DV4Posd/lfg=; b=LJUTeojXBSaUXld0ypIzQ+Zwse0wTSmxomP4FEA3aA4KqCb0sdj4QUh2SEK5KkrKfY9yEam8iXgf8SsypEJ/UQUFhKpYSfK+z9D2nZ0O9cuvrGYr4FUSS+jroGr7bt4SSghKyLy9aFN7q7dkHMVj0G5SVs0uSUWvNfYXW2lP/lI= Received: from CY4PR21MB0743.namprd21.prod.outlook.com (2603:10b6:903:b2::9) by CY4PR21MB0776.namprd21.prod.outlook.com (2603:10b6:903:b8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.8; Fri, 10 Apr 2020 23:43:04 +0000 Received: from CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::90d:10d9:c5bc:5318]) by CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::90d:10d9:c5bc:5318%12]) with mapi id 15.20.2921.009; Fri, 10 Apr 2020 23:43:04 +0000 From: "Bret Barkelew" To: "devel@edk2.groups.io" , "michael.kubacki@outlook.com" CC: Dandan Bi , Hao A Wu , Jian J Wang , Liming Gao , "Kinney, Michael D" , Sean Brogan Subject: Re: [EXTERNAL] [edk2-devel] [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros Thread-Topic: [EXTERNAL] [edk2-devel] [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros Thread-Index: AQHWD3L/pAGJ2PWeYUazvRAkrDbAlKhzBKSH Date: Fri, 10 Apr 2020 23:43:04 +0000 Message-ID: References: <20200410200218.24992-1-michael.kubacki@outlook.com>, In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2020-04-10T23:42:59.9313334Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Privileged authentication-results: spf=none (sender IP is ) smtp.mailfrom=Bret.Barkelew@microsoft.com; x-originating-ip: [71.212.145.195] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: c915916d-16f0-418d-14a9-08d7dda8e9d5 x-ms-traffictypediagnostic: CY4PR21MB0776:|CY4PR21MB0776:|CY4PR21MB0776: x-ms-exchange-transport-forked: True x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 0369E8196C x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR21MB0743.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(10019020)(4636009)(346002)(366004)(136003)(396003)(376002)(39860400002)(2906002)(8990500004)(52536014)(82950400001)(5660300002)(9686003)(64756008)(4326008)(66946007)(66476007)(91956017)(76116006)(33656002)(86362001)(55016002)(66446008)(66556008)(107886003)(82960400001)(10290500003)(26005)(6506007)(110136005)(54906003)(478600001)(8676002)(186003)(8936002)(81156014)(316002)(7696005)(966005)(53546011)(71200400001);DIR:OUT;SFP:1102; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3L66VHof6IEcXFTNNF2GAkXVSFmILwZAwtKNES1PZeEyJtuo8UVW27qtkeBH2BN8sTf2LHPXPWCq1yGYy+u74SJMxCBPxe3sqAxEAA/MLS765mugV9nzMzpuad+fic3H8Uu4E59WOCoRCPg8YqyltlkSmhHYWAfddQq3Czly/MLjaS4+9zwS5fZCx22Fk+gtNrSTmEs5JVoueA2OtuRey10bG59on0e1buMh6VL4eAwUn568Ccm/NmOTh0O4NncyvajT0CYggpBAnmaDVWaKn/hqUjqcqjpvgogYVNvM2k4A+XrBmAAGPlo2a+qwHMC+PoHVTSfd73lvac/0lkuNi77QKvAqhjzkgMiQYWt+3fXZ6kNqX4B1feZmz0fNjFv5KV9giv+60YKb6OLjXHZI1pnBetMWHqcfRzuZMfFPDjIjtn/jGBEZcROIbLpXL+pCFEfapwIUq33FGJ0EBNk+OKaqt83VpT+9WvX4ViBfp7xGZaoWZvxlnEdQsCHfVyuSIJdy1n45HZUkCxcYrVtBpg== x-ms-exchange-antispam-messagedata: jfYgrq7WSeUGrsooaHmMx05ZjkOF8s0UyCehM170i3Krcgg3wpPP9ZJRhaFLJXKMAiMYALHZvD9zuw531uCb/7a+KWf/MpbVMaY+PRrIDREMNwjM2leRyQZH8DTkdpue8SVsdncPJZwWU1MewEc0+g== MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: c915916d-16f0-418d-14a9-08d7dda8e9d5 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Apr 2020 23:43:04.2494 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: tY9Rzx/K1SmWVS+U4H00a0OzdS8FMD+zNh6YAcl7MTxgzp8bK0Ui77jyb/vwNrBh5E4R6lxw9A22rVxF5Ha//w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0776 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CY4PR21MB0743064D6F91C1350B9BE7EDEFDE0CY4PR21MB0743namp_" --_000_CY4PR21MB0743064D6F91C1350B9BE7EDEFDE0CY4PR21MB0743namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bret Barkelew - Bret ________________________________ From: devel@edk2.groups.io on behalf of Michael Kub= acki via groups.io Sent: Friday, April 10, 2020 1:02:12 PM To: devel@edk2.groups.io Cc: Dandan Bi ; Hao A Wu ; Jian J= Wang ; Liming Gao ; Kinney, M= ichael D ; Sean Brogan Subject: [EXTERNAL] [edk2-devel] [PATCH v2 1/7] MdePkg/BaseLib: Add linked= list iteration macros From: Michael Kubacki REF:https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbu= gzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D1959&data=3D02%7C01%7CBret.B= arkelew%40microsoft.com%7C94961c566a924c5b25ec08d7dd8a20bc%7C72f988bf86f141= af91ab2d7cd011db47%7C1%7C0%7C637221457630835410&sdata=3DHmJaCO%2BcGBU51= %2BU1e1D7I3WN0x4PRq9LhH9d9hOBo4s%3D&reserved=3D0 The macros EFI_LIST_FOR_EACH and EFI_LIST_FOR_EACH_SAFE have been duplicated across several drivers. These macros have proven useful and established a commonly used pattern for linked list iteration. This change defines the macros in BaseLib.h alongside other generic linked list macros and functions. Cc: Dandan Bi Cc: Hao A Wu Cc: Jian J Wang Cc: Liming Gao Cc: Michael D Kinney Cc: Sean Brogan Signed-off-by: Michael Kubacki Reviewed-by: Guomin Jiang --- MdePkg/Include/Library/BaseLib.h | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/Bas= eLib.h index ecadff8b235e..d066f1be2495 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -4,6 +4,7 @@ Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -2972,6 +2973,32 @@ PathCleanUpDirectories( **/ #define INITIALIZE_LIST_HEAD_VARIABLE(ListHead) {&(ListHead), &(ListHead= )} +/** + Iterates over each node in a doubly linked list using each node's forwa= rd link. + + @param Entry A pointer to a list node used as a loop cursor during= iteration + @param ListHead The head node of the doubly linked list + +**/ +#define BASE_LIST_FOR_EACH(Entry, ListHead) \ + for(Entry =3D (ListHead)->ForwardLink; Entry !=3D (ListHead); Entry =3D= Entry->ForwardLink) + +/** + Iterates over each node in a doubly linked list using each node's forwa= rd link + with safety against node removal. + + This macro uses NextEntry to temporarily store the next list node so th= e node + pointed to by Entry may be deleted in the current loop iteration step a= nd + iteration can continue from the node pointed to by NextEntry. + + @param Entry A pointer to a list node used as a loop cursor during= iteration + @param NextEntry A pointer to a list node used to temporarily store th= e next node + @param ListHead The head node of the doubly linked list + +**/ +#define BASE_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead) \ + for(Entry =3D (ListHead)->ForwardLink, NextEntry =3D Entry->ForwardLink= ;\ + Entry !=3D (ListHead); Entry =3D NextEntry, NextEntry =3D Entry->Fo= rwardLink) /** Checks whether FirstEntry and SecondEntry are part of the same doubly-l= inked -- 2.16.3.windows.1 --_000_CY4PR21MB0743064D6F91C1350B9BE7EDEFDE0CY4PR21MB0743namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Reviewed-by: Bret Barkelew <bret.barkelew@micrso= ft.com>

 

- Bret

 


From: devel@edk2.groups.io= <devel@edk2.groups.io> on behalf of Michael Kubacki via groups.io &l= t;michael.kubacki=3Doutlook.com@groups.io>
Sent: Friday, April 10, 2020 1:02:12 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Dandan Bi <dandan.bi@intel.com>; Hao A Wu <hao.a.wu@in= tel.com>; Jian J Wang <jian.j.wang@intel.com>; Liming Gao <limi= ng.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>;= Sean Brogan <sean.brogan@microsoft.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH v2 1/7] MdePkg/BaseLib: Add= linked list iteration macros
 
From: Michael Kubacki <michael.kubacki@microso= ft.com>

REF:https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbu= gzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D1959&amp;data=3D02%7C01%7CBr= et.Barkelew%40microsoft.com%7C94961c566a924c5b25ec08d7dd8a20bc%7C72f988bf86= f141af91ab2d7cd011db47%7C1%7C0%7C637221457630835410&amp;sdata=3DHmJaCO%= 2BcGBU51%2BU1e1D7I3WN0x4PRq9LhH9d9hOBo4s%3D&amp;reserved=3D0

The macros EFI_LIST_FOR_EACH and EFI_LIST_FOR_EACH_SAFE have been
duplicated across several drivers. These macros have proven useful and
established a commonly used pattern for linked list iteration.

This change defines the macros in BaseLib.h alongside other generic linked=
list macros and functions.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Guomin Jiang <guomin.jiang@intel.com>
---
 MdePkg/Include/Library/BaseLib.h | 27 ++++++= ++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/Bas= eLib.h
index ecadff8b235e..d066f1be2495 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -4,6 +4,7 @@
 
 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.&l= t;BR>
 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.&= lt;BR>
+Copyright (c) Microsoft Corporation.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -2972,6 +2973,32 @@ PathCleanUpDirectories(
 **/
 #define INITIALIZE_LIST_HEAD_VARIABLE(ListHead)  {&(ListHea= d), &(ListHead)}
 
+/**
+  Iterates over each node in a doubly linked list using each nod= e's forward link.
+
+  @param  Entry     A pointer to a list= node used as a loop cursor during iteration
+  @param  ListHead  The head node of the doubly linked= list
+
+**/
+#define BASE_LIST_FOR_EACH(Entry, ListHead)    \
+  for(Entry =3D (ListHead)->ForwardLink; Entry !=3D (ListHead= ); Entry =3D Entry->ForwardLink)
+
+/**
+  Iterates over each node in a doubly linked list using each nod= e's forward link
+  with safety against node removal.
+
+  This macro uses NextEntry to temporarily store the next list n= ode so the node
+  pointed to by Entry may be deleted in the current loop iterati= on step and
+  iteration can continue from the node pointed to by NextEntry.<= br> +
+  @param  Entry     A pointer to a list= node used as a loop cursor during iteration
+  @param  NextEntry A pointer to a list node used to tempor= arily store the next node
+  @param  ListHead  The head node of the doubly linked= list
+
+**/
+#define BASE_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead) &nbs= p;          \
+  for(Entry =3D (ListHead)->ForwardLink, NextEntry =3D Entry-= >ForwardLink;\
+      Entry !=3D (ListHead); Entry =3D NextE= ntry, NextEntry =3D Entry->ForwardLink)
 
 /**
   Checks whether FirstEntry and SecondEntry are part of the sam= e doubly-linked
--
2.16.3.windows.1




--_000_CY4PR21MB0743064D6F91C1350B9BE7EDEFDE0CY4PR21MB0743namp_--