]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
Patch to remove STATIC modifier. This is on longer recommended by EFI Framework codin...
[mirror_edk2.git] / MdePkg / Library / UefiDevicePathLibDevicePathProtocol / UefiDevicePathLib.c
index 2492e4b95db373f9a56716cb8d1b724160c382d0..6ea34237bc552e072f5235ee06dbf5f4e7efb35e 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
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
 \r
-STATIC EFI_DEVICE_PATH_UTILITIES_PROTOCOL          *mDevicePathUtilities = NULL;\r
+#include <Uefi.h>\r
+\r
+#include <Protocol/DevicePathUtilities.h>\r
+#include <Protocol/DevicePath.h>\r
+\r
+#include <Library/DevicePathLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+\r
+EFI_DEVICE_PATH_UTILITIES_PROTOCOL          *mDevicePathUtilities = NULL;\r
 \r
 /**\r
   The constructor function caches the pointer to DevicePathUtilites protocol.\r
@@ -103,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
@@ -130,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
@@ -233,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
@@ -313,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
@@ -350,4 +361,3 @@ FileDevicePath (
 \r
   return DevicePath;\r
 }\r
-\r