]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / UefiShellLevel2CommandsLib.h
CommitLineData
a405b86d 1/** @file\r
2 Main file for NULL named library for level 2 shell command functions.\r
3\r
4 these functions are:\r
5 attrib, cd, cp, date*, time*, rm, reset,\r
6 load, ls, map, mkdir, mv, parse, set, timezone*\r
7\r
8\r
9 * functions are non-interactive only\r
10\r
11\r
ba0014b9 12 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
56ba3746 13 SPDX-License-Identifier: BSD-2-Clause-Patent\r
a405b86d 14\r
15**/\r
16\r
a1d4bfcc 17#ifndef _UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_\r
b54fd049 18#define _UEFI_SHELL_LEVEL2_COMMANDS_LIB_H_\r
19\r
a405b86d 20#include <Uefi.h>\r
a405b86d 21\r
f675a1b4 22#include <Guid/GlobalVariable.h>\r
bca163ff
LG
23#include <Guid/ShellLibHiiGuid.h>\r
24\r
28165f24
RN
25#include <Protocol/Shell.h>\r
26#include <Protocol/ShellParameters.h>\r
a405b86d 27#include <Protocol/DevicePath.h>\r
28#include <Protocol/LoadedImage.h>\r
29#include <Protocol/UnicodeCollation.h>\r
a405b86d 30\r
31#include <Library/BaseLib.h>\r
32#include <Library/BaseMemoryLib.h>\r
33#include <Library/DebugLib.h>\r
34#include <Library/MemoryAllocationLib.h>\r
35#include <Library/PcdLib.h>\r
36#include <Library/ShellCommandLib.h>\r
37#include <Library/ShellLib.h>\r
38#include <Library/UefiLib.h>\r
39#include <Library/UefiRuntimeServicesTableLib.h>\r
40#include <Library/UefiBootServicesTableLib.h>\r
41#include <Library/HiiLib.h>\r
42#include <Library/SortLib.h>\r
43#include <Library/FileHandleLib.h>\r
44\r
47d20b54
MK
45extern CONST CHAR16 mFileName[];\r
46extern EFI_HII_HANDLE gShellLevel2HiiHandle;\r
a405b86d 47\r
48/**\r
49 Function for 'attrib' command.\r
50\r
51 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
52 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
53**/\r
54SHELL_STATUS\r
55EFIAPI\r
56ShellCommandRunAttrib (\r
57 IN EFI_HANDLE ImageHandle,\r
58 IN EFI_SYSTEM_TABLE *SystemTable\r
59 );\r
60\r
61/**\r
62 Function for 'date' command.\r
63\r
64 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
65 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
66**/\r
67SHELL_STATUS\r
68EFIAPI\r
69ShellCommandRunDate (\r
70 IN EFI_HANDLE ImageHandle,\r
71 IN EFI_SYSTEM_TABLE *SystemTable\r
72 );\r
73\r
74/**\r
75 Function for 'time' command.\r
76\r
77 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
78 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
79**/\r
80SHELL_STATUS\r
81EFIAPI\r
82ShellCommandRunTime (\r
83 IN EFI_HANDLE ImageHandle,\r
84 IN EFI_SYSTEM_TABLE *SystemTable\r
85 );\r
86\r
87/**\r
88 Function for 'load' command.\r
89\r
90 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
91 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
92**/\r
93SHELL_STATUS\r
94EFIAPI\r
95ShellCommandRunLoad (\r
96 IN EFI_HANDLE ImageHandle,\r
97 IN EFI_SYSTEM_TABLE *SystemTable\r
98 );\r
99\r
100/**\r
101 Function for 'ls' command.\r
102\r
103 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
104 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
105**/\r
106SHELL_STATUS\r
107EFIAPI\r
108ShellCommandRunLs (\r
109 IN EFI_HANDLE ImageHandle,\r
110 IN EFI_SYSTEM_TABLE *SystemTable\r
111 );\r
112\r
113/**\r
114 Function for 'map' command.\r
115\r
116 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
117 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
118**/\r
119SHELL_STATUS\r
120EFIAPI\r
121ShellCommandRunMap (\r
122 IN EFI_HANDLE ImageHandle,\r
123 IN EFI_SYSTEM_TABLE *SystemTable\r
124 );\r
125\r
126/**\r
127 Function for 'reset' command.\r
128\r
129 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
130 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
131**/\r
132SHELL_STATUS\r
133EFIAPI\r
134ShellCommandRunReset (\r
135 IN EFI_HANDLE ImageHandle,\r
136 IN EFI_SYSTEM_TABLE *SystemTable\r
137 );\r
138\r
139/**\r
140 Function for 'timezone' command.\r
141\r
142 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
143 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
144**/\r
145SHELL_STATUS\r
146EFIAPI\r
147ShellCommandRunTimeZone (\r
148 IN EFI_HANDLE ImageHandle,\r
149 IN EFI_SYSTEM_TABLE *SystemTable\r
150 );\r
151\r
152/**\r
153 Function for 'set' command.\r
154\r
155 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
156 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
157**/\r
158SHELL_STATUS\r
159EFIAPI\r
160ShellCommandRunSet (\r
161 IN EFI_HANDLE ImageHandle,\r
162 IN EFI_SYSTEM_TABLE *SystemTable\r
163 );\r
164\r
165/**\r
166 Function for 'mkdir' command.\r
167\r
168 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
169 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
170**/\r
171SHELL_STATUS\r
172EFIAPI\r
173ShellCommandRunMkDir (\r
174 IN EFI_HANDLE ImageHandle,\r
175 IN EFI_SYSTEM_TABLE *SystemTable\r
176 );\r
177\r
178/**\r
179 Function for 'cd' command.\r
180\r
181 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
182 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
183**/\r
184SHELL_STATUS\r
185EFIAPI\r
186ShellCommandRunCd (\r
187 IN EFI_HANDLE ImageHandle,\r
188 IN EFI_SYSTEM_TABLE *SystemTable\r
189 );\r
190\r
191/**\r
192 Function for 'cp' command.\r
193\r
194 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
195 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
196**/\r
197SHELL_STATUS\r
198EFIAPI\r
199ShellCommandRunCp (\r
200 IN EFI_HANDLE ImageHandle,\r
201 IN EFI_SYSTEM_TABLE *SystemTable\r
202 );\r
203\r
204/**\r
205 Function for 'parse' command.\r
206\r
207 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
208 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
209**/\r
210SHELL_STATUS\r
211EFIAPI\r
212ShellCommandRunParse (\r
213 IN EFI_HANDLE ImageHandle,\r
214 IN EFI_SYSTEM_TABLE *SystemTable\r
215 );\r
216\r
217/**\r
218 Function for 'rm' command.\r
219\r
220 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
221 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
222**/\r
223SHELL_STATUS\r
224EFIAPI\r
225ShellCommandRunRm (\r
226 IN EFI_HANDLE ImageHandle,\r
227 IN EFI_SYSTEM_TABLE *SystemTable\r
228 );\r
229\r
230/**\r
231 Function for 'mv' command.\r
232\r
233 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
234 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
235**/\r
236SHELL_STATUS\r
237EFIAPI\r
238ShellCommandRunMv (\r
239 IN EFI_HANDLE ImageHandle,\r
240 IN EFI_SYSTEM_TABLE *SystemTable\r
241 );\r
242\r
243/**\r
244 returns a fully qualified directory (contains a map drive at the begining)\r
245 path from a unknown directory path.\r
246\r
247 If Path is already fully qualified this will return a duplicat otherwise this\r
248 will use get the current directory and use that to build the fully qualified\r
249 version.\r
250\r
251 if the return value is not NULL it must be caller freed.\r
252\r
253 @param[in] Path The unknown Path Value\r
254\r
255 @retval NULL A memory allocation failed\r
256 @retval NULL a fully qualified path could not be discovered.\r
257 @retval other pointer to a fuly qualified path.\r
258**/\r
47d20b54
MK
259CHAR16 *\r
260GetFullyQualifiedPath (\r
261 IN CONST CHAR16 *Path\r
a405b86d 262 );\r
263\r
264/**\r
265 Function to verify all intermediate directories in the path.\r
266\r
267 @param[in] Path The pointer to the path to fix.\r
268\r
269 @retval EFI_SUCCESS The operation was successful.\r
270**/\r
271EFI_STATUS\r
a405b86d 272VerifyIntermediateDirectories (\r
47d20b54 273 IN CONST CHAR16 *Path\r
a405b86d 274 );\r
275\r
276/**\r
630cb850 277 String comparison without regard to case for a limited number of characters.\r
a405b86d 278\r
630cb850
RN
279 @param[in] Source The first item to compare.\r
280 @param[in] Target The second item to compare.\r
281 @param[in] Count How many characters to compare.\r
a405b86d 282\r
630cb850
RN
283 @retval 0 Source and Target are identical strings without regard to case.\r
284 @retval !=0 Source is not identical to Target.\r
ba0014b9 285\r
a405b86d 286**/\r
630cb850 287INTN\r
47d20b54
MK
288StrniCmp (\r
289 IN CONST CHAR16 *Source,\r
290 IN CONST CHAR16 *Target,\r
291 IN CONST UINTN Count\r
a405b86d 292 );\r
b54fd049 293\r
0960ba17
QS
294/**\r
295 Cleans off all the quotes in the string.\r
296\r
297 @param[in] OriginalString pointer to the string to be cleaned.\r
ba0014b9
LG
298 @param[out] CleanString The new string with all quotes removed.\r
299 Memory allocated in the function and free\r
0960ba17
QS
300 by caller.\r
301\r
302 @retval EFI_SUCCESS The operation was successful.\r
303**/\r
304EFI_STATUS\r
0960ba17 305ShellLevel2StripQuotes (\r
47d20b54
MK
306 IN CONST CHAR16 *OriginalString,\r
307 OUT CHAR16 **CleanString\r
0960ba17
QS
308 );\r
309\r
b54fd049 310/**\r
311 Function for 'Vol' command.\r
312\r
313 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
314 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
315**/\r
316SHELL_STATUS\r
317EFIAPI\r
318ShellCommandRunVol (\r
319 IN EFI_HANDLE ImageHandle,\r
320 IN EFI_SYSTEM_TABLE *SystemTable\r
321 );\r
322\r
7fe3fbad
JC
323/**\r
324 Function to Copy one file to another location\r
325\r
326 If the destination exists the user will be prompted and the result put into *resp\r
327\r
328 @param[in] Source pointer to source file name\r
329 @param[in] Dest pointer to destination file name\r
330 @param[out] Resp pointer to response from question. Pass back on looped calling\r
331 @param[in] SilentMode whether to run in quiet mode or not\r
bf6bbc21 332 @param[in] CmdName Source command name requesting single file copy\r
7fe3fbad
JC
333\r
334 @retval SHELL_SUCCESS The source file was copied to the destination\r
335**/\r
336SHELL_STATUS\r
47d20b54
MK
337CopySingleFile (\r
338 IN CONST CHAR16 *Source,\r
339 IN CONST CHAR16 *Dest,\r
340 OUT VOID **Resp,\r
341 IN BOOLEAN SilentMode,\r
342 IN CONST CHAR16 *CmdName\r
7fe3fbad
JC
343 );\r
344\r
345/**\r
346 Delete a node and all nodes under it (including sub directories).\r
347\r
348 @param[in] Node The node to start deleting with.\r
349 @param[in] Quiet TRUE to print no messages.\r
350\r
351 @retval SHELL_SUCCESS The operation was successful.\r
352 @retval SHELL_ACCESS_DENIED A file was read only.\r
353 @retval SHELL_ABORTED The abort message was received.\r
a048af3c 354 @retval SHELL_DEVICE_ERROR A device error occurred reading this Node.\r
7fe3fbad
JC
355**/\r
356SHELL_STATUS\r
47d20b54 357CascadeDelete (\r
7fe3fbad
JC
358 IN EFI_SHELL_FILE_INFO *Node,\r
359 IN CONST BOOLEAN Quiet\r
360 );\r
361\r
b54fd049 362#endif\r