Provides interface to shell internal functions for shell commands.\r
\r
This library is for use ONLY by shell commands linked into the shell application.\r
- This library will not funciton if it is used for UEFI Shell 2.0 Applications.\r
+ This library will not function if it is used for UEFI Shell 2.0 Applications.\r
\r
- Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
(C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.<BR>\r
- 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
- http://opensource.org/licenses/bsd-license.php.\r
-\r
- 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
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
/// List of Mappings - DeviceName and Drive Letter(ism).\r
extern SHELL_MAP_LIST gShellMapList;\r
/// Pointer to node of current directory in the mMapList.\r
-extern SHELL_MAP_LIST *gShellCurDir;\r
+extern SHELL_MAP_LIST *gShellCurMapping;\r
\r
/**\r
Returns the help MAN fileName for a given shell command.\r
IN UINT32 ShellMinSupportLevel,\r
IN CONST CHAR16 *ProfileName,\r
IN CONST BOOLEAN CanAffectLE,\r
- IN CONST EFI_HANDLE HiiHandle,\r
+ IN CONST EFI_HII_HANDLE HiiHandle,\r
IN CONST EFI_STRING_ID ManFormatHelp\r
);\r
\r
);\r
\r
/**\r
- Create a consistent mapped name for the device specified by DevicePath \r
+ Create a consistent mapped name for the device specified by DevicePath\r
based on the Table.\r
\r
- This must be called after ShellCommandConsistMappingInitialize() and \r
+ This must be called after ShellCommandConsistMappingInitialize() and\r
before ShellCommandConsistMappingUnInitialize() is called.\r
\r
@param[in] DevicePath The pointer to the dev path for the device.\r
@param[in] UserData Pointer to some data.\r
**/\r
VOID\r
+EFIAPI\r
DumpHex (\r
IN UINTN Indent,\r
IN UINTN Offset,\r
@param[in] UserData The data to print out.\r
**/\r
CHAR16*\r
+EFIAPI\r
CatSDumpHex (\r
IN CHAR16 *Buffer,\r
IN UINTN Indent,\r
IN UINTN DataSize,\r
IN VOID *UserData\r
);\r
+\r
+//\r
+// Determines the ordering operation for ShellSortFileList().\r
+//\r
+typedef enum {\r
+ //\r
+ // Sort the EFI_SHELL_FILE_INFO objects by the FileName field, in increasing\r
+ // order, using gUnicodeCollation->StriColl().\r
+ //\r
+ ShellSortFileListByFileName,\r
+ //\r
+ // Sort the EFI_SHELL_FILE_INFO objects by the FullName field, in increasing\r
+ // order, using gUnicodeCollation->StriColl().\r
+ //\r
+ ShellSortFileListByFullName,\r
+ ShellSortFileListMax\r
+} SHELL_SORT_FILE_LIST;\r
+\r
+/**\r
+ Sort an EFI_SHELL_FILE_INFO list, optionally moving duplicates to a separate\r
+ list.\r
+\r
+ @param[in,out] FileList The list of EFI_SHELL_FILE_INFO objects to sort.\r
+\r
+ If FileList is NULL on input, then FileList is\r
+ considered an empty, hence already sorted, list.\r
+\r
+ Otherwise, if (*FileList) is NULL on input, then\r
+ EFI_INVALID_PARAMETER is returned.\r
+\r
+ Otherwise, the caller is responsible for having\r
+ initialized (*FileList)->Link with\r
+ InitializeListHead(). No other fields in the\r
+ (**FileList) head element are accessed by this\r
+ function.\r
+\r
+ On output, (*FileList) is sorted according to Order.\r
+ If Duplicates is NULL on input, then duplicate\r
+ elements are preserved, sorted stably, on\r
+ (*FileList). If Duplicates is not NULL on input,\r
+ then duplicates are moved (stably sorted) to the\r
+ new, dynamically allocated (*Duplicates) list.\r
+\r
+ @param[out] Duplicates If Duplicates is NULL on input, (*FileList) will be\r
+ a monotonically ordered list on output, with\r
+ duplicates stably sorted.\r
+\r
+ If Duplicates is not NULL on input, (*FileList) will\r
+ be a strictly monotonically oredered list on output,\r
+ with duplicates separated (stably sorted) to\r
+ (*Duplicates). All fields except Link will be\r
+ zero-initialized in the (**Duplicates) head element.\r
+ If no duplicates exist, then (*Duplicates) is set to\r
+ NULL on output.\r
+\r
+ @param[in] Order Determines the comparison operation between\r
+ EFI_SHELL_FILE_INFO objects.\r
+\r
+ @retval EFI_INVALID_PARAMETER (UINTN)Order is greater than or equal to\r
+ (UINTN)ShellSortFileListMax. Neither the\r
+ (*FileList) nor the (*Duplicates) list has\r
+ been modified.\r
+\r
+ @retval EFI_INVALID_PARAMETER (*FileList) was NULL on input. Neither the\r
+ (*FileList) nor the (*Duplicates) list has\r
+ been modified.\r
+\r
+ @retval EFI_OUT_OF_RESOURCES Memory allocation failed. Neither the\r
+ (*FileList) nor the (*Duplicates) list has\r
+ been modified.\r
+\r
+ @retval EFI_SUCCESS Sorting successful, including the case when\r
+ FileList is NULL on input.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ShellSortFileList (\r
+ IN OUT EFI_SHELL_FILE_INFO **FileList,\r
+ OUT EFI_SHELL_FILE_INFO **Duplicates OPTIONAL,\r
+ IN SHELL_SORT_FILE_LIST Order\r
+ );\r
#endif //_SHELL_COMMAND_LIB_\r