2 Defines for EFI shell environment 2 ported to EDK II build environment. (no spec)
4 Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef _SHELL_ENVIRONMENT_2_PROTOCOL_H_
17 #define _SHELL_ENVIRONMENT_2_PROTOCOL_H_
19 #define DEFAULT_INIT_ROW 1
20 #define DEFAULT_AUTO_LF FALSE
23 This function is a prototype for a function that dumps information on a protocol
24 to a given location. The location is dependant on the implementation. This is
25 used when programatically adding shell commands.
27 @param[in] Handle The handle the protocol is on.
28 @param[in] Interface The interface to the protocol.
33 (EFIAPI
*SHELLENV_DUMP_PROTOCOL_INFO
) (
39 This function is a prototype for each command internal to the EFI shell
40 implementation. The specific command depends on the implementation. This is
41 used when programatically adding shell commands.
43 @param[in] ImageHandle The handle to the binary shell.
44 @param[in] SystemTable The pointer to the system table.
46 @retval EFI_SUCCESS The command completed.
47 @retval other An error occurred. Any error is possible
48 depending on the implementation of the shell
54 (EFIAPI
*SHELLENV_INTERNAL_COMMAND
) (
55 IN EFI_HANDLE ImageHandle
,
56 IN EFI_SYSTEM_TABLE
*SystemTable
60 This function is a prototype for one that gets a help string for a given command.
61 This is used when programatically adding shell commands. Upon successful return
62 the memory allocated is up to the caller to free.
64 @param[in, out] Str Pointer to pointer to string to display for help.
66 @retval EFI_SUCCESS The help string is in the parameter Str.
71 (EFIAPI
*SHELLCMD_GET_LINE_HELP
) (
76 Structure returned from functions that open multiple files.
79 UINT32 Signature
; ///< SHELL_FILE_ARG_SIGNATURE.
80 LIST_ENTRY Link
; ///< Linked list helper.
81 EFI_STATUS Status
; ///< File's status.
83 EFI_FILE_HANDLE Parent
; ///< What is the Parent file of this file.
84 UINT64 OpenMode
; ///< How was the file opened.
85 CHAR16
*ParentName
; ///< String representation of parent.
86 EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
; ///< DevicePath for Parent.
88 CHAR16
*FullName
; ///< Path and file name for this file.
89 CHAR16
*FileName
; ///< File name for this file.
91 EFI_FILE_HANDLE Handle
; ///< Handle to this file.
92 EFI_FILE_INFO
*Info
; ///< Pointer to file info for this file.
95 /// Signature for SHELL_FILE_ARG.
96 #define SHELL_FILE_ARG_SIGNATURE SIGNATURE_32 ('g', 'r', 'a', 'f')
99 GUID for the shell environment2 and shell environment.
101 #define SHELL_ENVIRONMENT_PROTOCOL_GUID \
103 0x47c7b221, 0xc42a, 0x11d2, {0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \
107 GUID for the shell environment2 extension (main GUID above).
109 #define EFI_SE_EXT_SIGNATURE_GUID \
111 0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87} \
114 #define EFI_SHELL_MAJOR_VER 0x00000001 ///< Major version of the EFI_SHELL_ENVIRONMENT2.
115 #define EFI_SHELL_MINOR_VER 0x00000000 ///< Minor version of the EFI_SHELL_ENVIRONMENT2.
118 Execute a command line.
120 This function will run the CommandLine. This includes loading any required images,
121 parsing any requires scripts, and if DebugOutput is TRUE printing errors
122 encountered directly to the screen.
124 @param[in] ParentImageHandle Handle of the image executing this operation.
125 @param[in] CommandLine The string command line to execute.
126 @param[in] DebugOutput TRUE indicates that errors should be printed directly.
127 FALSE supresses error messages.
129 @retval EFI_SUCCESS The command line executed and completed.
130 @retval EFI_ABORTED The operation aborted.
131 @retval EFI_INVALID_PARAMETER A parameter did not have a valid value.
132 @retval EFI_OUT_OF_RESOURCES A required memory allocation failed.
138 (EFIAPI
*SHELLENV_EXECUTE
) (
139 IN EFI_HANDLE
*ParentImageHandle
,
140 IN CHAR16
*CommandLine
,
141 IN BOOLEAN DebugOutput
145 This function returns a shell environment variable value.
147 @param[in] Name The pointer to the string with the shell environment
150 @retval NULL The shell environment variable's value could not be found.
151 @retval !=NULL The value of the shell environment variable Name.
156 (EFIAPI
*SHELLENV_GET_ENV
) (
161 This function returns a shell environment map value.
163 @param[in] Name The pointer to the string with the shell environment
166 @retval NULL The shell environment map's value could not be found.
167 @retval !=NULL The value of the shell environment map Name.
172 (EFIAPI
*SHELLENV_GET_MAP
) (
177 This function will add an internal command to the shell interface.
179 This will allocate all required memory, put the new command on the command
180 list in the correct location.
182 @param[in] Handler The handler function to call when the command gets called.
183 @param[in] Cmd The command name.
184 @param[in] GetLineHelp The function to call of type "get help" for this command.
186 @retval EFI_SUCCESS The command is now part of the command list.
187 @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
188 @sa SHELLENV_INTERNAL_COMMAND
189 @sa SHELLCMD_GET_LINE_HELP
193 (EFIAPI
*SHELLENV_ADD_CMD
) (
194 IN SHELLENV_INTERNAL_COMMAND Handler
,
196 IN SHELLCMD_GET_LINE_HELP GetLineHelp
200 Internal interface to add protocol handlers.
202 This function is for internal shell use only. This is how protocol handlers are added.
203 This will get the current protocol info and add the new info or update existing info
204 and then resave the info.
206 @param[in] Protocol The pointer to the protocol's GUID.
207 @param[in] DumpToken The function pointer to dump token function or
209 @param[in] DumpInfo The function pointer to dump infomation function
211 @param[in] IdString The English name of the protocol.
215 (EFIAPI
*SHELLENV_ADD_PROT
) (
216 IN EFI_GUID
*Protocol
,
217 IN SHELLENV_DUMP_PROTOCOL_INFO DumpToken OPTIONAL
,
218 IN SHELLENV_DUMP_PROTOCOL_INFO DumpInfo OPTIONAL
,
223 This function finds a protocol handle by a GUID.
225 This function will check for already known protocols by GUID and if one is
226 found it will return the name of that protocol. If no name is found and
227 GenId is TRUE it will generate ths string.
229 @param[in] Protocol The GUID of the protocol to look for.
230 @param[in] GenId Whether to generate a name string if it is not found.
232 @return !NULL The Name of the protocol.
233 @retval NULL The Name was not found, and GenId was not TRUE.
237 (EFIAPI
*SHELLENV_GET_PROT
) (
238 IN EFI_GUID
*Protocol
,
243 This function returns a string array containing the current directory on
246 If DeviceName is specified, then return the current shell directory on that
247 device. If DeviceName is NULL, then return the current directory on the
248 current device. The caller us responsible to free the returned string when
251 @param[in] DeviceName The name of the device to get the current
252 directory on, or NULL for current device.
254 @return String array with the current directory on the current or specified device.
259 (EFIAPI
*SHELLENV_CUR_DIR
) (
260 IN CHAR16
*DeviceName OPTIONAL
264 This function will open a group of files that match the Arg path, including
265 support for wildcard characters ('?' and '*') in the Arg path. If there are
266 any wildcard characters in the path this function will find any and all files
267 that match the wildcards. It returns a double linked list based on the
268 LIST_ENTRY linked list structure. Use this in conjunction with the
269 SHELL_FILE_ARG_SIGNATURE to get the SHELL_FILE_ARG structures that are returned.
270 The memory allocated by the callee for this list is freed by making a call to
271 SHELLENV_FREE_FILE_LIST.
273 @param[in] Arg The pointer Path to files to open.
274 @param[in, out] ListHead The pointer to the allocated and initialized list head
275 upon which to append all opened file structures.
277 @retval EFI_SUCCESS One or more files was opened and a struct of each file's
278 information was appended to ListHead.
279 @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
280 @retval EFI_NOT_FOUND No matching files could be found.
281 @sa SHELLENV_FREE_FILE_LIST
284 (EFIAPI
*SHELLENV_FILE_META_ARG
) (
286 IN OUT LIST_ENTRY
*ListHead
290 This frees all of the nodes under the ListHead, but not ListHead itself.
292 @param[in, out] ListHead Pointer to list to free all nodes of.
294 @retval EFI_SUCCESS This function always returns EFI_SUCCESS.
298 (EFIAPI
*SHELLENV_FREE_FILE_LIST
) (
299 IN OUT LIST_ENTRY
*ListHead
303 This function creates a new instance of the ShellInterface protocol for use on
306 This function is for internal shell usage. This will allocate and then populate
307 EFI_SHELL_INTERFACE protocol. It is the caller's responsibility to free the
310 @param[in] ImageHandle The handle which will use the new ShellInterface
313 @return The newly allocated shell interface protocol.
318 (EFIAPI
*SHELLENV_NEW_SHELL
) (
319 IN EFI_HANDLE ImageHandle
323 This function determines whether a script file is currently being processed.
325 A script file (.nsh file) can contain a series of commands and this is useful to
326 know for some shell commands whether they are being run manually or as part of a
329 @retval TRUE A script file is being processed.
330 @retval FALSE A script file is not being processed.
334 (EFIAPI
*SHELLENV_BATCH_IS_ACTIVE
) (
339 This is an internal shell function to free any and all allocated resources.
340 This should be called immediately prior to closing the shell.
344 (EFIAPI
*SHELLENV_FREE_RESOURCES
) (
349 This function enables the page break mode.
351 This mode causes the output to pause after each complete screen to enable a
352 user to more easily read it. If AutoWrap is TRUE, then rows with too many
353 characters will be chopped and divided into 2 rows. If FALSE, then rows with
354 too many characters may not be fully visible to the user on the screen.
356 @param[in] StartRow The row number to start this on.
357 @param[in] AutoWrap Whether to auto wrap rows that are too long.
361 (EFIAPI
*SHELLENV_ENABLE_PAGE_BREAK
) (
367 This function disables the page break mode.
369 Disabling this causes the output to print out exactly as coded, with no breaks
374 (EFIAPI
*SHELLENV_DISABLE_PAGE_BREAK
) (
379 Get the status of the page break output mode.
381 @retval FALSE Page break output mode is not enabled.
382 @retval TRUE Page break output mode is enabled.
386 (EFIAPI
*SHELLENV_GET_PAGE_BREAK
) (
391 This function sets the keys to filter for for the console in. The valid
394 #define EFI_OUTPUT_SCROLL 0x00000001
395 #define EFI_OUTPUT_PAUSE 0x00000002
396 #define EFI_EXECUTION_BREAK 0x00000004
398 @param[in] KeyFilter The new key filter to use.
402 (EFIAPI
*SHELLENV_SET_KEY_FILTER
) (
407 This function gets the keys to filter for for the console in.
409 The valid values to get are:
410 #define EFI_OUTPUT_SCROLL 0x00000001
411 #define EFI_OUTPUT_PAUSE 0x00000002
412 #define EFI_EXECUTION_BREAK 0x00000004
414 @retval The current filter mask.
418 (EFIAPI
*SHELLENV_GET_KEY_FILTER
) (
423 This function determines if the shell application should break.
425 This is used to inform a shell application that a break condition has been
426 initiated. Long loops should check this to prevent delays to the break.
428 @retval TRUE A break has been signaled. The application
429 should exit with EFI_ABORTED as soon as possible.
430 @retval FALSE Continue as normal.
434 (EFIAPI
*SHELLENV_GET_EXECUTION_BREAK
) (
439 This is an internal shell function used to increment the shell nesting level.
444 (EFIAPI
*SHELLENV_INCREMENT_SHELL_NESTING_LEVEL
) (
449 This is an internal shell function used to decrement the shell nesting level.
453 (EFIAPI
*SHELLENV_DECREMENT_SHELL_NESTING_LEVEL
) (
458 This function determines if the caller is running under the root shell.
460 @retval TRUE The caller is running under the root shell.
461 @retval FALSE The caller is not running under the root shell.
466 (EFIAPI
*SHELLENV_IS_ROOT_SHELL
) (
471 Close the console proxy to restore the original console.
473 This is an internal shell function to handle shell cascading. It restores the
474 original set of console protocols.
476 @param[in] ConInHandle The handle of ConIn.
477 @param[in, out] ConIn The pointer to the location to return the pointer to
478 the original console input.
479 @param[in] ConOutHandle The handle of ConOut
480 @param[in, out] ConOut The pointer to the location to return the pointer to
481 the original console output.
485 (EFIAPI
*SHELLENV_CLOSE_CONSOLE_PROXY
) (
486 IN EFI_HANDLE ConInHandle
,
487 IN OUT EFI_SIMPLE_TEXT_INPUT_PROTOCOL
**ConIn
,
488 IN EFI_HANDLE ConOutHandle
,
489 IN OUT EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
**ConOut
493 // declarations of handle enumerator
496 For ease of use the shell maps handle #'s to short numbers.
497 This is only done on request for various internal commands and the references
498 are immediately freed when the internal command completes.
502 (EFIAPI
*INIT_HANDLE_ENUMERATOR
) (
507 This is an internal shell function to enumerate the handle database.
509 This function gets the next handle in the handle database. If no handles are
510 found, EFI_NOT_FOUND is returned. If the previous Handle was the last handle,
511 it is set to NULL before returning.
513 This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.
515 @param[in, out] Handle The pointer to pointer to Handle. It is set
516 on a sucessful return.
518 @retval EFI_SUCCESS The next handle in the handle database is *Handle.
519 @retval EFI_NOT_FOUND There is not another handle.
523 (EFIAPI
*NEXT_HANDLE
) (
524 IN OUT EFI_HANDLE
**Handle
528 This is an internal shell function to enumerate the handle database.
530 This function skips the next SkipNum handles in the handle database. If there
531 are not enough handles left to skip that many EFI_ACCESS_DENIED is returned and
532 no skip is performed.
534 This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.
536 @param[in] SkipNum How many handles to skip
538 @retval EFI_SUCCESS The next handle in the handle database is *Handle
539 @retval EFI_ACCESS_DENIED There are not SkipNum handles left in the database
543 (EFIAPI
*SKIP_HANDLE
) (
548 This is an internal shell function to enumerate the handle database.
550 This function resets the the handle database so that NEXT_HANDLE and SKIP_HANDLE
551 will start from EnumIndex on the next call.
553 This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.
555 @param[in] EnumIndex Where to start.
557 @return The number of handles either read out or skipped before this reset.
561 (EFIAPI
*RESET_HANDLE_ENUMERATOR
) (
566 This is an internal shell function to enumerate the handle database.
568 This must be called after INIT_HANDLE_ENUMERATOR.
570 This function releases all memory and resources associated with the handle database.
571 After this no other handle enumerator functions except INIT_HANDLE_ENUMERATOR will
576 (EFIAPI
*CLOSE_HANDLE_ENUMERATOR
) (
581 This is an internal shell function to enumerate the handle database.
583 This function returns the number of handles in the handle database.
585 This must be called after INIT_HANDLE_ENUMERATOR and before CLOSE_HANDLE_ENUMERATOR.
587 @return The number of handles in the handle database.
596 Handle Enumerator structure.
599 INIT_HANDLE_ENUMERATOR Init
; ///< The pointer to INIT_HANDLE_ENUMERATOR function.
600 NEXT_HANDLE Next
; ///< The pointer to NEXT_HANDLE function.
601 SKIP_HANDLE Skip
; ///< The pointer to SKIP_HANDLE function.
602 RESET_HANDLE_ENUMERATOR Reset
; ///< The pointer to RESET_HANDLE_ENUMERATOR function.
603 CLOSE_HANDLE_ENUMERATOR Close
; ///< The pointer to CLOSE_HANDLE_ENUMERATOR function.
604 GET_NUM GetNum
; ///< The pointer to GET_NUM function.
608 Signature for the PROTOCOL_INFO structure.
610 #define PROTOCOL_INFO_SIGNATURE SIGNATURE_32 ('s', 'p', 'i', 'n')
613 PROTOCOL_INFO structure for protocol enumerator functions.
616 UINTN Signature
; ///< PROTOCOL_INFO_SIGNATURE.
617 LIST_ENTRY Link
; ///< Standard linked list helper member.
619 // The parsing info for the protocol.
621 EFI_GUID ProtocolId
; ///< The GUID for the protocol.
622 CHAR16
*IdString
; ///< The name of the protocol.
623 SHELLENV_DUMP_PROTOCOL_INFO DumpToken
; ///< The pointer to DumpToken function for the protocol.
624 SHELLENV_DUMP_PROTOCOL_INFO DumpInfo
; ///< The pointer to DumpInfo function for the protocol.
626 // Patabase info on which handles are supporting this protocol.
628 UINTN NoHandles
; ///< The number of handles producing this protocol.
629 EFI_HANDLE
*Handles
; ///< The array of handles.
634 // Declarations of protocol info enumerator.
637 This is an internal shell function to initialize the protocol enumerator.
639 This must be called before NEXT_PROTOCOL_INFO, SKIP_PROTOCOL_INFO,
640 RESET_PROTOCOL_INFO_ENUMERATOR, and CLOSE_PROTOCOL_INFO_ENUMERATOR are
645 (EFIAPI
*INIT_PROTOCOL_INFO_ENUMERATOR
) (
650 This function is an internal shell function for enumeration of protocols.
652 This function returns the next protocol on the list. If this is called
653 immediately after initialization, it will return the first protocol on the list.
654 If this is called immediately after reset, it will return the first protocol again.
656 This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be
657 called after INIT_PROTOCOL_INFO_ENUMERATOR.
659 @param[in, out] ProtocolInfo The pointer to pointer to protocol information structure.
661 @retval EFI_SUCCESS The next protocol's information was sucessfully returned.
662 @retval NULL There are no more protocols.
666 (EFIAPI
*NEXT_PROTOCOL_INFO
) (
667 IN OUT PROTOCOL_INFO
**ProtocolInfo
671 This function is an internal shell function for enumeration of protocols.
673 This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be
674 called after INIT_PROTOCOL_INFO_ENUMERATOR.
676 This function does nothing and always returns EFI_SUCCESS.
678 @retval EFI_SUCCESS Always returned (see above).
682 (EFIAPI
*SKIP_PROTOCOL_INFO
) (
687 This function is an internal shell function for enumeration of protocols.
689 This cannot be called after CLOSE_PROTOCOL_INFO_ENUMERATOR, but it must be
690 called after INIT_PROTOCOL_INFO_ENUMERATOR.
692 This function resets the list of protocols such that the next one in the
693 list is the begining of the list.
697 (EFIAPI
*RESET_PROTOCOL_INFO_ENUMERATOR
) (
703 This function is an internal shell function for enumeration of protocols.
705 This must be called after INIT_PROTOCOL_INFO_ENUMERATOR. After this call
706 no protocol enumerator calls except INIT_PROTOCOL_INFO_ENUMERATOR may be made.
708 This function frees any memory or resources associated with the protocol
713 (EFIAPI
*CLOSE_PROTOCOL_INFO_ENUMERATOR
) (
718 Protocol enumerator structure of function pointers.
721 INIT_PROTOCOL_INFO_ENUMERATOR Init
; ///< The pointer to INIT_PROTOCOL_INFO_ENUMERATOR function.
722 NEXT_PROTOCOL_INFO Next
; ///< The pointer to NEXT_PROTOCOL_INFO function.
723 SKIP_PROTOCOL_INFO Skip
; ///< The pointer to SKIP_PROTOCOL_INFO function.
724 RESET_PROTOCOL_INFO_ENUMERATOR Reset
; ///< The pointer to RESET_PROTOCOL_INFO_ENUMERATOR function.
725 CLOSE_PROTOCOL_INFO_ENUMERATOR Close
; ///< The pointer to CLOSE_PROTOCOL_INFO_ENUMERATOR function.
726 } PROTOCOL_INFO_ENUMERATOR
;
729 This function is used to retrieve a user-friendly display name for a handle.
731 If UseComponentName is TRUE then the component name protocol for this device
732 or it's parent device (if required) will be used to obtain the name of the
733 device. If UseDevicePath is TRUE it will get the human readable device path
734 and return that. If both are TRUE it will try to use component name first
735 and device path if that fails.
737 It will use either ComponentName or ComponentName2 protocol, depending on
740 This function will furthur verify whether the handle in question produced either
741 EFI_DRIVER_CONFIGRATION_PROTOCOL or EFI_DRIVER_CONFIGURATION2_PROTOCOL and also
742 whether the handle in question produced either EFI_DRIVER_DIAGNOSTICS_PROTOCOL or
743 EFI_DRIVER_DIAGNOSTICS2_PROTOCOL.
745 Upon successful return, the memory for *BestDeviceName is up to the caller to free.
747 @param[in] DeviceHandle The device handle whose name is desired.
748 @param[in] UseComponentName Whether to use the ComponentName protocol at all.
749 @param[in] UseDevicePath Whether to use the DevicePath protocol at all.
750 @param[in] Language The pointer to the language string to use.
751 @param[in, out] BestDeviceName The pointer to pointer to string allocated with the name.
752 @param[out] ConfigurationStatus The pointer to status for opening a Configuration protocol.
753 @param[out] DiagnosticsStatus The pointer to status for opening a Diagnostics protocol.
754 @param[in] Display Whether to Print this out to default Print location.
755 @param[in] Indent How many characters to indent the printing.
757 @retval EFI_SUCCESS This function always returns EFI_SUCCESS.
761 (EFIAPI
*GET_DEVICE_NAME
) (
762 IN EFI_HANDLE DeviceHandle
,
763 IN BOOLEAN UseComponentName
,
764 IN BOOLEAN UseDevicePath
,
766 IN OUT CHAR16
**BestDeviceName
,
767 OUT EFI_STATUS
*ConfigurationStatus
,
768 OUT EFI_STATUS
*DiagnosticsStatus
,
773 #define EFI_SHELL_COMPATIBLE_MODE_VER L"1.1.1" ///< The string for lowest version this shell supports.
774 #define EFI_SHELL_ENHANCED_MODE_VER L"1.1.2" ///< The string for highest version this shell supports.
777 This function gets the shell mode as stored in the shell environment
778 "efishellmode". It will not fail.
780 @param[out] Mode Returns a string representing one of the
781 2 supported modes of the shell.
783 @retval EFI_SUCCESS This function always returns success.
787 (EFIAPI
*GET_SHELL_MODE
) (
792 Convert a file system style name to a device path.
794 This function will convert a shell path name to a Device Path Protocol path.
795 This function will allocate any required memory for this operation and it
796 is the responsibility of the caller to free that memory when no longer required.
798 If anything prevents the complete conversion free any allocated memory and
801 @param[in] Path The path to convert.
803 @retval !NULL A pointer to the callee allocated Device Path.
804 @retval NULL The operation could not be completed.
807 EFI_DEVICE_PATH_PROTOCOL
*
808 (EFIAPI
*SHELLENV_NAME_TO_PATH
) (
813 Converts a device path into a file system map name.
815 If DevPath is NULL, then ASSERT.
817 This function looks through the shell environment map for a map whose device
818 path matches the DevPath parameter. If one is found the Name is returned via
819 Name parameter. If sucessful the caller must free the memory allocated for
822 This function will use the internal lock to prevent changes to the map during
823 the lookup operation.
825 @param[in] DevPath The device path to search for a name for.
826 @param[in] ConsistMapping What state to verify map flag VAR_ID_CONSIST.
827 @param[out] Name On sucessful return the name of that device path.
829 @retval EFI_SUCCESS The DevPath was found and the name returned
831 @retval EFI_OUT_OF_RESOURCES A required memory allocation failed.
832 @retval EFI_UNSUPPORTED The DevPath was not found in the map.
836 (EFIAPI
*SHELLENV_GET_FS_NAME
) (
837 IN EFI_DEVICE_PATH_PROTOCOL
* DevPath
,
838 IN BOOLEAN ConsistMapping
,
843 This function will open a group of files that match the Arg path, but will not
844 support the wildcard characters ('?' and '*') in the Arg path. If there are
845 any wildcard characters in the path this function will return
846 EFI_INVALID_PARAMETER. The return is a double linked list based on the
847 LIST_ENTRY linked list structure. Use this in conjunction with the
848 SHELL_FILE_ARG_SIGNATURE to get the SHELL_FILE_ARG structures that are returned.
849 The memory allocated by the callee for this list is freed by making a call to
850 SHELLENV_FREE_FILE_LIST.
852 @param[in] Arg The pointer to the path of the files to be opened.
853 @param[in, out] ListHead The pointer to allocated and initialized list head
854 upon which to append all the opened file structures.
856 @retval EFI_SUCCESS One or more files was opened and a struct of each file's
857 information was appended to ListHead.
858 @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
859 @retval EFI_NOT_FOUND No matching files could be found.
860 @sa SHELLENV_FREE_FILE_LIST
864 (EFIAPI
*SHELLENV_FILE_META_ARG_NO_WILDCARD
) (
866 IN OUT LIST_ENTRY
*ListHead
870 This function removes duplicate file listings from lists.
872 This is a function for use with SHELLENV_FILE_META_ARG_NO_WILDCARD and
873 SHELLENV_FILE_META_ARG. This function will verify that there are no duplicate
874 files in the list of returned files. Any file listed twice will have one of its
877 @param[in] ListHead The pointer to linked list head that was returned from
878 SHELLENV_FILE_META_ARG_NO_WILDCARD or
879 SHELLENV_FILE_META_ARG.
881 @retval EFI_SUCCESS This function always returns success.
886 (EFIAPI
*SHELLENV_DEL_DUP_FILE
) (
887 IN LIST_ENTRY
* ListHead
891 Converts a File System map name to a device path.
893 If DevPath is NULL, then ASSERT().
895 This function looks through the shell environment map for a map whose Name
896 matches the Name parameter. If one is found, the device path pointer is
897 updated to point to that file systems device path. The caller should not
898 free the memory from that device path.
900 This function will use the internal lock to prevent changes to the map during
901 the lookup operation.
903 @param[in] Name The pointer to the NULL terminated UNICODE string of the
905 @param[out] DevPath The pointer to pointer to DevicePath. Only valid on
908 @retval EFI_SUCCESS The conversion was successful, and the device
910 @retval EFI_NOT_FOUND The file system could not be found in the map.
914 (EFIAPI
*SHELLENV_GET_FS_DEVICE_PATH
) (
916 OUT EFI_DEVICE_PATH_PROTOCOL
**DevPath
919 /// EFI_SHELL_ENVIRONMENT2 protocol structure.
921 SHELLENV_EXECUTE Execute
;
922 SHELLENV_GET_ENV GetEnv
;
923 SHELLENV_GET_MAP GetMap
;
924 SHELLENV_ADD_CMD AddCmd
;
925 SHELLENV_ADD_PROT AddProt
;
926 SHELLENV_GET_PROT GetProt
;
927 SHELLENV_CUR_DIR CurDir
;
928 SHELLENV_FILE_META_ARG FileMetaArg
;
929 SHELLENV_FREE_FILE_LIST FreeFileList
;
932 // The following services are only used by the shell itself.
934 SHELLENV_NEW_SHELL NewShell
;
935 SHELLENV_BATCH_IS_ACTIVE BatchIsActive
;
937 SHELLENV_FREE_RESOURCES FreeResources
;
940 // GUID to differentiate ShellEnvironment2 from ShellEnvironment.
944 // Major Version grows if shell environment interface has been changes.
948 SHELLENV_ENABLE_PAGE_BREAK EnablePageBreak
;
949 SHELLENV_DISABLE_PAGE_BREAK DisablePageBreak
;
950 SHELLENV_GET_PAGE_BREAK GetPageBreak
;
952 SHELLENV_SET_KEY_FILTER SetKeyFilter
;
953 SHELLENV_GET_KEY_FILTER GetKeyFilter
;
955 SHELLENV_GET_EXECUTION_BREAK GetExecutionBreak
;
956 SHELLENV_INCREMENT_SHELL_NESTING_LEVEL IncrementShellNestingLevel
;
957 SHELLENV_DECREMENT_SHELL_NESTING_LEVEL DecrementShellNestingLevel
;
958 SHELLENV_IS_ROOT_SHELL IsRootShell
;
960 SHELLENV_CLOSE_CONSOLE_PROXY CloseConsoleProxy
;
961 HANDLE_ENUMERATOR HandleEnumerator
;
962 PROTOCOL_INFO_ENUMERATOR ProtocolInfoEnumerator
;
963 GET_DEVICE_NAME GetDeviceName
;
964 GET_SHELL_MODE GetShellMode
;
965 SHELLENV_NAME_TO_PATH NameToPath
;
966 SHELLENV_GET_FS_NAME GetFsName
;
967 SHELLENV_FILE_META_ARG_NO_WILDCARD FileMetaArgNoWildCard
;
968 SHELLENV_DEL_DUP_FILE DelDupFileArg
;
969 SHELLENV_GET_FS_DEVICE_PATH GetFsDevicePath
;
970 } EFI_SHELL_ENVIRONMENT2
;
972 extern EFI_GUID gEfiShellEnvironment2Guid
;
973 extern EFI_GUID gEfiShellEnvironment2ExtGuid
;
975 #endif // _SHELL_ENVIRONMENT_2_PROTOCOL_H_