X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FIScsiDxe%2FIScsiMisc.c;fp=MdeModulePkg%2FUniversal%2FNetwork%2FIScsiDxe%2FIScsiMisc.c;h=d924a8b82427ef372ad3325cbcf3e0e29ce43518;hp=19577ff1824228b1cda773e55fa68b882687c71c;hb=d1102dba7210b95e41d06c2338a22ba6af248645;hpb=ca79bab7af4770c5eb578f6d495af01705aedb79 diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c index 19577ff182..d924a8b824 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c @@ -19,8 +19,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 IScsiHexString[] = "0123456789ABCDEFa /** Removes (trims) specified leading and trailing characters from a string. - @param[in, out] Str Pointer to the null-terminated string to be trimmed. On return, - Str will hold the trimmed string. + @param[in, out] Str Pointer to the null-terminated string to be trimmed. On return, + Str will hold the trimmed string. @param[in] CharC Character will be trimmed from str. **/ @@ -32,18 +32,18 @@ StrTrim ( { CHAR16 *Pointer1; CHAR16 *Pointer2; - + if (*Str == 0) { return; } - + // // Trim off the leading and trailing characters c // for (Pointer1 = Str; (*Pointer1 != 0) && (*Pointer1 == CharC); Pointer1++) { ; } - + Pointer2 = Str; if (Pointer2 == Pointer1) { while (*Pointer1 != 0) { @@ -51,19 +51,19 @@ StrTrim ( Pointer1++; } } else { - while (*Pointer1 != 0) { - *Pointer2 = *Pointer1; + while (*Pointer1 != 0) { + *Pointer2 = *Pointer1; Pointer1++; Pointer2++; } *Pointer2 = 0; } - - + + for (Pointer1 = Str + StrLen(Str) - 1; Pointer1 >= Str && *Pointer1 == CharC; Pointer1--) { ; } - if (Pointer1 != Str + StrLen(Str) - 1) { + if (Pointer1 != Str + StrLen(Str) - 1) { *(Pointer1 + 1) = 0; } } @@ -109,7 +109,7 @@ IScsiGetSubnetMaskPrefixLength ( } /** - Convert the hexadecimal encoded LUN string into the 64-bit LUN. + Convert the hexadecimal encoded LUN string into the 64-bit LUN. @param[in] Str The hexadecimal encoded LUN string. @param[out] Lun Storage to return the 64-bit LUN. @@ -127,11 +127,11 @@ IScsiAsciiStrToLun ( CHAR8 TemStr[2]; UINT8 TemValue; UINT16 Value[4]; - + ZeroMem (Lun, 8); ZeroMem (TemStr, 2); ZeroMem ((UINT8 *) Value, sizeof (Value)); - SizeStr = AsciiStrLen (Str); + SizeStr = AsciiStrLen (Str); IndexValue = 0; IndexNum = 0; @@ -146,7 +146,7 @@ IScsiAsciiStrToLun ( return EFI_INVALID_PARAMETER; } } - + if ((TemValue == 0) && (TemStr[0] == '-')) { // // Next Lun value @@ -163,24 +163,24 @@ IScsiAsciiStrToLun ( IndexNum = 0; continue; } - + if (++IndexNum > 4) { - // + // // Each Lun Str can't exceed size 4, because it will be as UINT16 value // return EFI_INVALID_PARAMETER; } - + // // Combine UINT16 value // Value[IndexValue] = (UINT16) ((Value[IndexValue] << 4) + TemValue); } - + for (Index = 0; Index <= IndexValue; Index ++) { *((UINT16 *) &Lun[Index * 2]) = HTONS (Value[Index]); } - + return EFI_SUCCESS; } @@ -392,7 +392,7 @@ IScsiMacAddrToStr ( @param[in, out] HexStr Pointer to the string. @param[in, out] HexLength The length of the string. - @retval EFI_SUCCESS The binary data is converted to the hexadecimal string + @retval EFI_SUCCESS The binary data is converted to the hexadecimal string and the length of the string is updated. @retval EFI_BUFFER_TOO_SMALL The string is too small. @retval EFI_INVALID_PARAMETER The IP string is malformatted. @@ -455,7 +455,7 @@ IScsiHexToBin ( UINTN Length; UINT8 Digit; CHAR8 TemStr[2]; - + ZeroMem (TemStr, sizeof (TemStr)); // @@ -464,7 +464,7 @@ IScsiHexToBin ( if ((HexStr[0] == '0') && ((HexStr[1] == 'x') || (HexStr[1] == 'X'))) { HexStr += 2; } - + Length = AsciiStrLen (HexStr); for (Index = 0; Index < Length; Index ++) { @@ -482,7 +482,7 @@ IScsiHexToBin ( BinBuffer [Index/2] = (UINT8) ((BinBuffer [Index/2] << 4) + Digit); } } - + *BinLength = (UINT32) ((Index + 1)/2); return EFI_SUCCESS; @@ -601,7 +601,7 @@ IScsiCleanDriverData ( EFI_STATUS Status; Status = EFI_SUCCESS; - + if (Private->DevicePath != NULL) { Status = gBS->UninstallProtocolInterface ( Private->ExtScsiPassThruHandle, @@ -627,7 +627,7 @@ EXIT: if (Private->ExitBootServiceEvent != NULL) { gBS->CloseEvent (Private->ExitBootServiceEvent); } - + FreePool (Private); return Status; } @@ -636,10 +636,10 @@ EXIT: Check wheather the Controller is configured to use DHCP protocol. @param[in] Controller The handle of the controller. - + @retval TRUE The handle of the controller need the Dhcp protocol. @retval FALSE The handle of the controller does not need the Dhcp protocol. - + **/ BOOLEAN IScsiDhcpIsConfigured ( @@ -826,7 +826,7 @@ IScsiGetTcpConnDevicePath ( ) { DPathNode->Ipv4.LocalPort = 0; - DPathNode->Ipv4.StaticIpAddress = + DPathNode->Ipv4.StaticIpAddress = (BOOLEAN) (!Session->ConfigData.NvData.InitiatorInfoFromDhcp); // @@ -835,7 +835,7 @@ IScsiGetTcpConnDevicePath ( // do not exist. // In new version of IPv4_DEVICE_PATH, structcure length is 27. // - if (DevicePathNodeLength (&DPathNode->Ipv4) == IP4_NODE_LEN_NEW_VERSIONS) { + if (DevicePathNodeLength (&DPathNode->Ipv4) == IP4_NODE_LEN_NEW_VERSIONS) { IP4_COPY_ADDRESS ( &DPathNode->Ipv4.GatewayIpAddress, @@ -873,7 +873,7 @@ IScsiOnExitBootService ( ISCSI_DRIVER_DATA *Private; Private = (ISCSI_DRIVER_DATA *) Context; - + gBS->CloseEvent (Private->ExitBootServiceEvent); Private->ExitBootServiceEvent = NULL; @@ -887,7 +887,7 @@ IScsiOnExitBootService ( currently managing the controller specified by ControllerHandle. This test is performed by evaluating if the the protocol specified by ProtocolGuid is present on ControllerHandle and is was opened by DriverBindingHandle and Nic - Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. + Device handle with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. If ProtocolGuid is NULL, then ASSERT(). @param ControllerHandle A handle for a controller to test.