Add efi_delenv

Add an interface to remove / delete UEFI variables.
This commit is contained in:
Warner Losh 2019-04-18 05:40:50 +00:00
parent 883d342d38
commit a13881aff4
2 changed files with 19 additions and 0 deletions

View File

@ -122,6 +122,7 @@ void cpy16to8(const CHAR16 *, char *, size_t);
* the loader setting / getting FreeBSD specific variables.
*/
EFI_STATUS efi_delenv(EFI_GUID *guid, const char *varname);
EFI_STATUS efi_freebsd_getenv(const char *v, void *data, __size_t *len);
EFI_STATUS efi_getenv(EFI_GUID *g, const char *v, void *data, __size_t *len);
EFI_STATUS efi_global_getenv(const char *v, void *data, __size_t *len);

View File

@ -103,3 +103,21 @@ efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr)
return (rv);
}
/*
* efi_delenv -- deletes the specified env variable
*/
EFI_STATUS
efi_delenv(EFI_GUID *guid, const char *name)
{
CHAR16 *var;
size_t len;
EFI_STATUS rv;
var = NULL;
if (utf8_to_ucs2(name, &var, &len) != 0)
return (EFI_OUT_OF_RESOURCES);
rv = RS->SetVariable(var, guid, 0, 0, NULL);
free(var);
return rv;
}