]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / UefiDevicePathLibDevicePathProtocol / UefiDevicePathLib.c
index 8fdd9490b50322f5e0e7eddb264b3a47cd3ecf8e..4ff9308a68fe915939cc662a20ccfbe09e9059a5 100644 (file)
@@ -7,7 +7,6 @@
 \r
 **/\r
 \r
-\r
 #include <Uefi.h>\r
 \r
 #include <Protocol/DevicePathUtilities.h>\r
@@ -22,9 +21,9 @@
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/PcdLib.h>\r
 \r
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_UTILITIES_PROTOCOL *mDevicePathLibDevicePathUtilities = NULL;\r
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PROTOCOL   *mDevicePathLibDevicePathToText    = NULL;\r
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDevicePathLibDevicePathFromText  = NULL;\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_UTILITIES_PROTOCOL  *mDevicePathLibDevicePathUtilities = NULL;\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PROTOCOL    *mDevicePathLibDevicePathToText    = NULL;\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL  *mDevicePathLibDevicePathFromText  = NULL;\r
 \r
 //\r
 // Template for an end-of-device path node.\r
@@ -53,16 +52,16 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_PROTOCOL  mUefiDevicePathLib
 EFI_STATUS\r
 EFIAPI\r
 DevicePathLibConstructor (\r
-  IN      EFI_HANDLE                ImageHandle,\r
-  IN      EFI_SYSTEM_TABLE          *SystemTable\r
+  IN      EFI_HANDLE        ImageHandle,\r
+  IN      EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
-  EFI_STATUS                        Status;\r
+  EFI_STATUS  Status;\r
 \r
   Status = gBS->LocateProtocol (\r
                   &gEfiDevicePathUtilitiesProtocolGuid,\r
                   NULL,\r
-                  (VOID**) &mDevicePathLibDevicePathUtilities\r
+                  (VOID **)&mDevicePathLibDevicePathUtilities\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
   ASSERT (mDevicePathLibDevicePathUtilities != NULL);\r
@@ -87,13 +86,13 @@ DevicePathLibConstructor (
 BOOLEAN\r
 EFIAPI\r
 IsDevicePathValid (\r
-  IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
-  IN       UINTN                    MaxSize\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath,\r
+  IN       UINTN                     MaxSize\r
   )\r
 {\r
-  UINTN Count;\r
-  UINTN Size;\r
-  UINTN NodeLength;\r
+  UINTN  Count;\r
+  UINTN  Size;\r
+  UINTN  NodeLength;\r
 \r
   ASSERT (DevicePath != NULL);\r
 \r
@@ -117,6 +116,7 @@ IsDevicePathValid (
     if (NodeLength > MAX_UINTN - Size) {\r
       return FALSE;\r
     }\r
+\r
     Size += NodeLength;\r
 \r
     //\r
@@ -136,9 +136,10 @@ IsDevicePathValid (
     //\r
     // FilePath must be a NULL-terminated string.\r
     //\r
-    if (DevicePathType (DevicePath) == MEDIA_DEVICE_PATH &&\r
-        DevicePathSubType (DevicePath) == MEDIA_FILEPATH_DP &&\r
-        *(CHAR16 *)((UINT8 *)DevicePath + NodeLength - 2) != 0) {\r
+    if ((DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) &&\r
+        (DevicePathSubType (DevicePath) == MEDIA_FILEPATH_DP) &&\r
+        (*(CHAR16 *)((UINT8 *)DevicePath + NodeLength - 2) != 0))\r
+    {\r
       return FALSE;\r
     }\r
   }\r
@@ -146,7 +147,7 @@ IsDevicePathValid (
   //\r
   // Only return TRUE when the End Device Path node is valid.\r
   //\r
-  return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);\r
+  return (BOOLEAN)(DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);\r
 }\r
 \r
 /**\r
@@ -239,7 +240,7 @@ NextDevicePathNode (
   )\r
 {\r
   ASSERT (Node != NULL);\r
-  return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node));\r
+  return (EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength (Node));\r
 }\r
 \r
 /**\r
@@ -268,7 +269,7 @@ IsDevicePathEndType (
   )\r
 {\r
   ASSERT (Node != NULL);\r
-  return (BOOLEAN) (DevicePathType (Node) == END_DEVICE_PATH_TYPE);\r
+  return (BOOLEAN)(DevicePathType (Node) == END_DEVICE_PATH_TYPE);\r
 }\r
 \r
 /**\r
@@ -294,7 +295,7 @@ IsDevicePathEnd (
   )\r
 {\r
   ASSERT (Node != NULL);\r
-  return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE);\r
+  return (BOOLEAN)(IsDevicePathEndType (Node) && DevicePathSubType (Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE);\r
 }\r
 \r
 /**\r
@@ -322,7 +323,7 @@ IsDevicePathEndInstance (
   )\r
 {\r
   ASSERT (Node != NULL);\r
-  return (BOOLEAN) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);\r
+  return (BOOLEAN)(IsDevicePathEndType (Node) && DevicePathSubType (Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE);\r
 }\r
 \r
 /**\r
@@ -564,8 +565,8 @@ AppendDevicePathInstance (
 EFI_DEVICE_PATH_PROTOCOL *\r
 EFIAPI\r
 GetNextDevicePathInstance (\r
-  IN OUT EFI_DEVICE_PATH_PROTOCOL    **DevicePath,\r
-  OUT UINTN                          *Size\r
+  IN OUT EFI_DEVICE_PATH_PROTOCOL  **DevicePath,\r
+  OUT UINTN                        *Size\r
   )\r
 {\r
   ASSERT (Size != NULL);\r
@@ -594,9 +595,9 @@ GetNextDevicePathInstance (
 EFI_DEVICE_PATH_PROTOCOL *\r
 EFIAPI\r
 CreateDeviceNode (\r
-  IN UINT8                           NodeType,\r
-  IN UINT8                           NodeSubType,\r
-  IN UINT16                          NodeLength\r
+  IN UINT8   NodeType,\r
+  IN UINT8   NodeSubType,\r
+  IN UINT16  NodeLength\r
   )\r
 {\r
   return mDevicePathLibDevicePathUtilities->CreateDeviceNode (NodeType, NodeSubType, NodeLength);\r
@@ -642,7 +643,7 @@ IsDevicePathMultiInstance (
 EFI_DEVICE_PATH_PROTOCOL *\r
 EFIAPI\r
 DevicePathFromHandle (\r
-  IN EFI_HANDLE                      Handle\r
+  IN EFI_HANDLE  Handle\r
   )\r
 {\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
@@ -651,11 +652,12 @@ DevicePathFromHandle (
   Status = gBS->HandleProtocol (\r
                   Handle,\r
                   &gEfiDevicePathProtocolGuid,\r
-                  (VOID *) &DevicePath\r
+                  (VOID *)&DevicePath\r
                   );\r
   if (EFI_ERROR (Status)) {\r
     DevicePath = NULL;\r
   }\r
+\r
   return DevicePath;\r
 }\r
 \r
@@ -684,8 +686,8 @@ DevicePathFromHandle (
 EFI_DEVICE_PATH_PROTOCOL *\r
 EFIAPI\r
 FileDevicePath (\r
-  IN EFI_HANDLE                      Device      OPTIONAL,\r
-  IN CONST CHAR16                    *FileName\r
+  IN EFI_HANDLE    Device      OPTIONAL,\r
+  IN CONST CHAR16  *FileName\r
   )\r
 {\r
   UINTN                     Size;\r
@@ -695,10 +697,10 @@ FileDevicePath (
 \r
   DevicePath = NULL;\r
 \r
-  Size = StrSize (FileName);\r
+  Size           = StrSize (FileName);\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                 = (FILEPATH_DEVICE_PATH *)FileDevicePath;\r
     FilePath->Header.Type    = MEDIA_DEVICE_PATH;\r
     FilePath->Header.SubType = MEDIA_FILEPATH_DP;\r
     CopyMem (&FilePath->PathName, FileName, Size);\r
@@ -725,15 +727,16 @@ FileDevicePath (
 **/\r
 VOID *\r
 UefiDevicePathLibLocateProtocol (\r
-  EFI_GUID                         *ProtocolGuid\r
+  EFI_GUID  *ProtocolGuid\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-  VOID       *Protocol;\r
+  EFI_STATUS  Status;\r
+  VOID        *Protocol;\r
+\r
   Status = gBS->LocateProtocol (\r
                   ProtocolGuid,\r
                   NULL,\r
-                  (VOID**) &Protocol\r
+                  (VOID **)&Protocol\r
                   );\r
   if (EFI_ERROR (Status)) {\r
     return NULL;\r
@@ -768,6 +771,7 @@ ConvertDeviceNodeToText (
   if (mDevicePathLibDevicePathToText == NULL) {\r
     mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);\r
   }\r
+\r
   if (mDevicePathLibDevicePathToText != NULL) {\r
     return mDevicePathLibDevicePathToText->ConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts);\r
   } else {\r
@@ -793,14 +797,15 @@ ConvertDeviceNodeToText (
 CHAR16 *\r
 EFIAPI\r
 ConvertDevicePathToText (\r
-  IN CONST EFI_DEVICE_PATH_PROTOCOL   *DevicePath,\r
-  IN BOOLEAN                          DisplayOnly,\r
-  IN BOOLEAN                          AllowShortcuts\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath,\r
+  IN BOOLEAN                         DisplayOnly,\r
+  IN BOOLEAN                         AllowShortcuts\r
   )\r
 {\r
   if (mDevicePathLibDevicePathToText == NULL) {\r
     mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid);\r
   }\r
+\r
   if (mDevicePathLibDevicePathToText != NULL) {\r
     return mDevicePathLibDevicePathToText->ConvertDevicePathToText (DevicePath, DisplayOnly, AllowShortcuts);\r
   } else {\r
@@ -822,12 +827,13 @@ ConvertDevicePathToText (
 EFI_DEVICE_PATH_PROTOCOL *\r
 EFIAPI\r
 ConvertTextToDeviceNode (\r
-  IN CONST CHAR16 *TextDeviceNode\r
+  IN CONST CHAR16  *TextDeviceNode\r
   )\r
 {\r
   if (mDevicePathLibDevicePathFromText == NULL) {\r
     mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid);\r
   }\r
+\r
   if (mDevicePathLibDevicePathFromText != NULL) {\r
     return mDevicePathLibDevicePathFromText->ConvertTextToDeviceNode (TextDeviceNode);\r
   } else {\r
@@ -850,12 +856,13 @@ ConvertTextToDeviceNode (
 EFI_DEVICE_PATH_PROTOCOL *\r
 EFIAPI\r
 ConvertTextToDevicePath (\r
-  IN CONST CHAR16 *TextDevicePath\r
+  IN CONST CHAR16  *TextDevicePath\r
   )\r
 {\r
   if (mDevicePathLibDevicePathFromText == NULL) {\r
     mDevicePathLibDevicePathFromText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathFromTextProtocolGuid);\r
   }\r
+\r
   if (mDevicePathLibDevicePathFromText != NULL) {\r
     return mDevicePathLibDevicePathFromText->ConvertTextToDevicePath (TextDevicePath);\r
   } else {\r