TianoCore EDK2 master
Loading...
Searching...
No Matches
ShellEnvVar.c File Reference
#include "Shell.h"

Go to the source code of this file.

Macros

#define INIT_NAME_BUFFER_SIZE   128
 
#define INIT_DATA_BUFFER_SIZE   1024
 

Functions

EFI_STATUS IsVolatileEnv (IN CONST CHAR16 *EnvVarName, OUT BOOLEAN *Volatile)
 
VOID FreeEnvironmentVariableList (IN LIST_ENTRY *List)
 
EFI_STATUS GetEnvironmentVariableList (IN OUT LIST_ENTRY *ListHead)
 
EFI_STATUS SetEnvironmentVariableList (IN LIST_ENTRY *ListHead)
 
EFI_STATUS SetEnvironmentVariables (IN CONST CHAR16 **Environment)
 
EFI_STATUS ShellFindEnvVarInList (IN CONST CHAR16 *Key, OUT CHAR16 **Value, OUT UINTN *ValueSize, OUT UINT32 *Atts OPTIONAL)
 
EFI_STATUS ShellAddEnvVarToList (IN CONST CHAR16 *Key, IN CONST CHAR16 *Value, IN UINTN ValueSize, IN UINT32 Atts)
 
EFI_STATUS ShellRemvoeEnvVarFromList (IN CONST CHAR16 *Key)
 
EFI_STATUS ShellInitEnvVarList (VOID)
 
VOID ShellFreeEnvVarList (VOID)
 

Variables

ENV_VAR_LIST gShellEnvVarList
 

Detailed Description

function declarations for shell environment functions.

Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file ShellEnvVar.c.

Macro Definition Documentation

◆ INIT_DATA_BUFFER_SIZE

#define INIT_DATA_BUFFER_SIZE   1024

Definition at line 12 of file ShellEnvVar.c.

◆ INIT_NAME_BUFFER_SIZE

#define INIT_NAME_BUFFER_SIZE   128

Definition at line 11 of file ShellEnvVar.c.

Function Documentation

◆ FreeEnvironmentVariableList()

VOID FreeEnvironmentVariableList ( IN LIST_ENTRY List)

free function for ENV_VAR_LIST objects.

Parameters
[in]ListThe pointer to pointer to list.

Definition at line 95 of file ShellEnvVar.c.

◆ GetEnvironmentVariableList()

EFI_STATUS GetEnvironmentVariableList ( IN OUT LIST_ENTRY ListHead)

Creates a list of all Shell-Guid-based environment variables.

Parameters
[in,out]ListHeadThe pointer to pointer to LIST ENTRY object for storing this list.
Return values
EFI_SUCCESSthe list was created successfully.

Definition at line 134 of file ShellEnvVar.c.

◆ IsVolatileEnv()

EFI_STATUS IsVolatileEnv ( IN CONST CHAR16 *  EnvVarName,
OUT BOOLEAN *  Volatile 
)

Reports whether an environment variable is Volatile or Non-Volatile.

Parameters
EnvVarNameThe name of the environment variable in question
VolatileReturn TRUE if the environment variable is volatile
Return values
EFI_SUCCESSThe volatile attribute is returned successfully
othersSome errors happened.

Definition at line 29 of file ShellEnvVar.c.

◆ SetEnvironmentVariableList()

EFI_STATUS SetEnvironmentVariableList ( IN LIST_ENTRY ListHead)

Sets a list of all Shell-Guid-based environment variables. this will also eliminate all existing shell environment variables (even if they are not on the list).

This function will also deallocate the memory from List.

Parameters
[in]ListHeadThe pointer to LIST_ENTRY from GetShellEnvVarList().
Return values
EFI_SUCCESSthe list was Set successfully.

Definition at line 254 of file ShellEnvVar.c.

◆ SetEnvironmentVariables()

EFI_STATUS SetEnvironmentVariables ( IN CONST CHAR16 **  Environment)

sets a list of all Shell-Guid-based environment variables.

Parameters
EnvironmentPoints to a NULL-terminated array of environment variables with the format 'x=y', where x is the environment variable name and y is the value.
Return values
EFI_SUCCESSThe command executed successfully.
EFI_INVALID_PARAMETERThe parameter is invalid.
EFI_OUT_OF_RESOURCESOut of resources.
See also
SetEnvironmentVariableList

Definition at line 322 of file ShellEnvVar.c.

◆ ShellAddEnvVarToList()

EFI_STATUS ShellAddEnvVarToList ( IN CONST CHAR16 *  Key,
IN CONST CHAR16 *  Value,
IN UINTN  ValueSize,
IN UINT32  Atts 
)

Add an environment variable into gShellEnvVarList.

Parameters
KeyThe name of the environment variable.
ValueThe value of environment variable.
ValueSizeThe size in bytes of the environment variable including the tailing CHAR_NULL
AttsThe attributes of the variable.
Return values
EFI_SUCCESSThe environment variable was added to list successfully.
othersSome errors happened.

Definition at line 472 of file ShellEnvVar.c.

◆ ShellFindEnvVarInList()

EFI_STATUS ShellFindEnvVarInList ( IN CONST CHAR16 *  Key,
OUT CHAR16 **  Value,
OUT UINTN ValueSize,
OUT UINT32 *Atts  OPTIONAL 
)

Find an environment variable in the gShellEnvVarList.

Parameters
KeyThe name of the environment variable.
ValueThe value of the environment variable, the buffer shoule be freed by the caller.
ValueSizeThe size in bytes of the environment variable including the tailing CHAR_NELL.
AttsThe attributes of the variable.
Return values
EFI_SUCCESSThe command executed successfully.
EFI_NOT_FOUNDThe environment variable is not found in gShellEnvVarList.

Definition at line 426 of file ShellEnvVar.c.

◆ ShellFreeEnvVarList()

VOID ShellFreeEnvVarList ( VOID  )

Destructe the gShellEnvVarList.

Definition at line 593 of file ShellEnvVar.c.

◆ ShellInitEnvVarList()

EFI_STATUS ShellInitEnvVarList ( VOID  )

Initialize the gShellEnvVarList and cache all Shell-Guid-based environment variables.

Definition at line 576 of file ShellEnvVar.c.

◆ ShellRemvoeEnvVarFromList()

EFI_STATUS ShellRemvoeEnvVarFromList ( IN CONST CHAR16 *  Key)

Remove a specified environment variable in gShellEnvVarList.

Parameters
KeyThe name of the environment variable.
Return values
EFI_SUCCESSThe command executed successfully.
EFI_NOT_FOUNDThe environment variable is not found in gShellEnvVarList.

Definition at line 543 of file ShellEnvVar.c.

Variable Documentation

◆ gShellEnvVarList

ENV_VAR_LIST gShellEnvVarList

Definition at line 17 of file ShellEnvVar.c.