]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c
1, Move device path utility macros from protocol's header file to DevicePathLib libra...
[mirror_edk2.git] / MdePkg / Library / UefiDevicePathLib / UefiDevicePathLib.c
index 2d266c70b76fc7f97cec6fbadbdf0ff54904ae25..708b48a088e42d19ade75df6aa435f247a00de5e 100644 (file)
@@ -70,14 +70,14 @@ GetDevicePathSize (
   // Search for the end of the device path structure\r
   //\r
   Start = DevicePath;\r
-  while (!EfiIsDevicePathEnd (DevicePath)) {\r
-    DevicePath = EfiNextDevicePathNode (DevicePath);\r
+  while (!IsDevicePathEnd (DevicePath)) {\r
+    DevicePath = NextDevicePathNode (DevicePath);\r
   }\r
 \r
   //\r
   // Compute the size and add back in the size of the end device path structure\r
   //\r
-  return ((UINTN) DevicePath - (UINTN) Start) + EfiDevicePathNodeLength (DevicePath);\r
+  return ((UINTN) DevicePath - (UINTN) Start) + DevicePathNodeLength (DevicePath);\r
 }\r
 \r
 /**\r
@@ -166,7 +166,7 @@ AppendDevicePath (
   //\r
   Size1         = GetDevicePathSize (FirstDevicePath);\r
   Size2         = GetDevicePathSize (SecondDevicePath);\r
-  Size          = Size1 + Size2 - EFI_END_DEVICE_PATH_LENGTH;\r
+  Size          = Size1 + Size2 - END_DEVICE_PATH_LENGTH;\r
 \r
   NewDevicePath = AllocatePool (Size);\r
 \r
@@ -176,7 +176,7 @@ AppendDevicePath (
     // Over write FirstDevicePath EndNode and do the copy\r
     //\r
     DevicePath2 = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath +\r
-                  (Size1 - EFI_END_DEVICE_PATH_LENGTH));\r
+                  (Size1 - END_DEVICE_PATH_LENGTH));\r
     CopyMem (DevicePath2, SecondDevicePath, Size2);\r
   }\r
 \r
@@ -224,7 +224,7 @@ AppendDevicePathNode (
   //\r
   NodeLength = DevicePathNodeLength (DevicePathNode);\r
 \r
-  TempDevicePath = AllocatePool (NodeLength + EFI_END_DEVICE_PATH_LENGTH);\r
+  TempDevicePath = AllocatePool (NodeLength + END_DEVICE_PATH_LENGTH);\r
   if (TempDevicePath == NULL) {\r
     return NULL;\r
   }\r
@@ -451,12 +451,12 @@ IsDevicePathMultiInstance (
   }\r
 \r
   Node = DevicePath;\r
-  while (!EfiIsDevicePathEnd (Node)) {\r
-    if (EfiIsDevicePathEndInstance (Node)) {\r
+  while (!IsDevicePathEnd (Node)) {\r
+    if (IsDevicePathEndInstance (Node)) {\r
       return TRUE;\r
     }\r
 \r
-    Node = EfiNextDevicePathNode (Node);\r
+    Node = NextDevicePathNode (Node);\r
   }\r
 \r
   return FALSE;\r
@@ -518,15 +518,16 @@ FileDevicePath (
   IN CONST CHAR16                    *FileName\r
   )\r
 {\r
-  UINT                    Size;\r
+  UINT16                    Size;\r
   FILEPATH_DEVICE_PATH      *FilePath;\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
   EFI_DEVICE_PATH_PROTOCOL  *FileDevicePath;\r
 \r
   DevicePath = NULL;\r
 \r
-  Size = StrSize (FileName);\r
-  FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + EFI_END_DEVICE_PATH_LENGTH);\r
+  Size = (UINT16) StrSize (FileName);\r
+  \r
+  FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH);\r
   if (FileDevicePath != NULL) {\r
     FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;\r
     FilePath->Header.Type    = MEDIA_DEVICE_PATH;\r