From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.2450.1587087875126020266 for ; Thu, 16 Apr 2020 18:44:35 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=tvKe0ZSS; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: zhiguang.liu@intel.com) IronPort-SDR: YujmHkpVSGLI2prN26irQbu122ZzT0LGalCtyQmvUKNxWjTzLXKasH2DhuPnlKvnZRsk/DIQTa ls2I06+CmHyA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2020 18:44:34 -0700 IronPort-SDR: yMUO1c2JRstk2Gu8OZA997YnCWtl+c7vJZbQVGiM4Rjsp26z1DORhkKR71DbiUSnP0Xp4dkvsy zjID3lnpM/Mg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,393,1580803200"; d="scan'208";a="246166571" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by fmsmga008.fm.intel.com with ESMTP; 16 Apr 2020 18:44:34 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX103.amr.corp.intel.com (10.22.225.130) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 16 Apr 2020 18:44:34 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 16 Apr 2020 18:44:34 -0700 Received: from ORSEDG002.ED.cps.intel.com (10.7.248.5) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 16 Apr 2020 18:44:34 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.105) by edgegateway.intel.com (134.134.137.101) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 16 Apr 2020 18:44:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A26kD8QAUk8UF/7j511c7Der3g4g6YgMlSXj8hiX75XKsy8QCE8ldsbFq96DuOcT8M50fnoovYCKicFpWYKGnKg+p2bqACy8AdvY7QU8dhzfWQOaXuqkuvhIdDG50QLviI4WUfaaCs0lc/WaK83z4bomI0kAb/Cz2jBSeWDq0l7i+KpZMyno2Zbb3C3IS/68HU4sw6YZi8eXV9yBjTXOaPiEtGcct8ODeG7hQKzKy0CAgYQodeW5+Sn0CQf47oNczWn/T7YYY1COQrgAbSYD2mqRZah8m8bvfaUHDB+SMKf7HgFVJ39izK8zAYNaxQ+/5p/RMAxhWJ445SZl7VZ6EQ== 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=B+61mQeHfrbuBVx0EiwDzMPrbab2rB4t/KjZLVbwIXQ=; b=LSWsTGUw/DMGcl4sFVRTyn4TVbMOG4E6p77LXT4R+HIXadlXXGkpzxdlmoFt1QNEGX8UAZ8ttoQk4T3SlEKJYhogwZzVjmxLe+F1lmq0bX/VVZakThLMocXPNI535Zj7VnopfRQPjhQyL2+hMUWc83lEgGZoSjj9Mo0F+uWCe0bsu1cC2T+hO5Ie0+wrd2sLdrBmAXgXVHVyiMtriJTXniCFNMKTrDEzG6pgzDT8SaOWQpSYi1b/DTyAoitBHgWwLTXaxmVU77lWGqGQ9WTxWT7n8c7UQLf7lXU98novWMML9ZC8jtgpu/fkk9Lzo8P3YT8vAPB7T7MdEiVZqxWR4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B+61mQeHfrbuBVx0EiwDzMPrbab2rB4t/KjZLVbwIXQ=; b=tvKe0ZSSFaRpZ+fpdJl2zSqUTGIT1T/Bd5oP6JkyE7nCMZ+9n5qzherZ6thmlEFPzzTqNRruger/oDWGIml6UMBt1XWQnAKeGNh9MsDBXjFIrtWd4Td9JAwaGkgrVkPWMmjn77Ttn8V9eRNnKO44kMHKiaSXrm7ghtbNLRQ3QdI= Received: from BN7PR11MB2804.namprd11.prod.outlook.com (2603:10b6:406:ac::12) by BN7PR11MB2611.namprd11.prod.outlook.com (2603:10b6:406:aa::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.26; Fri, 17 Apr 2020 01:44:29 +0000 Received: from BN7PR11MB2804.namprd11.prod.outlook.com ([fe80::79e2:ed1f:4d6b:532c]) by BN7PR11MB2804.namprd11.prod.outlook.com ([fe80::79e2:ed1f:4d6b:532c%7]) with mapi id 15.20.2921.027; Fri, 17 Apr 2020 01:44:29 +0000 From: "Zhiguang Liu" To: "devel@edk2.groups.io" , "michael.kubacki@outlook.com" CC: "Bi, Dandan" , "Wu, Hao A" , "Wang, Jian J" , "Gao, Liming" , "Kinney, Michael D" , Sean Brogan Subject: Re: [edk2-devel] [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros Thread-Topic: [edk2-devel] [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros Thread-Index: AQHWD3MDjNlWOY6N50u/SHvSsQx9I6h8lENQ Date: Fri, 17 Apr 2020 01:44:28 +0000 Message-ID: References: <20200410200218.24992-1-michael.kubacki@outlook.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.2.0.6 dlp-product: dlpe-windows authentication-results: spf=none (sender IP is ) smtp.mailfrom=zhiguang.liu@intel.com; x-originating-ip: [192.102.204.45] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 65180f46-0ad8-4109-2350-08d7e270de4e x-ms-traffictypediagnostic: BN7PR11MB2611: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3173; x-forefront-prvs: 0376ECF4DD x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN7PR11MB2804.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(10019020)(39860400002)(366004)(136003)(376002)(346002)(396003)(45080400002)(6506007)(86362001)(53546011)(110136005)(4326008)(26005)(478600001)(33656002)(186003)(81156014)(54906003)(9686003)(64756008)(5660300002)(66446008)(66556008)(66476007)(8936002)(55016002)(966005)(7696005)(66946007)(76116006)(2906002)(8676002)(71200400001)(52536014)(316002);DIR:OUT;SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ST9/jfN24oLu4i1rB9EdW65bfGpzrxu6th1vPE6YuGoW1fnL6yUT7Mj8muF7ZeGEw6IAQOBlAyTK22kkMICNCja1NM/8JIDg+bV3VR5PG5mJUq9ae2zx87jmLpVwvCkstF498Gr/hg5LVGhtNqr6aSNQ664zQjtg1HDk5k6BkS+7AI9s5aaE3446t/MNSmhbdCwNWkbxr2g3m4V9F1H8Ayymwa8+0+0I+DvNlv9/VK/FCx8S9dRvZ55cXUz3pc8qaR7lejMZ4Z1Vz8JeP1z1jbMixepOwc5UH5+RceXGMtie8Q5OFav9cJWxSmwHieFpZNgSxg0FAbL7Kdd7B0n4DABJjMhiZ675EcLJUwIWuE7o26nM/B1aBf/mKfbl/mtsSzS1yCQETQvFXsxiXwBxPLirhUKBLzMbEq4/5lgww/sTICRoAtQgX0gpgG9k/71hQ/2RDrtaRZZBev9Eww5iR7KvXWXP/kfVQuk2Jw7KaYnJpcfC/9QKLnAQ0Cp2yqzUZ9nF1EEG642A7G8cxiHDSQ== x-ms-exchange-antispam-messagedata: aOFBoXK68YXhoHGQFNRJz9j07+Yt+fO2x9l861/FVF6Sc9XRBIpOvkV1G7qMYS5XpK54U2GEugufL2mZNvRcaZHVtUQdY5OyU8MiNxUZcGtKJLrV0veZF6GkbDDS1GNYQPbv4+dU4Rx6dkBBT7s1Ww== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 65180f46-0ad8-4109-2350-08d7e270de4e X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Apr 2020 01:44:28.3815 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QEzQyj5Lo8WcAx4ujnavFqbViM+2gPg0A9uZDENekzx/xOGJhXGCFEfq104aWgBs08sKfI5h8q8kwfe8aoImYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR11MB2611 Return-Path: zhiguang.liu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Zhiguang Liu -----Original Message----- From: devel@edk2.groups.io On Behalf Of Michael Kub= acki Sent: Saturday, April 11, 2020 4:02 AM To: devel@edk2.groups.io Cc: Bi, Dandan ; Wu, Hao A ; Wang= , Jian J ; Gao, Liming ; Kinne= y, Michael D ; Sean Brogan Subject: [edk2-devel] [PATCH v2 1/7] MdePkg/BaseLib: Add linked list itera= tion macros From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1959 The macros EFI_LIST_FOR_EACH and EFI_LIST_FOR_EACH_SAFE have been duplicat= ed 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 @@ =20 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
P= ortions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -2972,6 +2973,32 @@ PathCleanUpDirectories( **/ #define INITIALIZE_LI= ST_HEAD_VARIABLE(ListHead) {&(ListHead), &(ListHead)} =20 +/** + 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= = =20 +Entry->ForwardLink) + +/** + Iterates over each node in a doubly linked list using each node's=20 +forward link + with safety against node removal. + + This macro uses NextEntry to temporarily store the next list node so=20 + the node pointed to by Entry may be deleted in the current loop=20 + iteration step and iteration can continue from the node pointed to by N= extEntry. + + @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=20 + the next node @param ListHead The head node of the doubly linked=20 + 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=20 +Entry->ForwardLink) =20 /** Checks whether FirstEntry and SecondEntry are part of the same doubly-l= inked -- 2.16.3.windows.1