]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcMtftp.c
code scrub for UefiPxeBcDxe.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / UefiPxeBcDxe / PxeBcMtftp.c
index b49ff2d52ca53d2868dff387a650950d1819e51e..928b99a8202401703673f0a5be078b5a17528b6f 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
-\r
-Copyright (c) 2007, Intel Corporation\r
+  PxeBc MTFTP functions.\r
+  \r
+Copyright (c) 2007, 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
@@ -9,15 +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
-  PxeBcMtftp.c\r
-\r
-Abstract:\r
-\r
-  PxeBc MTFTP functions\r
-\r
-\r
 **/\r
 \r
 #include "PxeBcImpl.h"\r
@@ -35,13 +27,19 @@ CHAR8 *mMtftpOptions[PXE_MTFTP_OPTION_MAXIMUM_INDEX] = {
 /**\r
   This is a callback function when packets received/transmitted in Mtftp driver.\r
 \r
+  A callback function that is provided by the caller to intercept               \r
+  the EFI_MTFTP4_OPCODE_DATA or EFI_MTFTP4_OPCODE_DATA8 packets processed in the\r
+  EFI_MTFTP4_PROTOCOL.ReadFile() function, and alternatively to intercept       \r
+  EFI_MTFTP4_OPCODE_OACK or EFI_MTFTP4_OPCODE_ERROR packets during a call to    \r
+  EFI_MTFTP4_PROTOCOL.ReadFile(), WriteFile() or ReadDirectory().\r
+   \r
   @param  This           Pointer to Mtftp protocol instance\r
   @param  Token          Pointer to Mtftp token\r
   @param  PacketLen      Length of Mtftp packet\r
   @param  Packet         Pointer to Mtftp packet\r
 \r
-  @return EFI_SUCCESS\r
-  @return EFI_ABORTED\r
+  @retval EFI_SUCCESS    Operation sucess\r
+  @retval EFI_ABORTED    Abort transfer process \r
 \r
 **/\r
 EFI_STATUS\r
@@ -90,17 +88,18 @@ PxeBcCheckPacket (
 \r
 /**\r
   This function is to get size of a file by Tftp.\r
-\r
+  \r
   @param  Private        Pointer to PxeBc private data\r
   @param  Config         Pointer to Mtftp configuration data\r
   @param  Filename       Pointer to file name\r
   @param  BlockSize      Pointer to block size\r
   @param  BufferSize     Pointer to buffer size\r
 \r
-  @return EFI_SUCCESS\r
-  @return EFI_NOT_FOUND\r
-  @return EFI_DEVICE_ERROR\r
-\r
+  @retval EFI_SUCCESS        Get the size of file success\r
+  @retval EFI_NOT_FOUND      Parse the tftp ptions failed.\r
+  @retval EFI_DEVICE_ERROR   The network device encountered an error during this operation.\r
+  @retval Other              Has not get the size of the file.\r
+  \r
 **/\r
 EFI_STATUS\r
 PxeBcTftpGetFileSize (\r
@@ -161,7 +160,11 @@ PxeBcTftpGetFileSize (
     if (Packet->OpCode == EFI_MTFTP4_OPCODE_ERROR) {\r
       Private->Mode.TftpErrorReceived = TRUE;\r
       Private->Mode.TftpError.ErrorCode = (UINT8) Packet->Error.ErrorCode;\r
-      AsciiStrnCpy (Private->Mode.TftpError.ErrorString, (CHAR8 *) Packet->Error.ErrorMessage, 127);\r
+      AsciiStrnCpy (\r
+        Private->Mode.TftpError.ErrorString, \r
+        (CHAR8 *) Packet->Error.ErrorMessage, \r
+        127\r
+        );\r
     }\r
     goto ON_ERROR;\r
   }\r
@@ -219,9 +222,10 @@ ON_ERROR:
   @param  BufferSize     Pointer to buffer size\r
   @param  DontUseBuffer  Indicate whether with a receive buffer\r
 \r
-  @return EFI_SUCCESS\r
-  @return EFI_DEVICE_ERROR\r
-\r
+  @retval EFI_SUCCESS        Read the data success from the special file.\r
+  @retval EFI_DEVICE_ERROR   The network device encountered an error during this operation.\r
+  @retval other              Read data from file failed.\r
+  \r
 **/\r
 EFI_STATUS\r
 PxeBcTftpReadFile (\r
@@ -301,9 +305,10 @@ PxeBcTftpReadFile (
   @param  BufferPtr      Pointer to buffer\r
   @param  BufferSize     Pointer to buffer size\r
 \r
-  @return EFI_SUCCESS\r
-  @return EFI_DEVICE_ERROR\r
-\r
+  @retval EFI_SUCCESS        Write the data success into the special file.\r
+  @retval EFI_DEVICE_ERROR   The network device encountered an error during this operation.\r
+  @retval other              Write data into file failed.\r
+  \r
 **/\r
 EFI_STATUS\r
 PxeBcTftpWriteFile (\r
@@ -364,21 +369,21 @@ PxeBcTftpWriteFile (
 \r
 \r
 /**\r
-  This function is to get data of a directory by Tftp.\r
-\r
-  @param  Private        Pointer to PxeBc private data\r
-  @param  Config         Pointer to Mtftp configuration data\r
-  @param  Filename       Pointer to file name\r
-  @param  BlockSize      Pointer to block size\r
-  @param  BufferPtr      Pointer to buffer\r
-  @param  BufferSize     Pointer to buffer size\r
-  @param  DontUseBuffer  Indicate whether with a receive buffer\r
-\r
-  @return EFI_SUCCES\r
-  @return EFI_DEVICE_ERROR\r
-\r
+  This function is to get data(file) from a directory(may be a server) by Tftp.\r
+\r
+  @param  Private        Pointer to PxeBc private data.\r
+  @param  Config         Pointer to Mtftp configuration data.\r
+  @param  Filename       Pointer to file name.\r
+  @param  BlockSize      Pointer to block size.\r
+  @param  BufferPtr      Pointer to buffer.\r
+  @param  BufferSize     Pointer to buffer size.\r
+  @param  DontUseBuffer  Indicate whether with a receive buffer.\r
+\r
+  @retval EFI_SUCCES         Get the data from the file included in directory success. \r
+  @retval EFI_DEVICE_ERROR   The network device encountered an error during this operation.\r
+  @retval other              Operation failed.\r
+  \r
 **/\r
-// GC_NOTO:    EFI_SUCCESS - add return value to function comment\r
 EFI_STATUS\r
 PxeBcTftpReadDirectory (\r
   IN PXEBC_PRIVATE_DATA            *Private,\r