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