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,