]> 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 6a587ab1c57086ff61341aaa6d3134433b8778a6..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
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-  Module Name:  UefiDevicePathLib.c\r
-\r
 **/\r
 \r
-//\r
-// The package level header files this module uses\r
-//\r
+\r
 #include <Uefi.h>\r
-//\r
-// The protocols, PPI and GUID defintions for this module\r
-//\r
+\r
 #include <Protocol/DevicePathUtilities.h>\r
 #include <Protocol/DevicePath.h>\r
-//\r
-// The Library classes this module consumes\r
-//\r
+\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/BaseLib.h>\r
@@ -33,7 +26,7 @@
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiBootServicesTableLib.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
@@ -117,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
@@ -144,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
@@ -247,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
@@ -327,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
@@ -345,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
@@ -364,4 +361,3 @@ FileDevicePath (
 \r
   return DevicePath;\r
 }\r
-\r