X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FDevicePathDxe%2FDevicePathToText.c;h=d45c267ffbbcfe5c9387c0444bc5820e66032d85;hb=3069bc194422eea310b17effd6700f6e0b5b58e8;hp=a9f6afcf4a177f58778e41bfbc8eed1ceee9cf10;hpb=1232b21473646661a4ac1ae4b7bf5113d4613e83;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c b/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c index a9f6afcf4a..d45c267ffb 100644 --- a/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c +++ b/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c @@ -14,41 +14,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "DevicePath.h" -/** - Adjusts the size of a previously allocated buffer. - - @param OldPool A pointer to the buffer whose size is being adjusted. - @param OldSize The size of the current buffer. - @param NewSize The size of the new buffer. - - @return A pointer to the new buffer or NULL if allocation fails. - -**/ -VOID * -ReallocatePool ( - IN VOID *OldPool, - IN UINTN OldSize, - IN UINTN NewSize - ) -{ - VOID *NewPool; - - NewPool = NULL; - if (NewSize != 0) { - NewPool = AllocateZeroPool (NewSize); - } - - if (OldPool != NULL) { - if (NewPool != NULL) { - CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize); - } - - FreePool (OldPool); - } - - return NewPool; -} - /** Concatenates a formatted unicode string to allocated pool. The caller must free the resulting buffer. @@ -90,10 +55,10 @@ CatPrint ( Size = StrSize (AppendStr) - sizeof (UINT16); Size = Size + StrSize (Str->Str); Str->Str = ReallocatePool ( - Str->Str, - StrSize (Str->Str), - Size - ); + StrSize (Str->Str), + Size, + Str->Str + ); ASSERT (Str->Str != NULL); } @@ -108,9 +73,9 @@ CatPrint ( } /** - Converts a PCI device path structure to its string representive. + Converts a PCI device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -135,9 +100,9 @@ DevPathToTextPci ( } /** - Converts a PC Card device path structure to its string representive. + Converts a PC Card device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -162,9 +127,9 @@ DevPathToTextPccard ( } /** - Converts a Memory Map device path structure to its string representive. + Converts a Memory Map device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -195,9 +160,9 @@ DevPathToTextMemMap ( } /** - Converts a Vendor device path structure to its string representive. + Converts a Vendor device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -243,7 +208,7 @@ DevPathToTextVendor ( } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) { CatPrint (Str, L"VenUft8()"); return ; - } else if (CompareGuid (&Vendor->Guid, &mEfiDevicePathMessagingUartFlowControlGuid)) { + } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) { FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap); switch (FlowControlMap & 0x00000003) { case 0: @@ -263,7 +228,7 @@ DevPathToTextVendor ( } return ; - } else if (CompareGuid (&Vendor->Guid, &mEfiDevicePathMessagingSASGuid)) { + } else if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) { CatPrint ( Str, L"SAS(0x%lx,0x%lx,0x%x,", @@ -322,9 +287,9 @@ DevPathToTextVendor ( } /** - Converts a Controller device path structure to its string representive. + Converts a Controller device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -353,9 +318,9 @@ DevPathToTextController ( } /** - Converts a ACPI device path structure to its string representive. + Converts a ACPI device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -439,9 +404,9 @@ EisaIdToText ( } /** - Converts a ACPI extended HID device path structure to its string representive. + Converts a ACPI extended HID device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -523,9 +488,9 @@ DevPathToTextAcpiEx ( } /** - Converts a ACPI address device path structure to its string representive. + Converts a ACPI address device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -560,9 +525,9 @@ DevPathToTextAcpiAdr ( } /** - Converts a ATAPI device path structure to its string representive. + Converts a ATAPI device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -598,9 +563,9 @@ DevPathToTextAtapi ( } /** - Converts a SCSI device path structure to its string representive. + Converts a SCSI device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -625,9 +590,9 @@ DevPathToTextScsi ( } /** - Converts a Fibre device path structure to its string representive. + Converts a Fibre device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -652,9 +617,9 @@ DevPathToTextFibre ( } /** - Converts a 1394 device path structure to its string representive. + Converts a 1394 device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -682,9 +647,9 @@ DevPathToText1394 ( } /** - Converts a USB device path structure to its string representive. + Converts a USB device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -709,9 +674,9 @@ DevPathToTextUsb ( } /** - Converts a USB WWID device path structure to its string representive. + Converts a USB WWID device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -743,6 +708,7 @@ DevPathToTextUsbWWID ( // In case no NULL terminator in SerialNumber, create a new one with NULL terminator // NewStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), SerialNumberStr); + ASSERT (NewStr != NULL); NewStr [Length] = 0; SerialNumberStr = NewStr; } @@ -758,9 +724,9 @@ DevPathToTextUsbWWID ( } /** - Converts a Logic Unit device path structure to its string representive. + Converts a Logic Unit device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -785,9 +751,9 @@ DevPathToTextLogicalUnit ( } /** - Converts a USB class device path structure to its string representive. + Converts a USB class device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -921,9 +887,9 @@ DevPathToTextUsbClass ( } /** - Converts a SATA device path structure to its string representive. + Converts a SATA device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -954,9 +920,9 @@ DevPathToTextSata ( } /** - Converts a I20 device path structure to its string representive. + Converts a I20 device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -981,9 +947,9 @@ DevPathToTextI2O ( } /** - Converts a MAC address device path structure to its string representive. + Converts a MAC address device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1022,9 +988,9 @@ DevPathToTextMacAddr ( } /** - Converts a IPv4 device path structure to its string representive. + Converts a IPv4 device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1074,9 +1040,9 @@ DevPathToTextIPv4 ( } /** - Converts a IPv6 device path structure to its string representive. + Converts a IPv6 device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1162,9 +1128,9 @@ DevPathToTextIPv6 ( } /** - Converts an Infini Band device path structure to its string representive. + Converts an Infini Band device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1197,9 +1163,9 @@ DevPathToTextInfiniBand ( } /** - Converts a UART device path structure to its string representive. + Converts a UART device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1289,9 +1255,9 @@ DevPathToTextUart ( } /** - Converts an iSCSI device path structure to its string representive. + Converts an iSCSI device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1337,9 +1303,9 @@ DevPathToTextiSCSI ( } /** - Converts a Hard drive device path structure to its string representive. + Converts a Hard drive device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1395,9 +1361,9 @@ DevPathToTextHardDrive ( } /** - Converts a CDROM device path structure to its string representive. + Converts a CDROM device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1427,9 +1393,9 @@ DevPathToTextCDROM ( } /** - Converts a File device path structure to its string representive. + Converts a File device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1454,9 +1420,9 @@ DevPathToTextFilePath ( } /** - Converts a Media protocol device path structure to its string representive. + Converts a Media protocol device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1481,9 +1447,9 @@ DevPathToTextMediaProtocol ( } /** - Converts a Firmware Volume device path structure to its string representive. + Converts a Firmware Volume device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1508,9 +1474,9 @@ DevPathToTextFv ( } /** - Converts a Firmware Volume File device path structure to its string representive. + Converts a Firmware Volume File device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1535,9 +1501,9 @@ DevPathToTextFvFile ( } /** - Converts a BIOS Boot Specification device path structure to its string representive. + Converts a BIOS Boot Specification device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1604,9 +1570,9 @@ DevPathToTextBBS ( } /** - Converts an End-of-Device-Path structure to its string representive. + Converts an End-of-Device-Path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1628,9 +1594,9 @@ DevPathToTextEndInstance ( } /** - Converts an unknown device path structure to its string representive. + Converts an unknown device path structure to its string representative. - @param Str The string representive of input device. + @param Str The string representative of input device. @param DevPath The input device path structure. @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation of the display node is used, where applicable. If DisplayOnly @@ -1752,7 +1718,7 @@ ConvertDeviceNodeToText ( // Shrink pool used for string allocation // NewSize = (Str.Len + 1) * sizeof (CHAR16); - Str.Str = ReallocatePool (Str.Str, NewSize, NewSize); + Str.Str = ReallocatePool (NewSize, NewSize, Str.Str); ASSERT (Str.Str != NULL); Str.Str[Str.Len] = 0; return Str.Str; @@ -1841,7 +1807,7 @@ ConvertDevicePathToText ( } NewSize = (Str.Len + 1) * sizeof (CHAR16); - Str.Str = ReallocatePool (Str.Str, NewSize, NewSize); + Str.Str = ReallocatePool (NewSize, NewSize, Str.Str); ASSERT (Str.Str != NULL); Str.Str[Str.Len] = 0; return Str.Str;