]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Application/Shell/ShellEnvVar.h
ShellPkg: Clean up source files
[mirror_edk2.git] / ShellPkg / Application / Shell / ShellEnvVar.h
index 277895994aa500c9d63c3b429f4aa2dc8e367e1e..0684516a5c192c2348955cafac009533ac8bffd4 100644 (file)
@@ -6,7 +6,7 @@
 //#include <Library/UefiRuntimeServicesTableLib.h>\r
 \r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -27,20 +27,25 @@ typedef struct {
   UINT32      Atts;\r
 } ENV_VAR_LIST;\r
 \r
-/**\r
-  Reports whether an environment variable is Volatile or Non-Volatile\r
+//\r
+// The list is used to cache the environment variables.\r
+//\r
+extern ENV_VAR_LIST    gShellEnvVarList;\r
+\r
 \r
-  This will use the Runtime Services call GetVariable to to search for the variable.\r
+/**\r
+  Reports whether an environment variable is Volatile or Non-Volatile.\r
 \r
   @param EnvVarName             The name of the environment variable in question\r
+  @param Volatile               Return TRUE if the environment variable is volatile\r
 \r
-  @retval TRUE                  This environment variable is Volatile\r
-  @retval FALSE                 This environment variable is NON-Volatile\r
+  @retval EFI_SUCCESS           The volatile attribute is returned successfully\r
+  @retval others                Some errors happened.\r
 **/\r
-BOOLEAN\r
-EFIAPI\r
+EFI_STATUS\r
 IsVolatileEnv (\r
-  IN CONST CHAR16 *EnvVarName\r
+  IN CONST CHAR16 *EnvVarName,\r
+  OUT BOOLEAN     *Volatile\r
   );\r
 \r
 /**\r
@@ -145,13 +150,12 @@ IsVolatileEnv (
 /**\r
   Creates a list of all Shell-Guid-based environment variables.\r
 \r
-  @param[in,out] List           The pointer to pointer to LIST_ENTRY object for\r
-                                storing this list.\r
+  @param[in, out] List           The pointer to pointer to LIST_ENTRY object for\r
+                                 storing this list.\r
 \r
   @retval EFI_SUCCESS           the list was created sucessfully.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 GetEnvironmentVariableList(\r
   IN OUT LIST_ENTRY *List\r
   );\r
@@ -169,7 +173,6 @@ GetEnvironmentVariableList(
   @retval EFI_SUCCESS           The list was Set sucessfully.\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 SetEnvironmentVariableList(\r
   IN LIST_ENTRY *List\r
   );\r
@@ -190,7 +193,6 @@ SetEnvironmentVariableList(
   @sa SetEnvironmentVariableList\r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 SetEnvironmentVariables(\r
   IN CONST CHAR16 **Environment\r
   );\r
@@ -201,10 +203,86 @@ SetEnvironmentVariables(
   @param[in] List               The pointer to pointer to list.\r
 **/\r
 VOID\r
-EFIAPI\r
 FreeEnvironmentVariableList(\r
   IN LIST_ENTRY *List\r
   );\r
 \r
+/**\r
+  Find an environment variable in the gShellEnvVarList.\r
+\r
+  @param Key        The name of the environment variable.\r
+  @param Value      The value of the environment variable, the buffer\r
+                    shoule be freed by the caller.\r
+  @param ValueSize  The size in bytes of the environment variable\r
+                    including the tailing CHAR_NULL.\r
+  @param Atts       The attributes of the variable.\r
+\r
+  @retval EFI_SUCCESS       The command executed successfully.\r
+  @retval EFI_NOT_FOUND     The environment variable is not found in\r
+                            gShellEnvVarList.\r
+\r
+**/\r
+EFI_STATUS\r
+ShellFindEnvVarInList (\r
+  IN  CONST CHAR16    *Key,\r
+  OUT CHAR16          **Value,\r
+  OUT UINTN           *ValueSize,\r
+  OUT UINT32          *Atts OPTIONAL\r
+  );\r
+\r
+/**\r
+  Add an environment variable into gShellEnvVarList.\r
+\r
+  @param Key        The name of the environment variable.\r
+  @param Value      The value of environment variable.\r
+  @param ValueSize  The size in bytes of the environment variable\r
+                    including the tailing CHAR_NULL\r
+  @param Atts       The attributes of the variable.\r
+\r
+  @retval EFI_SUCCESS  The environment variable was added to list successfully.\r
+  @retval others       Some errors happened.\r
+\r
+**/\r
+EFI_STATUS\r
+ShellAddEnvVarToList (\r
+  IN CONST CHAR16     *Key,\r
+  IN CONST CHAR16     *Value,\r
+  IN UINTN            ValueSize,\r
+  IN UINT32           Atts\r
+  );\r
+\r
+/**\r
+  Remove a specified environment variable in gShellEnvVarList.\r
+\r
+  @param Key        The name of the environment variable.\r
+\r
+  @retval EFI_SUCCESS       The command executed successfully.\r
+  @retval EFI_NOT_FOUND     The environment variable is not found in\r
+                            gShellEnvVarList.\r
+**/\r
+EFI_STATUS\r
+ShellRemvoeEnvVarFromList (\r
+  IN CONST CHAR16           *Key\r
+  );\r
+\r
+/**\r
+  Initialize the gShellEnvVarList and cache all Shell-Guid-based environment\r
+  variables.\r
+\r
+**/\r
+EFI_STATUS\r
+ShellInitEnvVarList (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Destructe the gShellEnvVarList.\r
+\r
+**/\r
+VOID\r
+ShellFreeEnvVarList (\r
+  VOID\r
+  );\r
+\r
 #endif //_SHELL_ENVIRONMENT_VARIABLE_HEADER_\r
 \r