]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Comments update and code refine.
authorQiu Shumin <shumin.qiu@intel.com>
Tue, 14 Oct 2014 01:16:38 +0000 (01:16 +0000)
committershenshushi <shenshushi@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 14 Oct 2014 01:16:38 +0000 (01:16 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16209 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c

index c3083b800a9310aeadb77a86823aa036fabe0668..a87e4b1bf1c3f16ce1eb5c69d5941374493353b0 100644 (file)
@@ -25,7 +25,6 @@
   @retval TRUE            The move is across file system.\r
   @retval FALSE           The move is within a file system.\r
 **/\r
-STATIC\r
 BOOLEAN\r
 EFIAPI\r
 IsBetweenFileSystem(\r
@@ -69,17 +68,16 @@ IsBetweenFileSystem(
 \r
   if the move is invalid this function will report the error to StdOut.\r
 \r
-  @param FullName [in]    The name of the file to move.\r
-  @param Cwd      [in]    The current working directory\r
-  @param DestPath [in]    The target location to move to\r
-  @param Attribute[in]    The Attribute of the file\r
-  @param DestAttr [in]    The Attribute of the destination\r
-  @param FileStatus[in]   The Status of the file when opened\r
+  @param SourcePath [in]    The name of the file to move.\r
+  @param Cwd        [in]    The current working directory\r
+  @param DestPath   [in]    The target location to move to\r
+  @param Attribute  [in]    The Attribute of the file\r
+  @param DestAttr   [in]    The Attribute of the destination\r
+  @param FileStatus [in]    The Status of the file when opened\r
 \r
   @retval TRUE        The move is valid\r
   @retval FALSE       The move is not\r
 **/\r
-STATIC\r
 BOOLEAN\r
 EFIAPI\r
 IsValidMove(\r
@@ -152,13 +150,14 @@ IsValidMove(
   @param[in] DestParameter               The original path to the destination.\r
   @param[in, out] DestPathPointer  A pointer to the callee allocated final path.\r
   @param[in] Cwd                   A pointer to the current working directory.\r
+  @param[in] SingleSource          TRUE to have only one source file.\r
+  @param[in, out] DestAttr         A pointer to the destination information attribute.\r
 \r
   @retval SHELL_INVALID_PARAMETER  The DestParameter could not be resolved to a location.\r
   @retval SHELL_INVALID_PARAMETER  The DestParameter could be resolved to more than 1 location.\r
   @retval SHELL_INVALID_PARAMETER  Cwd is required and is NULL.\r
   @retval SHELL_SUCCESS            The operation was sucessful.\r
 **/\r
-STATIC\r
 SHELL_STATUS\r
 EFIAPI\r
 GetDestinationLocation(\r
@@ -275,6 +274,15 @@ GetDestinationLocation(
   return (SHELL_SUCCESS);\r
 }\r
 \r
+/**\r
+  Function to do a move across file systems.\r
+\r
+  @param[in] Node               A pointer to the file to be removed.\r
+  @param[in] DestPath           A pointer to the destination file path.\r
+  @param[out] Resp              A pointer to response from question.  Pass back on looped calling\r
+\r
+  @retval SHELL_SUCCESS     The source file was moved to the destination.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 MoveBetweenFileSystems(\r
@@ -304,6 +312,17 @@ MoveBetweenFileSystems(
   return (Status);\r
 }\r
 \r
+/**\r
+  Function to take the destination path and target file name to generate the full destination path.\r
+\r
+  @param[in] DestPath           A pointer to the destination file path string.\r
+  @param[out] FullDestPath      A pointer to the full destination path string.\r
+  @param[in] FileName           Name string of  the targe file.\r
+\r
+  @retval SHELL_SUCCESS             the files were all moved.\r
+  @retval SHELL_INVALID_PARAMETER   a parameter was invalid\r
+  @retval SHELL_OUT_OF_RESOURCES    a memory allocation failed\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 CreateFullDestPath(\r
@@ -333,6 +352,16 @@ CreateFullDestPath(
   return (EFI_SUCCESS);\r
 }\r
 \r
+/**\r
+  Function to do a move within a file system.\r
+\r
+  @param[in] Node               A pointer to the file to be removed.\r
+  @param[in] DestPath           A pointer to the destination file path.\r
+  @param[out] Resp              A pointer to response from question.  Pass back on looped calling.\r
+\r
+  @retval SHELL_SUCCESS           The source file was moved to the destination.\r
+  @retval SHELL_OUT_OF_RESOURCES  A memory allocation failed.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 MoveWithinFileSystems(\r
@@ -414,7 +443,6 @@ MoveWithinFileSystems(
   @retval SHELL_WRITE_PROTECTED     the destination was write protected\r
   @retval SHELL_OUT_OF_RESOURCES    a memory allocation failed\r
 **/\r
-STATIC\r
 SHELL_STATUS\r
 EFIAPI\r
 ValidateAndMoveFiles(\r
@@ -513,17 +541,17 @@ ValidateAndMoveFiles(
     //\r
     // Validate that the move is valid\r
     //\r
-    if (!IsValidMove(Node->FullName, Cwd, FullDestPath?FullDestPath:DestPath, Node->Info->Attribute, Attr, Node->Status)) {\r
+    if (!IsValidMove(Node->FullName, Cwd, FullDestPath!=NULL? FullDestPath:DestPath, Node->Info->Attribute, Attr, Node->Status)) {\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
       continue;\r
     }\r
 \r
-    ShellPrintEx(-1, -1, HiiOutput, Node->FullName, FullDestPath?FullDestPath:DestPath);\r
+    ShellPrintEx(-1, -1, HiiOutput, Node->FullName, FullDestPath!=NULL? FullDestPath:DestPath);\r
 \r
     //\r
     // See if destination exists\r
     //\r
-    if (!EFI_ERROR(ShellFileExists(FullDestPath?FullDestPath:DestPath))) {\r
+    if (!EFI_ERROR(ShellFileExists(FullDestPath!=NULL? FullDestPath:DestPath))) {\r
       if (Response == NULL) {\r
         ShellPromptForResponseHii(ShellPromptResponseTypeYesNoAllCancel, STRING_TOKEN (STR_GEN_DEST_EXIST_OVR), gShellLevel2HiiHandle, &Response);\r
       }\r
@@ -549,14 +577,14 @@ ValidateAndMoveFiles(
           FreePool(Response);\r
           return SHELL_ABORTED;\r
       }\r
-      Status = ShellDeleteFileByName(FullDestPath?FullDestPath:DestPath);\r
+      Status = ShellDeleteFileByName(FullDestPath!=NULL? FullDestPath:DestPath);\r
     }\r
 \r
     if (IsBetweenFileSystem(Node->FullName, Cwd, DestPath)) {\r
       while (FullDestPath == NULL && DestPath != NULL && DestPath[0] != CHAR_NULL && DestPath[StrLen(DestPath) - 1] == L'\\') {\r
         DestPath[StrLen(DestPath) - 1] = CHAR_NULL;\r
       }\r
-      Status = MoveBetweenFileSystems(Node, FullDestPath?FullDestPath:DestPath, &Response);\r
+      Status = MoveBetweenFileSystems(Node, FullDestPath!=NULL? FullDestPath:DestPath, &Response);\r
     } else {\r
       Status = MoveWithinFileSystems(Node, DestPath, &Response);\r
     }\r