From: "Michael Kubacki" <michael.kubacki@outlook.com>
To: devel@edk2.groups.io
Cc: Dandan Bi <dandan.bi@intel.com>, Hao A Wu <hao.a.wu@intel.com>,
Jian J Wang <jian.j.wang@intel.com>,
Liming Gao <liming.gao@intel.com>, Ray Ni <ray.ni@intel.com>,
Sean Brogan <sean.brogan@microsoft.com>
Subject: [PATCH v2 6/7] MdeModulePkg/RamDiskDxe: Use BaseLib linked list iteration macros
Date: Fri, 10 Apr 2020 13:02:17 -0700 [thread overview]
Message-ID: <MWHPR07MB3440EB246C97FD5D5933CB8EE9DE0@MWHPR07MB3440.namprd07.prod.outlook.com> (raw)
In-Reply-To: <20200410200218.24992-1-michael.kubacki@outlook.com>
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1959
Replaces usage of the linked list iteration macros defined in RamDiskImpl.h
with the common definition in BaseLib.h.
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: Ray Ni <ray.ni@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
---
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c | 3 ++-
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c | 9 +++++----
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c | 5 +++--
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h | 15 +--------------
4 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c
index a80ef271df9c..fcbf4f117dc6 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c
@@ -2,6 +2,7 @@
The driver entry point for RamDiskDxe driver.
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -92,7 +93,7 @@ RamDiskAcpiCheck (
return;
}
- EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
RamDiskPublishNfit (PrivateData);
}
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
index 96ea74a9a536..e35b8fa2296c 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
@@ -3,6 +3,7 @@
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016-2018 Hewlett Packard Enterprise Development LP<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -165,7 +166,7 @@ UnregisterAllRamDisks (
RAM_DISK_PRIVATE_DATA *PrivateData;
if (!IsListEmpty(&RegisteredRamDisks)) {
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
gBS->UninstallMultipleProtocolInterfaces (
@@ -507,7 +508,7 @@ UpdateMainForm (
EndLabel->Number = MAIN_LABEL_LIST_END;
Index = 0;
- EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
PrivateData->CheckBoxId = (EFI_QUESTION_ID)
(MAIN_CHECKBOX_QUESTION_ID_START + Index);
@@ -689,7 +690,7 @@ RamDiskCallback (
//
// Remove the selected RAM disks
//
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (PrivateData->CheckBoxChecked) {
RamDiskUnregister (
@@ -742,7 +743,7 @@ RamDiskCallback (
//
if ((QuestionId >= MAIN_CHECKBOX_QUESTION_ID_START) &&
(QuestionId < CREATE_RAW_RAM_DISK_FORM_ID)) {
- EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (PrivateData->CheckBoxId == QuestionId) {
PrivateData->CheckBoxChecked = (BOOLEAN) (Value->u8 != 0);
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c
index 36d635e4bc31..4333e000539b 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c
@@ -3,6 +3,7 @@
Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -662,7 +663,7 @@ RamDiskRegister (
if (!IsListEmpty(&RegisteredRamDisks)) {
DevicePathSize = GetDevicePathSize (PrivateData->DevicePath);
- EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
RegisteredPrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (DevicePathSize == GetDevicePathSize (RegisteredPrivateData->DevicePath)) {
//
@@ -797,7 +798,7 @@ RamDiskUnregister (
EndingAddr = ReadUnaligned64 ((UINT64 *) &(RamDiskDevNode->EndingAddr[0]));
if (!IsListEmpty(&RegisteredRamDisks)) {
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
//
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h
index 25fec15c1882..ed80b47ccc33 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h
@@ -2,6 +2,7 @@
The header file of RamDiskDxe driver.
Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -47,20 +48,6 @@
//
#define RAM_DISK_DEFAULT_BLOCK_SIZE 512
-//
-// Iterate through the double linked list. NOT delete safe
-//
-#define EFI_LIST_FOR_EACH(Entry, ListHead) \
- for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
-
-//
-// Iterate through the double linked list. This is delete-safe.
-// Do not touch NextEntry
-//
-#define EFI_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead) \
- for(Entry = (ListHead)->ForwardLink, NextEntry = Entry->ForwardLink;\
- Entry != (ListHead); Entry = NextEntry, NextEntry = Entry->ForwardLink)
-
//
// RamDiskDxe driver maintains a list of registered RAM disks.
//
--
2.16.3.windows.1
next prev parent reply other threads:[~2020-04-10 20:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200410200218.24992-1-michael.kubacki@outlook.com>
2020-04-10 20:02 ` [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros Michael Kubacki
2020-04-10 23:43 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-04-17 1:44 ` Zhiguang Liu
2020-04-10 20:02 ` [PATCH v2 2/7] MdeModulePkg/EhciDxe: Use BaseLib " Michael Kubacki
2020-04-10 23:42 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-04-10 20:02 ` [PATCH v2 3/7] MdeModulePkg/EhciPei: " Michael Kubacki
2020-04-10 23:38 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-04-10 20:02 ` [PATCH v2 4/7] MdeModulePkg/XhciDxe: " Michael Kubacki
2020-04-10 23:37 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-04-10 20:02 ` [PATCH v2 5/7] MdeModulePkg/UfsPassThruDxe: " Michael Kubacki
2020-04-10 23:37 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-04-10 20:02 ` Michael Kubacki [this message]
2020-04-10 23:37 ` [EXTERNAL] [edk2-devel] [PATCH v2 6/7] MdeModulePkg/RamDiskDxe: " Bret Barkelew
2020-04-10 20:02 ` [PATCH v2 7/7] SecurityPkg/HddPassword: " Michael Kubacki
2020-04-10 23:36 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MWHPR07MB3440EB246C97FD5D5933CB8EE9DE0@MWHPR07MB3440.namprd07.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox