]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Include/Protocol/EfiShell.h
1. Update EFI_IP4_MODE_DATA: add MaxPacketSize to this structure to comply with UEFI...
[mirror_edk2.git] / ShellPkg / Include / Protocol / EfiShell.h
Content-type: text/html ]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Include/Protocol/EfiShell.h


500 - Internal Server Error

Malformed UTF-8 character (fatal) at (eval 6) line 1, <$fd> line 1630.
CommitLineData
94b17fa1 1/** @file\r
941b3569 2 EFI Shell protocol as defined in the UEFI Shell 2.0 specification including errata.\r
94b17fa1 3 \r
4 Copyright (c) 2006 - 2009, Intel Corporation \r
5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13**/\r
14\r
15#ifndef __EFI_SHELL_PROTOCOL__\r
16#define __EFI_SHELL_PROTOCOL__\r
17\r
18#include <Protocol/SimpleFileSystem.h>\r
19#include <Guid/FileInfo.h>\r
20\r
21#define EFI_SHELL_PROTOCOL_GUID \\r
22 { \\r
23 0x6302d008, 0x7f9b, 0x4f30, { 0x87, 0xac, 0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e } \\r
24 }\r
25\r
d2b4564b 26// replaced EFI_LIST_ENTRY with LIST_ENTRY for simplicity.\r
27// they are identical outside of the name.\r
94b17fa1 28typedef struct {\r
d2b4564b 29 LIST_ENTRY Link;\r
94b17fa1 30 EFI_STATUS Status;\r
31 CONST CHAR16 *FullName;\r
32 CONST CHAR16 *FileName;\r
33 EFI_FILE_HANDLE Handle;\r
34 EFI_FILE_INFO *Info;\r
35} EFI_SHELL_FILE_INFO;\r
36/**\r
37 Returns whether any script files are currently being processed.\r
38\r
39 @retval TRUE There is at least one script file active.\r
40 @retval FALSE No script files are active now.\r
41\r
42**/\r
43typedef\r
44BOOLEAN\r
45(EFIAPI *EFI_SHELL_BATCH_IS_ACTIVE) (\r
46 VOID\r
47 );\r
48\r
49/**\r
50 Closes the file handle.\r
51\r
52 This function closes a specified file handle. All 'dirty' cached file data is \r
53 flushed to the device, and the file is closed. In all cases, the handle is \r
54 closed.\r
55\r
941b3569 56 @param[in] FileHandle The file handle to be closed\r
94b17fa1 57\r
58 @retval EFI_SUCCESS the file closed sucessfully\r
59**/\r
60typedef\r
61EFI_STATUS\r
62(EFIAPI *EFI_SHELL_CLOSE_FILE)(\r
63 IN EFI_FILE_HANDLE FileHandle\r
64 );\r
65\r
66/**\r
67 Creates a file or directory by name.\r
68\r
69 This function creates an empty new file or directory with the specified attributes and\r
70 returns the new file's handle. If the file already exists and is read-only, then\r
71 EFI_INVALID_PARAMETER will be returned.\r
72 \r
73 If the file already existed, it is truncated and its attributes updated. If the file is\r
74 created successfully, the FileHandle is the file's handle, else, the FileHandle is NULL.\r
75 \r
76 If the file name begins with >v, then the file handle which is returned refers to the\r
77 shell environment variable with the specified name. If the shell environment variable\r
78 already exists and is non-volatile then EFI_INVALID_PARAMETER is returned.\r
79\r
941b3569 80 @param[in] FileName Pointer to null-terminated file path\r
81 @param[in] FileAttribs The new file's attrbiutes. the different attributes are\r
94b17fa1 82 described in EFI_FILE_PROTOCOL.Open().\r
941b3569 83 @param[out] FileHandle On return, points to the created file handle or directory's handle\r
94b17fa1 84\r
85 @retval EFI_SUCCESS The file was opened. FileHandle points to the new file's handle.\r
86 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
87 @retval EFI_UNSUPPORTED could not open the file path\r
88 @retval EFI_NOT_FOUND the specified file could not be found on the devide, or could not\r
89 file the file system on the device.\r
90 @retval EFI_NO_MEDIA the device has no medium.\r
91 @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no\r
92 longer supported.\r
93 @retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according\r
94 the DirName.\r
95 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
96 @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write\r
97 when the media is write-protected.\r
98 @retval EFI_ACCESS_DENIED The service denied access to the file.\r
99 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.\r
100 @retval EFI_VOLUME_FULL The volume is full.\r
101**/\r
102typedef\r
103EFI_STATUS\r
104(EFIAPI *EFI_SHELL_CREATE_FILE)(\r
105 IN CONST CHAR16 *FileName,\r
106 IN UINT64 FileAttribs,\r
107 OUT EFI_FILE_HANDLE *FileHandle\r
108 );\r
109\r
110/**\r
111 Deletes the file specified by the file handle.\r
112\r
113 This function closes and deletes a file. In all cases, the file handle is closed. If the file\r
114 cannot be deleted, the warning code EFI_WARN_DELETE_FAILURE is returned, but the\r
115 handle is still closed.\r
116\r
941b3569 117 @param[in] FileHandle The file handle to delete.\r
94b17fa1 118\r
119 @retval EFI_SUCCESS The file was closed and deleted, and the handle was closed.\r
120 @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.\r
121**/\r
122typedef\r
123EFI_STATUS\r
124(EFIAPI *EFI_SHELL_DELETE_FILE)(\r
125 IN EFI_FILE_HANDLE FileHandle\r
126 );\r
127\r
128/**\r
129 Deletes the file specified by the file name.\r
130\r
131 This function deletes a file.\r
132\r
941b3569 133 @param[in] FileName Points to the null-terminated file name.\r
94b17fa1 134\r
941b3569 135 @retval EFI_SUCCESS The file was closed and deleted, and the handle was closed.\r
94b17fa1 136 @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.\r
137**/\r
138typedef\r
139EFI_STATUS\r
140(EFIAPI *EFI_SHELL_DELETE_FILE_BY_NAME)(\r
141 IN CONST CHAR16 *FileName\r
142 );\r
143\r
144/**\r
145 Disables the page break output mode.\r
146**/\r
147typedef\r
148VOID\r
149(EFIAPI *EFI_SHELL_DISABLE_PAGE_BREAK) (\r
150VOID\r
151);\r
152\r
153/**\r
154 Enables the page break output mode.\r
155**/\r
156typedef\r
157VOID\r
158(EFIAPI *EFI_SHELL_ENABLE_PAGE_BREAK) (\r
159VOID\r
160);\r
161\r
162/**\r
163 Execute the command line.\r
164\r
165 This function creates a nested instance of the shell and executes the specified\r
166 command (CommandLine) with the specified environment (Environment). Upon return,\r
167 the status code returned by the specified command is placed in StatusCode.\r
168 \r
169 If Environment is NULL, then the current environment is used and all changes made\r
170 by the commands executed will be reflected in the current environment. If the\r
171 Environment is non-NULL, then the changes made will be discarded.\r
172 \r
173 The CommandLine is executed from the current working directory on the current\r
174 device.\r
175\r
941b3569 176 @param[in] ParentImageHandle A handle of the image that is executing the specified \r
177 command line. \r
178 @param[in] CommandLine Points to the null-terminated UCS-2 encoded string \r
179 containing the command line. If NULL then the command-\r
180 line will be empty.\r
181 @param[in] Environment Points to a null-terminated array of environment \r
182 variables with the format 'x=y', where x is the \r
183 environment variable name and y is the value. If this\r
184 is NULL, then the current shell environment is used.\r
185 @param[out] ErrorCode Points to the status code returned by the command.\r
186\r
187 @retval EFI_SUCCESS The command executed successfully. The status code \r
188 returned by the command is pointed to by StatusCode.\r
94b17fa1 189 @retval EFI_INVALID_PARAMETER The parameters are invalid.\r
941b3569 190 @retval EFI_OUT_OF_RESOURCES Out of resources.\r
191 @retval EFI_UNSUPPORTED Nested shell invocations are not allowed.\r
94b17fa1 192**/\r
193typedef\r
194EFI_STATUS\r
195(EFIAPI *EFI_SHELL_EXECUTE) (\r
196 IN EFI_HANDLE *ParentImageHandle,\r
197 IN CHAR16 *CommandLine OPTIONAL,\r
198 IN CHAR16 **Environment OPTIONAL,\r
199 OUT EFI_STATUS *StatusCode OPTIONAL\r
200 );\r
201\r
202/**\r
203 Find files that match a specified pattern.\r
204\r
205 This function searches for all files and directories that match the specified\r
206 FilePattern. The FilePattern can contain wild-card characters. The resulting file\r
207 information is placed in the file list FileList.\r
208\r
209 The files in the file list are not opened. The OpenMode field is set to 0 and the FileInfo\r
210 field is set to NULL.\r
211\r
941b3569 212 @param[in] FilePattern Points to a null-terminated shell file path, including wildcards.\r
213 @param[out] FileList On return, points to the start of a file list containing the names \r
214 of all matching files or else points to NULL if no matching files \r
215 were found.\r
94b17fa1 216\r
941b3569 217 @retval EFI_SUCCESS Files found.\r
218 @retval EFI_NOT_FOUND No files found.\r
219 @retval EFI_NO_MEDIA The device has no media\r
220 @retval EFI_DEVICE_ERROR The device reported an error\r
221 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted\r
94b17fa1 222**/\r
223typedef\r
224EFI_STATUS\r
225(EFIAPI *EFI_SHELL_FIND_FILES)(\r
226 IN CONST CHAR16 *FilePattern,\r
227 OUT EFI_SHELL_FILE_INFO **FileList\r
228 );\r
229\r
230/**\r
231 Find all files in a specified directory.\r
232\r
941b3569 233 @param[in] FileDirHandle Handle of the directory to search.\r
234 @param[out] FileList On return, points to the list of files in the directory \r
235 or NULL if there are no files in the directory.\r
94b17fa1 236\r
941b3569 237 @retval EFI_SUCCESS File information was returned successfully.\r
238 @retval EFI_VOLUME_CORRUPTED The file system structures have been corrupted.\r
239 @retval EFI_DEVICE_ERROR The device reported an error.\r
240 @retval EFI_NO_MEDIA The device media is not present.\r
94b17fa1 241**/\r
242typedef\r
243EFI_STATUS\r
244(EFIAPI *EFI_SHELL_FIND_FILES_IN_DIR)(\r
245IN EFI_FILE_HANDLE FileDirHandle,\r
246OUT EFI_SHELL_FILE_INFO **FileList\r
247);\r
248\r
249/**\r
250 Flushes data back to a device\r
251 \r
252 This function flushes all modified data associated with a file to a device.\r
253\r
941b3569 254 @param[in] FileHandle The handle of the file to flush\r
94b17fa1 255\r
256 @retval EFI_SUCCESS The data was flushed.\r
257 @retval EFI_NO_MEDIA The device has no medium.\r
258 @retval EFI_DEVICE_ERROR The device reported an error.\r
259 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.\r
260 @retval EFI_WRITE_PROTECTED The file or medium is write-protected.\r
261 @retval EFI_ACCESS_DENIED The file was opened read-only.\r
262 @retval EFI_VOLUME_FULL The volume is full.\r
263**/\r
264typedef\r
265EFI_STATUS\r
266(EFIAPI *EFI_SHELL_FLUSH_FILE)(\r
267 IN EFI_FILE_HANDLE FileHandle\r
268 );\r
269\r
270/**\r
271 Frees the file list.\r
272 \r
273 This function cleans up the file list and any related data structures. It has no\r
274 impact on the files themselves.\r
275\r
941b3569 276 @param[in] FileList The file list to free. Type EFI_SHELL_FILE_INFO is \r
94b17fa1 277 defined in OpenFileList()\r
278\r
279 @retval EFI_SUCCESS Free the file list successfully.\r
280**/\r
281typedef\r
282EFI_STATUS\r
283(EFIAPI *EFI_SHELL_FREE_FILE_LIST) (\r
284 IN EFI_SHELL_FILE_INFO **FileList\r
285 );\r
286\r
287/**\r
288 Returns the current directory on the specified device.\r
289\r
290 If FileSystemMapping is NULL, it returns the current working directory. If the\r
291 FileSystemMapping is not NULL, it returns the current directory associated with the\r
292 FileSystemMapping. In both cases, the returned name includes the file system\r
293 mapping (i.e. fs0:\current-dir).\r
294\r
941b3569 295 @param[in] FileSystemMapping A pointer to the file system mapping. If NULL, \r
94b17fa1 296 then the current working directory is returned.\r
297 \r
298 @retval !=NULL The current directory.\r
299 @retval NULL Current directory does not exist.\r
300**/\r
301typedef\r
302CONST CHAR16 *\r
303(EFIAPI *EFI_SHELL_GET_CUR_DIR) (\r
304 IN CONST CHAR16 *FileSystemMapping OPTIONAL\r
305 );\r
306\r
307typedef UINT32 EFI_SHELL_DEVICE_NAME_FLAGS;\r
308#define EFI_DEVICE_NAME_USE_COMPONENT_NAME 0x00000001\r
309#define EFI_DEVICE_NAME_USE_DEVICE_PATH 0x00000002\r
310/**\r
311 Gets the name of the device specified by the device handle.\r
312\r
313 This function gets the user-readable name of the device specified by the device\r
314 handle. If no user-readable name could be generated, then *BestDeviceName will be\r
315 NULL and EFI_NOT_FOUND will be returned.\r
316\r
d2b4564b 317 If EFI_DEVICE_NAME_USE_COMPONENT_NAME is set, then the function will return the\r
69817bf8 318 device's name using the EFI_COMPONENT_NAME2_PROTOCOL, if present on\r
d2b4564b 319 DeviceHandle.\r
320\r
321 If EFI_DEVICE_NAME_USE_DEVICE_PATH is set, then the function will return the\r
69817bf8 322 device's name using the EFI_DEVICE_PATH_PROTOCOL, if present on DeviceHandle.\r
d2b4564b 323 If both EFI_DEVICE_NAME_USE_COMPONENT_NAME and\r
324 EFI_DEVICE_NAME_USE_DEVICE_PATH are set, then\r
325 EFI_DEVICE_NAME_USE_COMPONENT_NAME will have higher priority.\r
326\r
941b3569 327 @param[in] DeviceHandle The handle of the device.\r
328 @param[in] Flags Determines the possible sources of component names. \r
329 @param[in] Language A pointer to the language specified for the device \r
94b17fa1 330 name, in the same format as described in the UEFI \r
331 specification, Appendix M \r
941b3569 332 @param[out] BestDeviceName On return, points to the callee-allocated null-\r
94b17fa1 333 terminated name of the device. If no device name \r
334 could be found, points to NULL. The name must be \r
335 freed by the caller...\r
336\r
337 @retval EFI_SUCCESS Get the name successfully.\r
338 @retval EFI_NOT_FOUND Fail to get the device name.\r
339**/\r
340typedef\r
341EFI_STATUS\r
342(*EFI_SHELL_GET_DEVICE_NAME) (\r
343 IN EFI_HANDLE DeviceHandle,\r
344 IN EFI_SHELL_DEVICE_NAME_FLAGS Flags,\r
345 IN CHAR8 *Language,\r
346 OUT CHAR16 **BestDeviceName\r
347 );\r
348\r
349/**\r
350 Gets the device path from the mapping.\r
351\r
352 This function gets the device path associated with a mapping.\r
353\r
941b3569 354 @param[in] Mapping A pointer to the mapping\r
94b17fa1 355\r
356 @retval !=NULL Pointer to the device path that corresponds to the \r
357 device mapping. The returned pointer does not need \r
358 to be freed.\r
359 @retval NULL There is no device path associated with the \r
360 specified mapping.\r
361**/\r
362typedef\r
363CONST EFI_DEVICE_PATH_PROTOCOL *\r
364(EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_MAP) (\r
365 IN CONST CHAR16 *Mapping\r
366 );\r
367\r
368/**\r
369 Converts a file system style name to a device path.\r
370\r
371 This function converts a file system style name to a device path, by replacing any\r
372 mapping references to the associated device path.\r
373\r
941b3569 374 @param[in] Path the pointer to the path\r
94b17fa1 375\r
376 @return all The pointer of the file path. The file path is callee \r
377 allocated and should be freed by the caller.\r
378**/\r
379typedef\r
380EFI_DEVICE_PATH_PROTOCOL *\r
381(EFIAPI *EFI_SHELL_GET_DEVICE_PATH_FROM_FILE_PATH) (\r
382 IN CONST CHAR16 *Path\r
383 );\r
384\r
385/**\r
941b3569 386 This function updated with errata.\r
387\r
388 Gets either a single or list of environment variables.\r
389\r
390 If name is not NULL then this function returns the current value of the specified \r
391 environment variable.\r
94b17fa1 392\r
941b3569 393 If Name is NULL than a list of all environment variable names is returned. Each a \r
394 NULL terminated string with a double NULL terminating the list.\r
94b17fa1 395\r
941b3569 396 @param[in] Name A pointer to the environment variable name. If \r
397 Name is NULL, then the function will return all \r
398 of the defined shell environment variables. In \r
399 the case where multiple environment variables are \r
400 being returned, each variable will be terminated by \r
401 a NULL, and the list will be terminated by a double \r
402 NULL.\r
94b17fa1 403\r
941b3569 404 @return !=NULL A pointer to the returned string.\r
405 The returned pointer does not need to be freed by the caller.\r
406\r
407 @retval NULL The environment variable doesn't exist or there are \r
408 no environment variables.\r
94b17fa1 409**/\r
410typedef\r
411CONST CHAR16 *\r
412(EFIAPI *EFI_SHELL_GET_ENV) (\r
941b3569 413 IN CONST CHAR16 *Name OPTIONAL\r
94b17fa1 414 );\r
415\r
416/**\r
417 Gets the file information from an open file handle.\r
418\r
419 This function allocates a buffer to store the file's information. It's the caller's\r
420 responsibility to free the buffer.\r
421\r
941b3569 422 @param[in] FileHandle A File Handle\r
94b17fa1 423\r
424 @return !=NULL Cannot get the file info.\r
425 @return NULL A pointer to a buffer with file information.\r
426**/\r
427typedef\r
428EFI_FILE_INFO *\r
429(EFIAPI *EFI_SHELL_GET_FILE_INFO)(\r
430 IN EFI_FILE_HANDLE FileHandle\r
431 );\r
432\r
433/**\r
434 Converts a device path to a file system-style path.\r
435\r
436 This function converts a device path to a file system path by replacing part, or all, of\r
437 the device path with the file-system mapping. If there are more than one application\r
438 file system mappings, the one that most closely matches Path will be used.\r
439\r
941b3569 440 @param[in] Path The pointer to the device path\r
94b17fa1 441\r
442 @return all The pointer of the null-terminated file path. The path \r
443 is callee-allocated and should be freed by the caller.\r
444**/\r
445typedef\r
446CHAR16 *\r
447(EFIAPI *EFI_SHELL_GET_FILE_PATH_FROM_DEVICE_PATH) (\r
448 IN CONST EFI_DEVICE_PATH_PROTOCOL *Path\r
449 );\r
450\r
451/**\r
452 Gets a file's current position\r
453\r
454 This function returns the current file position for the file handle. For directories, the\r
455 current file position has no meaning outside of the file system driver and as such, the\r
456 operation is not supported.\r
457\r
941b3569 458 @param[in] FileHandle The file handle on which to get the current position.\r
459 @paramp[out] Position Byte position from the start of the file\r
94b17fa1 460\r
461 @retval EFI_SUCCESS Data was accessed.\r
462 @retval EFI_UNSUPPORTED The request is not valid on open directories.\r
463**/\r
464typedef\r
465EFI_STATUS\r
466(EFIAPI *EFI_SHELL_GET_FILE_POSITION)(\r
467 IN EFI_FILE_HANDLE FileHandle,\r
468 OUT UINT64 *Position\r
469 );\r
470\r
471/**\r
472 Gets the size of a file.\r
473\r
474 This function returns the size of the file specified by FileHandle.\r
475\r
941b3569 476 @param[in] FileHandle The handle of the file.\r
477 @param[out] Size The size of this file.\r
94b17fa1 478\r
479 @retval EFI_SUCCESS Get the file's size.\r
480 @retval EFI_DEVICE_ERROR Can't access the file.\r
481**/\r
482typedef\r
483EFI_STATUS\r
484(EFIAPI *EFI_SHELL_GET_FILE_SIZE)(\r
485 IN EFI_FILE_HANDLE FileHandle,\r
486 OUT UINT64 *Size\r
487 );\r
488\r
489/**\r
490 Return help information about a specific command.\r
491\r
492 This function returns the help information for the specified command. The help text\r
493 can be internal to the shell or can be from a UEFI Shell manual page.\r
494 \r
495 If Sections is specified, then each section name listed will be compared in a casesensitive\r
496 manner, to the section names described in Appendix B. If the section exists,\r
497 it will be appended to the returned help text. If the section does not exist, no\r
498 information will be returned. If Sections is NULL, then all help text information\r
499 available will be returned.\r
500\r
941b3569 501 @param[in] Command Points to the null-terminated UEFI Shell command name.\r
502 @param[in] Sections Points to the null-terminated comma-delimited \r
94b17fa1 503 section names to return. If NULL, then all \r
504 sections will be returned.\r
941b3569 505 @param[out] HelpText On return, points to a callee-allocated buffer \r
94b17fa1 506 containing all specified help text.\r
507\r
508 @retval EFI_SUCCESS The help text was returned.\r
509 @retval EFI_OUT_OF_RESOURCES The necessary buffer could not be allocated to hold the \r
510 returned help text.\r
511 @retval EFI_INVALID_PARAMETER HelpText is NULL\r
512 @retval EFI_NOT_FOUND There is no help text available for Command.\r
513**/\r
514typedef\r
515EFI_STATUS\r
516(EFIAPI *EFI_SHELL_GET_HELP_TEXT) (\r
517 IN CONST CHAR16 *Command,\r
b1f95a06 518 IN CONST CHAR16 *Sections OPTIONAL,\r
94b17fa1 519 OUT CHAR16 **HelpText\r
520 );\r
521\r
522/**\r
941b3569 523 This funciton is updated with Errata.\r
524\r
525 Gets the mapping(s) that most closely matches the device path.\r
94b17fa1 526\r
527 This function gets the mapping which corresponds to the device path *DevicePath. If\r
528 there is no exact match, then the mapping which most closely matches *DevicePath\r
529 is returned, and *DevicePath is updated to point to the remaining portion of the\r
530 device path. If there is an exact match, the mapping is returned and *DevicePath\r
531 points to the end-of-device-path node.\r
532\r
941b3569 533 If there are multiple map names they will be semi-colon seperated in the \r
534 NULL-terminated string.\r
535\r
536 @param[in,out] DevicePath On entry, points to a device path pointer. On \r
94b17fa1 537 exit, updates the pointer to point to the \r
538 portion of the device path after the mapping.\r
539\r
540 @retval NULL No mapping was found.\r
541 @return !=NULL Pointer to null-terminated mapping. The buffer \r
542 is callee allocated and should be freed by the caller.\r
543**/\r
544typedef\r
545CONST CHAR16 *\r
546(EFIAPI *EFI_SHELL_GET_MAP_FROM_DEVICE_PATH) (\r
547 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
548 );\r
549\r
550/**\r
551 Gets the enable status of the page break output mode.\r
552\r
553 User can use this function to determine current page break mode.\r
554\r
555 @retval TRUE The page break output mode is enabled\r
556 @retval FALSE The page break output mode is disabled\r
557**/\r
558typedef\r
559BOOLEAN\r
560(EFIAPI *EFI_SHELL_GET_PAGE_BREAK) (\r
561 VOID\r
562 );\r
563\r
564/**\r
565 Judges whether the active shell is the root shell.\r
566\r
567 This function makes the user to know that whether the active Shell is the root shell.\r
568\r
569 @retval TRUE The active Shell is the root Shell.\r
570 @retval FALSE The active Shell is NOT the root Shell.\r
571**/\r
572typedef\r
573BOOLEAN\r
574(EFIAPI *EFI_SHELL_IS_ROOT_SHELL) (\r
575VOID\r
576);\r
577\r
578/**\r
579 Opens a file or a directory by file name.\r
580\r
581 This function opens the specified file in the specified OpenMode and returns a file\r
582 handle.\r
583 If the file name begins with >v, then the file handle which is returned refers to the\r
584 shell environment variable with the specified name. If the shell environment variable\r
585 exists, is non-volatile and the OpenMode indicates EFI_FILE_MODE_WRITE, then\r
586 EFI_INVALID_PARAMETER is returned.\r
587\r
588 If the file name is >i, then the file handle which is returned refers to the standard\r
589 input. If the OpenMode indicates EFI_FILE_MODE_WRITE, then EFI_INVALID_PARAMETER\r
590 is returned.\r
591\r
592 If the file name is >o, then the file handle which is returned refers to the standard\r
593 output. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER\r
594 is returned.\r
595\r
596 If the file name is >e, then the file handle which is returned refers to the standard\r
597 error. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER\r
598 is returned.\r
599\r
600 If the file name is NUL, then the file handle that is returned refers to the standard NUL\r
601 file. If the OpenMode indicates EFI_FILE_MODE_READ, then EFI_INVALID_PARAMETER is\r
602 returned.\r
603\r
604 If return EFI_SUCCESS, the FileHandle is the opened file's handle, else, the\r
605 FileHandle is NULL.\r
606\r
941b3569 607 @param[in] FileName Points to the null-terminated UCS-2 encoded file name.\r
608 @param[out] FileHandle On return, points to the file handle.\r
609 @param[in] OpenMode File open mode. Either EFI_FILE_MODE_READ or \r
94b17fa1 610 EFI_FILE_MODE_WRITE from section 12.4 of the UEFI \r
611 Specification.\r
612 @retval EFI_SUCCESS The file was opened. FileHandle has the opened file's handle.\r
613 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. FileHandle is NULL.\r
614 @retval EFI_UNSUPPORTED Could not open the file path. FileHandle is NULL.\r
615 @retval EFI_NOT_FOUND The specified file could not be found on the device or the file\r
616 system could not be found on the device. FileHandle is NULL.\r
617 @retval EFI_NO_MEDIA The device has no medium. FileHandle is NULL.\r
618 @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no\r
619 longer supported. FileHandle is NULL.\r
620 @retval EFI_DEVICE_ERROR The device reported an error or can't get the file path according\r
621 the FileName. FileHandle is NULL.\r
622 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. FileHandle is NULL.\r
623 @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write\r
624 when the media is write-protected. FileHandle is NULL.\r
625 @retval EFI_ACCESS_DENIED The service denied access to the file. FileHandle is NULL.\r
626 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file. FileHandle\r
627 is NULL.\r
628 @retval EFI_VOLUME_FULL The volume is full. FileHandle is NULL.\r
629**/\r
630typedef\r
631EFI_STATUS\r
632(EFIAPI *EFI_SHELL_OPEN_FILE_BY_NAME) (\r
633 IN CONST CHAR16 *FileName,\r
634 OUT EFI_FILE_HANDLE *FileHandle,\r
635 IN UINT64 OpenMode\r
636 );\r
637\r
638/**\r
639 Opens the files that match the path specified.\r
640\r
641 This function opens all of the files specified by Path. Wildcards are processed\r
642 according to the rules specified in UEFI Shell 2.0 spec section 3.7.1. Each \r
643 matching file has an EFI_SHELL_FILE_INFO structure created in a linked list.\r
644\r
941b3569 645 @param[in] Path A pointer to the path string.\r
646 @param[in] OpenMode Specifies the mode used to open each file, EFI_FILE_MODE_READ or\r
94b17fa1 647 EFI_FILE_MODE_WRITE.\r
941b3569 648 @param[in,out] FileList Points to the start of a list of files opened.\r
94b17fa1 649\r
650 @retval EFI_SUCCESS Create the file list successfully.\r
651 @return Others Can't create the file list.\r
652**/\r
653typedef\r
654EFI_STATUS\r
655(EFIAPI *EFI_SHELL_OPEN_FILE_LIST) (\r
656 IN CHAR16 *Path,\r
657 IN UINT64 OpenMode,\r
658 IN OUT EFI_SHELL_FILE_INFO **FileList\r
659 );\r
660\r
661/**\r
662 Opens the root directory of a device.\r
663\r
664 This function opens the root directory of a device and returns a file handle to it.\r
665\r
941b3569 666 @param[in] DevicePath Points to the device path corresponding to the device where the\r
94b17fa1 667 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL is installed.\r
941b3569 668 @param[out] FileHandle On exit, points to the file handle corresponding to the root directory on the\r
94b17fa1 669 device.\r
670\r
671 @retval EFI_SUCCESS Root opened successfully.\r
672 @retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory\r
673 could not be opened.\r
674 @retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted.\r
675 @retval EFI_DEVICE_ERROR The device had an error\r
676**/\r
677typedef\r
678EFI_STATUS\r
679(EFIAPI *EFI_SHELL_OPEN_ROOT)(\r
680 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
681 OUT EFI_FILE_HANDLE *FileHandle\r
682 );\r
683\r
684/**\r
685 Opens the root directory of a device on a handle\r
686\r
687 This function opens the root directory of a device and returns a file handle to it.\r
688\r
941b3569 689 @param[in] DeviceHandle The handle of the device that contains the volume.\r
690 @param[out] FileHandle On exit, points to the file handle corresponding to the root directory on the\r
94b17fa1 691 device.\r
692\r
693 @retval EFI_SUCCESS Root opened successfully.\r
694 @retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory\r
695 could not be opened.\r
696 @retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted.\r
697 @retval EFI_DEVICE_ERROR The device had an error\r
698**/\r
699typedef\r
700EFI_STATUS\r
701(EFIAPI *EFI_SHELL_OPEN_ROOT_BY_HANDLE)(\r
702 IN EFI_HANDLE DeviceHandle,\r
703 OUT EFI_FILE_HANDLE *FileHandle\r
704 );\r
705\r
706/**\r
707 Reads data from the file.\r
708\r
709 If FileHandle is not a directory, the function reads the requested number of bytes\r
710 from the file at the file's current position and returns them in Buffer. If the read goes\r
711 beyond the end of the file, the read length is truncated to the end of the file. The file's\r
712 current position is increased by the number of bytes returned.\r
713 If FileHandle is a directory, then an error is returned.\r
714\r
941b3569 715 @param[in] FileHandle The opened file handle for read\r
716 @param[in] ReadSize On input, the size of Buffer, in bytes. On output, the amount of data read.\r
717 @param[in,out] Buffer The buffer in which data is read.\r
94b17fa1 718\r
719 @retval EFI_SUCCESS Data was read.\r
720 @retval EFI_NO_MEDIA The device has no media\r
721 @retval EFI_DEVICE_ERROR The device reported an error\r
722 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted\r
723 @retval EFI_BUFFER_TO_SMALL Buffer is too small. ReadSize contains required size\r
724**/\r
725typedef\r
726EFI_STATUS\r
727(EFIAPI *EFI_SHELL_READ_FILE) (\r
728 IN EFI_FILE_HANDLE FileHandle,\r
729 IN OUT UINTN *ReadSize,\r
941b3569 730 IN OUT VOID *Buffer\r
94b17fa1 731 );\r
732\r
733/**\r
734 Deletes the duplicate file names files in the given file list.\r
735\r
736 This function deletes the reduplicate files in the given file list.\r
737\r
941b3569 738 @param[in] FileList A pointer to the first entry in the file list.\r
94b17fa1 739\r
740 @retval EFI_SUCCESS Always success.\r
741**/\r
742typedef\r
743EFI_STATUS\r
744(EFIAPI *EFI_SHELL_REMOVE_DUP_IN_FILE_LIST) (\r
745 IN EFI_SHELL_FILE_INFO **FileList\r
746 );\r
747\r
941b3569 748//\r
749// The SetAlias and GetAlias functions were affected by errata. \r
750// They are not UEFI Shell 2.0 (no errata) compliant.\r
751//\r
752\r
94b17fa1 753/**\r
754 Changes a shell command alias.\r
755\r
756 This function creates an alias for a shell command.\r
757\r
941b3569 758 @param[in] Command Points to the null-terminated shell command or existing alias.\r
759 @param[in] Alias Points to the null-terminated alias for the shell command. If this is NULL, and\r
94b17fa1 760 Command refers to an alias, that alias will be deleted.\r
941b3569 761 @param[in] Replace If TRUE and the alias already exists, then the existing alias will be replaced. If\r
94b17fa1 762 FALSE and the alias already exists, then the existing alias is unchanged and\r
763 EFI_ACCESS_DENIED is returned.\r
941b3569 764 @param[in] Volatile if TRUE the Alias being set will be stored in a volatile fashion. if FALSE the \r
765 Alias being set will be stored in a non-volatile fashion.\r
94b17fa1 766\r
767 @retval EFI_SUCCESS Alias created or deleted successfully.\r
768 @retval EFI_ACCESS_DENIED The alias is a built-in alias or already existed and Replace was set to\r
769 FALSE.\r
770**/\r
771typedef\r
772EFI_STATUS\r
773(EFIAPI *EFI_SHELL_SET_ALIAS)(\r
774 IN CONST CHAR16 *Command,\r
775 IN CONST CHAR16 *Alias,\r
941b3569 776 IN BOOLEAN Replace,\r
777 IN BOOLEAN Volatile\r
778 );\r
779\r
780/**\r
781 This function returns the alias associated with a command.\r
782\r
783 @param[in] Command Points to the null-terminated shell command. \r
784 If this parameter is NULL, then all commands \r
785 aliases will be returned in ReturnedData.\r
786 @param[out] ReturnedData If Command is not NULL, ReturnedData points to \r
787 the null-terminated alias for the shell command. \r
788