Go to the source code of this file.
function definitions for shell environment functions.
the following includes are required: #include <Guid/ShellVariableGuid.h> #include <Library/UefiRuntimeServicesTableLib.h>
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file ShellEnvVar.h.
◆ SHELL_DELETE_ENVIRONMENT_VARIABLE
#define SHELL_DELETE_ENVIRONMENT_VARIABLE |
( |
|
EnvVarName | ) |
|
Value: (
gRT->SetVariable((CHAR16*)EnvVarName, \
&gShellVariableGuid, \
0, \
0, \
EFI_RUNTIME_SERVICES * gRT
Delete a Non-Volatile environment variable.
This will use the Runtime Services call SetVariable to remove a non-volatile variable.
- Parameters
-
EnvVarName | The name of the environment variable in question |
- Return values
-
EFI_SUCCESS | The variable was deleted successfully |
other | An error occurred |
- See also
- SetVariable
Definition at line 55 of file ShellEnvVar.h.
◆ SHELL_GET_ENVIRONMENT_VARIABLE
#define SHELL_GET_ENVIRONMENT_VARIABLE |
( |
|
EnvVarName, |
|
|
|
BufferSize, |
|
|
|
Buffer |
|
) |
| |
Value: (
gRT->GetVariable((CHAR16*)EnvVarName, \
&gShellVariableGuid, \
0, \
BufferSize, \
Buffer))
Get an environment variable.
This will use the Runtime Services call GetVariable to get a variable.
- Parameters
-
EnvVarName | The name of the environment variable in question |
BufferSize | Pointer to the UINTN size of Buffer |
Buffer | Pointer buffer to get variable value into |
- Return values
-
EFI_SUCCESS | The variable's value was retrieved successfully |
other | An error occurred |
- See also
- SetVariable
Definition at line 95 of file ShellEnvVar.h.
◆ SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES
#define SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES |
( |
|
EnvVarName, |
|
|
|
Atts, |
|
|
|
BufferSize, |
|
|
|
Buffer |
|
) |
| |
Value: (
gRT->GetVariable((CHAR16*)EnvVarName, \
&gShellVariableGuid, \
Atts, \
BufferSize, \
Buffer))
Get an environment variable.
This will use the Runtime Services call GetVariable to get a variable.
- Parameters
-
EnvVarName | The name of the environment variable in question |
Atts | Pointer to the UINT32 for attributes (or NULL) |
BufferSize | Pointer to the UINTN size of Buffer |
Buffer | Pointer buffer to get variable value into |
- Return values
-
EFI_SUCCESS | The variable's value was retrieved successfully |
other | An error occurred |
- See also
- SetVariable
Definition at line 116 of file ShellEnvVar.h.
◆ SHELL_SET_ENVIRONMENT_VARIABLE_NV
#define SHELL_SET_ENVIRONMENT_VARIABLE_NV |
( |
|
EnvVarName, |
|
|
|
BufferSize, |
|
|
|
Buffer |
|
) |
| |
Value: (
gRT->SetVariable((CHAR16*)EnvVarName, \
&gShellVariableGuid, \
BufferSize, \
(VOID*)Buffer))
#define EFI_VARIABLE_NON_VOLATILE
Set a Non-Volatile environment variable.
This will use the Runtime Services call SetVariable to set a non-volatile variable.
- Parameters
-
EnvVarName | The name of the environment variable in question |
BufferSize | UINTN size of Buffer |
Buffer | Pointer to value to set variable to |
- Return values
-
EFI_SUCCESS | The variable was changed successfully |
other | An error occurred |
- See also
- SetVariable
Definition at line 75 of file ShellEnvVar.h.
◆ SHELL_SET_ENVIRONMENT_VARIABLE_V
#define SHELL_SET_ENVIRONMENT_VARIABLE_V |
( |
|
EnvVarName, |
|
|
|
BufferSize, |
|
|
|
Buffer |
|
) |
| |
Value: (
gRT->SetVariable((CHAR16*)EnvVarName, \
&gShellVariableGuid, \
EFI_VARIABLE_BOOTSERVICE_ACCESS, \
BufferSize, \
(VOID*)Buffer))
Set a Volatile environment variable.
This will use the Runtime Services call SetVariable to set a volatile variable.
- Parameters
-
EnvVarName | The name of the environment variable in question |
BufferSize | UINTN size of Buffer |
Buffer | Pointer to value to set variable to |
- Return values
-
EFI_SUCCESS | The variable was changed successfully |
other | An error occurred |
- See also
- SetVariable
Definition at line 136 of file ShellEnvVar.h.
◆ FreeEnvironmentVariableList()
free function for ENV_VAR_LIST objects.
- Parameters
-
[in] | List | The pointer to pointer to list. |
Definition at line 95 of file ShellEnvVar.c.
◆ GetEnvironmentVariableList()
Creates a list of all Shell-Guid-based environment variables.
- Parameters
-
[in,out] | List | The pointer to pointer to LIST_ENTRY object for storing this list. |
- Return values
-
EFI_SUCCESS | the list was created successfully. |
Creates a list of all Shell-Guid-based environment variables.
- Parameters
-
[in,out] | ListHead | The pointer to pointer to LIST ENTRY object for storing this list. |
- Return values
-
EFI_SUCCESS | the list was created successfully. |
Definition at line 134 of file ShellEnvVar.c.
◆ IsVolatileEnv()
Reports whether an environment variable is Volatile or Non-Volatile.
- Parameters
-
EnvVarName | The name of the environment variable in question |
Volatile | Return TRUE if the environment variable is volatile |
- Return values
-
EFI_SUCCESS | The volatile attribute is returned successfully |
others | Some errors happened. |
Definition at line 29 of file ShellEnvVar.c.
◆ SetEnvironmentVariableList()
Sets a list of all Shell-Guid-based environment variables. this will also eliminate all pre-existing shell environment variables (even if they are not on the list).
This function will also deallocate the memory from List.
- Parameters
-
[in] | List | The pointer to LIST_ENTRY from GetShellEnvVarList(). |
- Return values
-
EFI_SUCCESS | The list was Set successfully. |
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] | ListHead | The pointer to LIST_ENTRY from GetShellEnvVarList(). |
- Return values
-
EFI_SUCCESS | the list was Set successfully. |
Definition at line 254 of file ShellEnvVar.c.
◆ SetEnvironmentVariables()
sets all Shell-Guid-based environment variables. this will also eliminate all pre-existing shell environment variables (even if they are not on the list).
- Parameters
-
[in] | Environment | Points 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_SUCCESS | The command executed successfully. |
EFI_INVALID_PARAMETER | The parameter is invalid. |
EFI_OUT_OF_RESOURCES | Out of resources. |
- See also
- SetEnvironmentVariableList
sets a list of all Shell-Guid-based environment variables.
- Parameters
-
Environment | Points 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_SUCCESS | The command executed successfully. |
EFI_INVALID_PARAMETER | The parameter is invalid. |
EFI_OUT_OF_RESOURCES | Out of resources. |
- See also
- SetEnvironmentVariableList
Definition at line 322 of file ShellEnvVar.c.
◆ ShellAddEnvVarToList()
Add an environment variable into gShellEnvVarList.
- Parameters
-
Key | The name of the environment variable. |
Value | The value of environment variable. |
ValueSize | The size in bytes of the environment variable including the tailing CHAR_NULL |
Atts | The attributes of the variable. |
- Return values
-
EFI_SUCCESS | The environment variable was added to list successfully. |
others | Some errors happened. |
Definition at line 472 of file ShellEnvVar.c.
◆ ShellFindEnvVarInList()
Find an environment variable in the gShellEnvVarList.
- Parameters
-
Key | The name of the environment variable. |
Value | The value of the environment variable, the buffer shoule be freed by the caller. |
ValueSize | The size in bytes of the environment variable including the tailing CHAR_NULL. |
Atts | The attributes of the variable. |
- Return values
-
EFI_SUCCESS | The command executed successfully. |
EFI_NOT_FOUND | The environment variable is not found in gShellEnvVarList. |
Find an environment variable in the gShellEnvVarList.
- Parameters
-
Key | The name of the environment variable. |
Value | The value of the environment variable, the buffer shoule be freed by the caller. |
ValueSize | The size in bytes of the environment variable including the tailing CHAR_NELL. |
Atts | The attributes of the variable. |
- Return values
-
EFI_SUCCESS | The command executed successfully. |
EFI_NOT_FOUND | The environment variable is not found in gShellEnvVarList. |
Definition at line 426 of file ShellEnvVar.c.
◆ ShellFreeEnvVarList()
VOID ShellFreeEnvVarList |
( |
VOID |
| ) |
|
◆ ShellInitEnvVarList()
Initialize the gShellEnvVarList and cache all Shell-Guid-based environment variables.
Definition at line 576 of file ShellEnvVar.c.
◆ ShellRemvoeEnvVarFromList()
Remove a specified environment variable in gShellEnvVarList.
- Parameters
-
Key | The name of the environment variable. |
- Return values
-
EFI_SUCCESS | The command executed successfully. |
EFI_NOT_FOUND | The environment variable is not found in gShellEnvVarList. |
Definition at line 543 of file ShellEnvVar.c.
◆ gShellEnvVarList