]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1 update function header
authorywu21 <ywu21@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 10 Dec 2008 03:58:26 +0000 (03:58 +0000)
committerywu21 <ywu21@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 10 Dec 2008 03:58:26 +0000 (03:58 +0000)
2 update file header
3 correct some expression: Non-Boolean comparisons must use a compare operator
4 corrent some variable naming

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6960 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c

index 7cbf362275656aaf15d6305bafc5c6b945964192..b967714d1be4e2e06313672aa2cc79d25746be28 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Miscellaneous routines for IScsi driver.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation\r
+Copyright (c) 2004 - 2008, Intel Corporation.<BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -10,14 +10,6 @@ http://opensource.org/licenses/bsd-license.php
 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:\r
-\r
-  IScsiMisc.c\r
-\r
-Abstract:\r
-\r
-  Miscellaneous routines for IScsi driver.\r
-\r
 **/\r
 \r
 #include "IScsiImpl.h"\r
@@ -27,65 +19,62 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8  IScsiHexString[] = "0123456789ABCDEFa
 /**\r
   Removes (trims) specified leading and trailing characters from a string.\r
 \r
-  @param  str[in][out] Pointer to the null-terminated string to be trimmed. On return, \r
-                       str will hold the trimmed string. \r
-\r
-  @param  CharC[in]    Character will be trimmed from str.\r
-\r
-  @retval NONE.\r
+  @param[in, out]  Str  Pointer to the null-terminated string to be trimmed. On return, \r
+                        str will hold the trimmed string. \r
 \r
+  @param[in]      CharC Character will be trimmed from str.\r
 **/\r
 VOID\r
 StrTrim (\r
-  IN OUT CHAR16   *str,\r
+  IN OUT CHAR16   *Str,\r
   IN     CHAR16   CharC\r
   )\r
 {\r
-  CHAR16  *p1;\r
-  CHAR16  *p2;\r
+  CHAR16  *Pointer1;\r
+  CHAR16  *Pointer2;\r
   \r
-  if (*str == 0) {\r
+  if (*Str == 0) {\r
     return;\r
   }\r
   \r
   //\r
   // Trim off the leading and trailing characters c\r
   //\r
-  for (p1 = str; *p1 && *p1 == CharC; p1++) {\r
+  for (Pointer1 = Str; (*Pointer1 != 0) && (*Pointer1 == CharC); Pointer1++) {\r
     ;\r
   }\r
   \r
-  p2 = str;\r
-  if (p2 == p1) {\r
-    while (*p1) {\r
-      p2++;\r
-      p1++;\r
+  Pointer2 = Str;\r
+  if (Pointer2 == Pointer1) {\r
+    while (*Pointer1 != 0) {\r
+      Pointer2++;\r
+      Pointer1++;\r
     }\r
   } else {\r
-    while (*p1) {    \r
-    *p2 = *p1;    \r
-    p1++;\r
-    p2++;\r
+    while (*Pointer1 != 0) {    \r
+    *Pointer2 = *Pointer1;    \r
+    Pointer1++;\r
+    Pointer2++;\r
     }\r
-    *p2 = 0;\r
+    *Pointer2 = 0;\r
   }\r
   \r
   \r
-  for (p1 = str + StrLen(str) - 1; p1 >= str && *p1 == CharC; p1--) {\r
+  for (Pointer1 = Str + StrLen(Str) - 1; Pointer1 >= Str && *Pointer1 == CharC; Pointer1--) {\r
     ;\r
   }\r
-  if  (p1 !=  str + StrLen(str) - 1) { \r
-    *(p1 + 1) = 0;\r
+  if  (Pointer1 !=  Str + StrLen(Str) - 1) { \r
+    *(Pointer1 + 1) = 0;\r
   }\r
 }\r
 \r
 /**\r
   Calculate the prefix length of the IPv4 subnet mask.\r
 \r
-  @param  SubnetMask[in] The IPv4 subnet mask.\r
-\r
-  @retval The prefix length of the subnet mask.\r
+  @param[in]  SubnetMask The IPv4 subnet mask.\r
 \r
+  @return The prefix length of the subnet mask.\r
+  @return 0 Some unexpected error happened.\r
 **/\r
 UINT8\r
 IScsiGetSubnetMaskPrefixLength (\r
@@ -105,7 +94,7 @@ IScsiGetSubnetMaskPrefixLength (
   //\r
   ReverseMask = ~ReverseMask;\r
 \r
-  if (ReverseMask & (ReverseMask + 1)) {\r
+  if ((ReverseMask != 0) & ((ReverseMask + 1) != 0)) {\r
     return 0;\r
   }\r
 \r
@@ -122,14 +111,11 @@ IScsiGetSubnetMaskPrefixLength (
 /**\r
   Convert the hexadecimal encoded LUN string into the 64-bit LUN. \r
 \r
-  @param  Str[in]               The hexadecimal encoded LUN string.\r
-\r
-  @param  Lun[out]              Storage to return the 64-bit LUN.\r
+  @param[in]   Str             The hexadecimal encoded LUN string.\r
+  @param[out]  Lun             Storage to return the 64-bit LUN.\r
 \r
   @retval EFI_SUCCESS           The 64-bit LUN is stored in Lun.\r
-\r
   @retval EFI_INVALID_PARAMETER The string is malformatted.\r
-\r
 **/\r
 EFI_STATUS\r
 IScsiAsciiStrToLun (\r
@@ -192,12 +178,8 @@ IScsiAsciiStrToLun (
 /**\r
   Convert the 64-bit LUN into the hexadecimal encoded LUN string.\r
 \r
-  @param  Lun[in]  The 64-bit LUN.\r
-\r
-  @param  Str[out] The storage to return the hexadecimal encoded LUN string.\r
-\r
-  @retval None.\r
-\r
+  @param[in]   Lun The 64-bit LUN.\r
+  @param[out]  Str The storage to return the hexadecimal encoded LUN string.\r
 **/\r
 VOID\r
 IScsiLunToUnicodeStr (\r
@@ -242,12 +224,10 @@ IScsiLunToUnicodeStr (
 /**\r
   Convert the ASCII string into a UNICODE string.\r
 \r
-  @param  Source[out]      The ASCII string.\r
-\r
-  @param  Destination[out] The storage to return the UNICODE string.\r
-\r
-  @retval CHAR16 *         Pointer to the UNICODE string.\r
+  @param[in]   Source      The ASCII string.\r
+  @param[out]  Destination The storage to return the UNICODE string.\r
 \r
+  @return CHAR16 *         Pointer to the UNICODE string.\r
 **/\r
 CHAR16 *\r
 IScsiAsciiStrToUnicodeStr (\r
@@ -270,12 +250,11 @@ IScsiAsciiStrToUnicodeStr (
 /**\r
   Convert the UNICODE string into an ASCII string.\r
 \r
-  @param  Source[in]       The UNICODE string.\r
-\r
-  @param  Destination[out] The storage to return the ASCII string.\r
-\r
-  @retval CHAR8 *          Pointer to the ASCII string.\r
+  @param[in]  Source       The UNICODE string.\r
+  @param[out] Destination  The storage to return the ASCII string.\r
 \r
+  @return CHAR8 *          Pointer to the ASCII string.\r
+**/\r
 **/\r
 CHAR8 *\r
 IScsiUnicodeStrToAsciiStr (\r
@@ -303,14 +282,11 @@ IScsiUnicodeStrToAsciiStr (
 /**\r
   Convert the decimal dotted IPv4 address into the binary IPv4 address.\r
 \r
-  @param  Str[in]               The UNICODE string.\r
-\r
-  @param  Ip[out]               The storage to return the ASCII string.\r
+  @param[in]   Str             The UNICODE string.\r
+  @param[out]  Ip              The storage to return the ASCII string.\r
 \r
   @retval EFI_SUCCESS           The binary IP address is returned in Ip.\r
-\r
   @retval EFI_INVALID_PARAMETER The IP string is malformatted.\r
-\r
 **/\r
 EFI_STATUS\r
 IScsiAsciiStrToIp (\r
@@ -369,14 +345,9 @@ IScsiAsciiStrToIp (
 /**\r
   Convert the mac address into a hexadecimal encoded "-" seperated string.\r
 \r
-  @param  Mac[in]  The mac address.\r
-\r
-  @param  Len[in]  Length in bytes of the mac address.\r
-\r
-  @param  Str[out] The storage to return the mac string.\r
-\r
-  @retval None.\r
-\r
+  @param[in]  Mac The mac address.\r
+  @param[in]  Len  Length in bytes of the mac address.\r
+  @param[out] Str The storage to return the mac string.\r
 **/\r
 VOID\r
 IScsiMacAddrToStr (\r
@@ -399,19 +370,15 @@ IScsiMacAddrToStr (
 /**\r
   Convert the binary encoded buffer into a hexadecimal encoded string.\r
 \r
-  @param  BinBuffer[in]        The buffer containing the binary data.\r
-\r
-  @param  BinLength[in]        Length of the binary buffer.\r
-\r
-  @param  HexStr[in][out]      Pointer to the string.\r
-\r
-  @param  HexLength[in][out]   The length of the string.\r
+  @param[in]       BinBuffer   The buffer containing the binary data.\r
+  @param[in]       BinLength   Length of the binary buffer.\r
+  @param[in, out]  HexStr      Pointer to the string.\r
+  @param[in, out]  HexLength   The length of the string.\r
 \r
   @retval EFI_SUCCESS          The binary data is converted to the hexadecimal string \r
                                and the length of the string is updated.\r
-\r
   @retval EFI_BUFFER_TOO_SMALL The string is too small.\r
-\r
+  @retval EFI_INVALID_PARAMETER The IP string is malformatted.\r
 **/\r
 EFI_STATUS\r
 IScsiBinToHex (\r
@@ -452,17 +419,13 @@ IScsiBinToHex (
 /**\r
   Convert the hexadecimal string into a binary encoded buffer.\r
 \r
-  @param  BinBuffer[in][out]   The binary buffer.\r
-\r
-  @param  BinLength[in][out]   Length of the binary buffer.\r
-\r
-  @param  HexStr[in]           The hexadecimal string.\r
+  @param[in, out]  BinBuffer   The binary buffer.\r
+  @param[in, out]  BinLength   Length of the binary buffer.\r
+  @param[in]       HexStr      The hexadecimal string.\r
 \r
   @retval EFI_SUCCESS          The hexadecimal string is converted into a binary\r
                                encoded buffer.\r
-\r
   @retval EFI_BUFFER_TOO_SMALL The binary buffer is too small to hold the converted data.s\r
-\r
 **/\r
 EFI_STATUS\r
 IScsiHexToBin (\r
@@ -525,12 +488,8 @@ IScsiHexToBin (
 /**\r
   Generate random numbers.\r
 \r
-  @param  Rand[in][out]  The buffer to contain random numbers.\r
-\r
-  @param  RandLength[in] The length of the Rand buffer.\r
-\r
-  @retval None.\r
-\r
+  @param[in, out]  Rand       The buffer to contain random numbers.\r
+  @param[in]       RandLength The length of the Rand buffer.\r
 **/\r
 VOID\r
 IScsiGenRandom (\r
@@ -550,12 +509,11 @@ IScsiGenRandom (
 /**\r
   Create the iSCSI driver data..\r
 \r
-  @param  Image[in]      The handle of the driver image.\r
-\r
-  @param  Controller[in] The handle of the controller.\r
-\r
-  @retval The iSCSI driver data created.\r
+  @param[in] Image      The handle of the driver image.\r
+  @param[in] Controller The handle of the controller.\r
 \r
+  @return The iSCSI driver data created.\r
+  @return NULL Some unexpected error happened.\r
 **/\r
 ISCSI_DRIVER_DATA *\r
 IScsiCreateDriverData (\r
@@ -625,10 +583,7 @@ IScsiCreateDriverData (
 /**\r
   Clean the iSCSI driver data.\r
 \r
-  @param  Private[in] The iSCSI driver data.\r
-\r
-  @retval None.\r
-\r
+  @param[in]  Private The iSCSI driver data.\r
 **/\r
 VOID\r
 IScsiCleanDriverData (\r
@@ -659,15 +614,13 @@ IScsiCleanDriverData (
 }\r
 \r
 /**\r
-\r
   Get the various configuration data of this iSCSI instance.\r
 \r
-  @param  Private[in]   The iSCSI driver data.\r
+  @param[in]  Private   The iSCSI driver data.\r
 \r
   @retval EFI_SUCCESS   The configuration of this instance is got.\r
-\r
-  @retval EFI_NOT_FOUND This iSCSI instance is not configured yet.\r
-\r
+  @retval EFI_ABORTED   The operation was aborted.\r
+  @retval Others        Some unexpected error happened.\r
 **/\r
 EFI_STATUS\r
 IScsiGetConfigData (\r
@@ -754,10 +707,10 @@ IScsiGetConfigData (
 /**\r
   Get the device path of the iSCSI tcp connection and update it.\r
 \r
-  @param  Private[in] The iSCSI driver data.\r
-\r
-  @retval The updated device path.\r
+  @param[in]  Private The iSCSI driver data.\r
 \r
+  @return The updated device path.\r
+  @return NULL Some unexpected error happened.\r
 **/\r
 EFI_DEVICE_PATH_PROTOCOL *\r
 IScsiGetTcpConnDevicePath (\r
@@ -818,12 +771,8 @@ IScsiGetTcpConnDevicePath (
 /**\r
   Abort the session when the transition from BS to RT is initiated.\r
 \r
-  @param  Event[in]   The event signaled.\r
-\r
-  @param  Context[in] The iSCSI driver data.\r
-\r
-  @retval None.\r
-\r
+  @param[in]   Event  The event signaled.\r
+  @param[in]  Context The iSCSI driver data.\r
 **/\r
 VOID\r
 EFIAPI\r