]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
Remove UefiHiiLib & UefiIfrSupportLib. They have been moved to MdeModulePkg.
[mirror_edk2.git] / MdePkg / Library / UefiDevicePathLibDevicePathProtocol / UefiDevicePathLib.c
index e9193cf1b23f244d4444775559bd9ffe76f71030..37a0ae792be21579854fd232208d199d3585b6a2 100644 (file)
@@ -1,5 +1,6 @@
 /** @file\r
-  UEFI Device Path Library.\r
+  Library instance that implement UEFI Device Path Library class based on protocol\r
+  gEfiDevicePathUtilitiesProtocolGuid.\r
 \r
   Copyright (c) 2006, Intel Corporation<BR>\r
   All rights reserved. This program and the accompanying materials\r
@@ -25,9 +26,7 @@
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 \r
-#include "UefiDevicePathLibInternal.h"\r
-\r
-STATIC EFI_DEVICE_PATH_UTILITIES_PROTOCOL          *mDevicePathUtilities = NULL;\r
+EFI_DEVICE_PATH_UTILITIES_PROTOCOL          *mDevicePathUtilities = NULL;\r
 \r
 /**\r
   The constructor function caches the pointer to DevicePathUtilites protocol.\r
@@ -111,7 +110,8 @@ DuplicateDevicePath (
   SecondDevicePath is retained. The newly created device path is returned.  \r
   If FirstDevicePath is NULL, then it is ignored, and a duplicate of SecondDevicePath is returned.  \r
   If SecondDevicePath is NULL, then it is ignored, and a duplicate of FirstDevicePath is returned.  \r
-  If both FirstDevicePath and SecondDevicePath are NULL, then NULL is returned.  \r
+  If both FirstDevicePath and SecondDevicePath are NULL, then a copy of an end-of-device-path is\r
+  returned.  \r
   If there is not enough memory for the newly allocated buffer, then NULL is returned.\r
   The memory for the new device path is allocated from EFI boot services memory. It is the\r
   responsibility of the caller to free the memory allocated.\r
@@ -138,8 +138,11 @@ AppendDevicePath (
   This function creates a new device path by appending a copy of the device node specified by\r
   DevicePathNode to a copy of the device path specified by DevicePath in an allocated buffer.\r
   The end-of-device-path device node is moved after the end of the appended device node.\r
-  If DevicePath is NULL, then NULL is returned.\r
-  If DevicePathNode is NULL, then NULL is returned.\r
+  If DevicePathNode is NULL then a copy of DevicePath is returned.\r
+  If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device path device\r
+  node is returned.\r
+  If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path device node\r
+  is returned.\r
   If there is not enough memory to allocate space for the new device path, then NULL is returned.  \r
   The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r
   free the memory allocated.\r
@@ -241,7 +244,7 @@ GetNextDevicePathInstance (
   @param  NodeSubType                The device node sub-type for the new device node.\r
   @param  NodeLength                 The length of the new device node.\r
 \r
-  @return The new device path.\r
+  @return A pointer to the new created file device path \r
 \r
 **/\r
 EFI_DEVICE_PATH_PROTOCOL *\r
@@ -321,7 +324,7 @@ DevicePathFromHandle (
                                      may be NULL.\r
   @param  FileName                   A pointer to a Null-terminated Unicode string.\r
 \r
-  @return The allocated device path.\r
+  @return A pointer to the new created file device path \r
 \r
 **/\r
 EFI_DEVICE_PATH_PROTOCOL *\r
@@ -339,7 +342,7 @@ FileDevicePath (
   DevicePath = NULL;\r
 \r
   Size = StrSize (FileName);\r
-  FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + EFI_END_DEVICE_PATH_LENGTH);\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
@@ -358,4 +361,3 @@ FileDevicePath (
 \r
   return DevicePath;\r
 }\r
-\r