X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ShellPkg%2FApplication%2FShell%2FShellEnvVar.h;h=0684516a5c192c2348955cafac009533ac8bffd4;hp=ab3d9166db4cdde8958fa670a0e32ffe887994e9;hb=ba0014b9f8ae1a593f03e744f26008214c2b06a8;hpb=4ff7e37b4f7e336a8ecb7080b8f48eef4b52d396 diff --git a/ShellPkg/Application/Shell/ShellEnvVar.h b/ShellPkg/Application/Shell/ShellEnvVar.h index ab3d9166db..0684516a5c 100644 --- a/ShellPkg/Application/Shell/ShellEnvVar.h +++ b/ShellPkg/Application/Shell/ShellEnvVar.h @@ -6,7 +6,7 @@ //#include - Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -27,20 +27,25 @@ typedef struct { UINT32 Atts; } ENV_VAR_LIST; -/** - Reports whether an environment variable is Volatile or Non-Volatile +// +// The list is used to cache the environment variables. +// +extern ENV_VAR_LIST gShellEnvVarList; + - This will use the Runtime Services call GetVariable to to search for the variable. +/** + Reports whether an environment variable is Volatile or Non-Volatile. @param EnvVarName The name of the environment variable in question + @param Volatile Return TRUE if the environment variable is volatile - @retval TRUE This environment variable is Volatile - @retval FALSE This environment variable is NON-Volatile + @retval EFI_SUCCESS The volatile attribute is returned successfully + @retval others Some errors happened. **/ -BOOLEAN -EFIAPI +EFI_STATUS IsVolatileEnv ( - IN CONST CHAR16 *EnvVarName + IN CONST CHAR16 *EnvVarName, + OUT BOOLEAN *Volatile ); /** @@ -151,7 +156,6 @@ IsVolatileEnv ( @retval EFI_SUCCESS the list was created sucessfully. **/ EFI_STATUS -EFIAPI GetEnvironmentVariableList( IN OUT LIST_ENTRY *List ); @@ -169,7 +173,6 @@ GetEnvironmentVariableList( @retval EFI_SUCCESS The list was Set sucessfully. **/ EFI_STATUS -EFIAPI SetEnvironmentVariableList( IN LIST_ENTRY *List ); @@ -190,7 +193,6 @@ SetEnvironmentVariableList( @sa SetEnvironmentVariableList **/ EFI_STATUS -EFIAPI SetEnvironmentVariables( IN CONST CHAR16 **Environment ); @@ -201,10 +203,86 @@ SetEnvironmentVariables( @param[in] List The pointer to pointer to list. **/ VOID -EFIAPI FreeEnvironmentVariableList( IN LIST_ENTRY *List ); +/** + Find an environment variable in the gShellEnvVarList. + + @param Key The name of the environment variable. + @param Value The value of the environment variable, the buffer + shoule be freed by the caller. + @param ValueSize The size in bytes of the environment variable + including the tailing CHAR_NULL. + @param Atts The attributes of the variable. + + @retval EFI_SUCCESS The command executed successfully. + @retval EFI_NOT_FOUND The environment variable is not found in + gShellEnvVarList. + +**/ +EFI_STATUS +ShellFindEnvVarInList ( + IN CONST CHAR16 *Key, + OUT CHAR16 **Value, + OUT UINTN *ValueSize, + OUT UINT32 *Atts OPTIONAL + ); + +/** + Add an environment variable into gShellEnvVarList. + + @param Key The name of the environment variable. + @param Value The value of environment variable. + @param ValueSize The size in bytes of the environment variable + including the tailing CHAR_NULL + @param Atts The attributes of the variable. + + @retval EFI_SUCCESS The environment variable was added to list successfully. + @retval others Some errors happened. + +**/ +EFI_STATUS +ShellAddEnvVarToList ( + IN CONST CHAR16 *Key, + IN CONST CHAR16 *Value, + IN UINTN ValueSize, + IN UINT32 Atts + ); + +/** + Remove a specified environment variable in gShellEnvVarList. + + @param Key The name of the environment variable. + + @retval EFI_SUCCESS The command executed successfully. + @retval EFI_NOT_FOUND The environment variable is not found in + gShellEnvVarList. +**/ +EFI_STATUS +ShellRemvoeEnvVarFromList ( + IN CONST CHAR16 *Key + ); + +/** + Initialize the gShellEnvVarList and cache all Shell-Guid-based environment + variables. + +**/ +EFI_STATUS +ShellInitEnvVarList ( + VOID + ); + +/** + Destructe the gShellEnvVarList. + +**/ +VOID +ShellFreeEnvVarList ( + VOID + ); + #endif //_SHELL_ENVIRONMENT_VARIABLE_HEADER_