From e5dab01618850f8c8be029336ad93dcd1680865f Mon Sep 17 00:00:00 2001 From: klu2 Date: Tue, 11 Nov 2008 15:39:02 +0000 Subject: 1, Move device path utility macros from protocol's header file to DevicePathLib library classes 2, Remove Unpack type git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6455 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/UefiDevicePathLib/UefiDevicePathLib.c | 25 +++++++++++----------- .../UefiDevicePathLib.c | 2 +- MdePkg/Library/UefiLib/UefiLib.inf | 3 ++- MdePkg/Library/UefiLib/UefiLibInternal.h | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) (limited to 'MdePkg/Library') diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c index 2d266c70b7..708b48a088 100644 --- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c +++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c @@ -70,14 +70,14 @@ GetDevicePathSize ( // Search for the end of the device path structure // Start = DevicePath; - while (!EfiIsDevicePathEnd (DevicePath)) { - DevicePath = EfiNextDevicePathNode (DevicePath); + while (!IsDevicePathEnd (DevicePath)) { + DevicePath = NextDevicePathNode (DevicePath); } // // Compute the size and add back in the size of the end device path structure // - return ((UINTN) DevicePath - (UINTN) Start) + EfiDevicePathNodeLength (DevicePath); + return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath); } /** @@ -166,7 +166,7 @@ AppendDevicePath ( // Size1 = GetDevicePathSize (FirstDevicePath); Size2 = GetDevicePathSize (SecondDevicePath); - Size = Size1 + Size2 - EFI_END_DEVICE_PATH_LENGTH; + Size = Size1 + Size2 - END_DEVICE_PATH_LENGTH; NewDevicePath = AllocatePool (Size); @@ -176,7 +176,7 @@ AppendDevicePath ( // Over write FirstDevicePath EndNode and do the copy // DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath + - (Size1 - EFI_END_DEVICE_PATH_LENGTH)); + (Size1 - END_DEVICE_PATH_LENGTH)); CopyMem (DevicePath2, SecondDevicePath, Size2); } @@ -224,7 +224,7 @@ AppendDevicePathNode ( // NodeLength = DevicePathNodeLength (DevicePathNode); - TempDevicePath = AllocatePool (NodeLength + EFI_END_DEVICE_PATH_LENGTH); + TempDevicePath = AllocatePool (NodeLength + END_DEVICE_PATH_LENGTH); if (TempDevicePath == NULL) { return NULL; } @@ -451,12 +451,12 @@ IsDevicePathMultiInstance ( } Node = DevicePath; - while (!EfiIsDevicePathEnd (Node)) { - if (EfiIsDevicePathEndInstance (Node)) { + while (!IsDevicePathEnd (Node)) { + if (IsDevicePathEndInstance (Node)) { return TRUE; } - Node = EfiNextDevicePathNode (Node); + Node = NextDevicePathNode (Node); } return FALSE; @@ -518,15 +518,16 @@ FileDevicePath ( IN CONST CHAR16 *FileName ) { - UINTN Size; + UINT16 Size; FILEPATH_DEVICE_PATH *FilePath; EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *FileDevicePath; DevicePath = NULL; - Size = StrSize (FileName); - FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + EFI_END_DEVICE_PATH_LENGTH); + Size = (UINT16) StrSize (FileName); + + FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH); if (FileDevicePath != NULL) { FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath; FilePath->Header.Type = MEDIA_DEVICE_PATH; diff --git a/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c b/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c index 6ea34237bc..37a0ae792b 100644 --- a/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c +++ b/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c @@ -342,7 +342,7 @@ FileDevicePath ( DevicePath = NULL; Size = StrSize (FileName); - FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + EFI_END_DEVICE_PATH_LENGTH); + FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH); if (FileDevicePath != NULL) { FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath; FilePath->Header.Type = MEDIA_DEVICE_PATH; diff --git a/MdePkg/Library/UefiLib/UefiLib.inf b/MdePkg/Library/UefiLib/UefiLib.inf index 315eec1d5c..103014cd3d 100644 --- a/MdePkg/Library/UefiLib/UefiLib.inf +++ b/MdePkg/Library/UefiLib/UefiLib.inf @@ -55,7 +55,8 @@ BaseLib UefiBootServicesTableLib UefiRuntimeServicesTableLib - + DevicePathLib + [Guids] gEfiEventReadyToBootGuid # ALWAYS_CONSUMED gEfiEventLegacyBootGuid # ALWAYS_CONSUMED diff --git a/MdePkg/Library/UefiLib/UefiLibInternal.h b/MdePkg/Library/UefiLib/UefiLibInternal.h index bd4f056098..ef28195b97 100644 --- a/MdePkg/Library/UefiLib/UefiLibInternal.h +++ b/MdePkg/Library/UefiLib/UefiLibInternal.h @@ -35,6 +35,6 @@ #include #include #include - +#include #endif -- cgit v1.2.3