/** @file
function declarations for shell environment functions.
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <Uefi.h>
#include <ShellBase.h>
#include <Guid/ShellVariableGuid.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include "ShellEnvVar.h"
/**
Reports whether an environment variable is Volatile or Non-Volatile.
@param EnvVarName The name of the environment variable in question
@retval TRUE This environment variable is Volatile
@retval FALSE This environment variable is NON-Volatile
**/
)
{
Size = 0;
//
// get the variable
//
&Attribs,
&Size,
Buffer);
if (Status == EFI_BUFFER_TOO_SMALL) {
&Attribs,
&Size,
Buffer);
}
//
// not found means volatile
//
if (Status == EFI_NOT_FOUND) {
return (TRUE);
}
//
// check for the Non Volatile bit
//
return (FALSE);
}
//
// everything else is volatile
//
return (TRUE);
}
/**
free function for ENV_VAR_LIST objects.
@param[in] List The pointer to pointer to list.
**/
)
{
return;
}
; IsListEmpty(List)
){
}
}
}
}
/**
Creates a list of all Shell-Guid-based environment variables.
@param[in, out] ListHead The pointer to pointer to LIST ENTRY object for
storing this list.
@retval EFI_SUCCESS the list was created sucessfully.
**/
)
{
return (EFI_INVALID_PARAMETER);
}
Status = gRT->QueryVariableInfo(EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS, &MaxStorSize, &RemStorSize, &MaxVarSize);
return (Status);
}
} else {
MaxVarSize = 16384;
}
if (VariableName == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
if (Status == EFI_NOT_FOUND){
break;
}
} else {
ValSize = 0;
Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(VariableName, &VarList->Atts, &ValSize, VarList->Val);
if (Status == EFI_BUFFER_TOO_SMALL){
} else {
Status = SHELL_GET_ENVIRONMENT_VARIABLE_AND_ATTRIBUTES(VariableName, &VarList->Atts, &ValSize, VarList->Val);
}
}
} else {
}
}
}
} // compare guid
} // while
}
return (Status);
}
/**
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.
@param[in] ListHead The pointer to LIST_ENTRY from
GetShellEnvVarList().
@retval EFI_SUCCESS the list was Set sucessfully.
**/
)
{
//
// Delete all the current environment variables
//
){
}
}
//
// set all the variables fron the list
//
){
} else {
}
}
return (Status);
}
/**
sets a list of all Shell-Guid-based environment variables.
@param 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.
@retval EFI_SUCCESS The command executed successfully.
@retval EFI_INVALID_PARAMETER The parameter is invalid.
@retval EFI_OUT_OF_RESOURCES Out of resources.
@sa SetEnvironmentVariableList
**/
)
{
if (Environment == NULL) {
return (EFI_INVALID_PARAMETER);
}
//
//
for ( CurrentCount = 0
;
; CurrentCount++
){
if (CurrentString == NULL) {
break;
}
}
} // for loop
//
// set this new list as the set of all environment variables.
// this function also frees the memory and deletes all pre-existing
// shell-guid based environment variables.
//
}