From 3d58e26accdbb14ec011fdbbd9b8a8d5d4d4b712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20H=C3=A4user?= Date: Sat, 11 Jun 2022 10:33:05 +0200 Subject: [PATCH] OcDevicePathLib: Import API to find device path terminator --- Include/Acidanthera/Library/OcDevicePathLib.h | 12 ++++++++++++ Library/OcDevicePathLib/OcDevicePathLib.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Include/Acidanthera/Library/OcDevicePathLib.h b/Include/Acidanthera/Library/OcDevicePathLib.h index 76f90449..6d283538 100644 --- a/Include/Acidanthera/Library/OcDevicePathLib.h +++ b/Include/Acidanthera/Library/OcDevicePathLib.h @@ -39,6 +39,18 @@ AppendFileNameDevicePath ( IN CHAR16 *FileName ); +/** + Locate the terminating node inside the device path. + + @param[in] DevicePath The device path used in the search. + + @return Returned is the last Device Path Node. +**/ +EFI_DEVICE_PATH_PROTOCOL * +FindDevicePathEndNode ( + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath + ); + /** Locate the node inside the device path specified by Type an SubType values. diff --git a/Library/OcDevicePathLib/OcDevicePathLib.c b/Library/OcDevicePathLib/OcDevicePathLib.c index b3f05e2e..89b8f745 100644 --- a/Library/OcDevicePathLib/OcDevicePathLib.c +++ b/Library/OcDevicePathLib/OcDevicePathLib.c @@ -70,6 +70,18 @@ AppendFileNameDevicePath ( return AppendedDevicePath; } +EFI_DEVICE_PATH_PROTOCOL * +FindDevicePathEndNode ( + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath + ) +{ + while (!IsDevicePathEnd (DevicePath)) { + DevicePath = NextDevicePathNode (DevicePath); + } + + return DevicePath; +} + EFI_DEVICE_PATH_PROTOCOL * FindDevicePathNodeWithType ( IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,