diff --git a/stand/efi/include/efilib.h b/stand/efi/include/efilib.h index c88d55a53d96..f33affbdef65 100644 --- a/stand/efi/include/efilib.h +++ b/stand/efi/include/efilib.h @@ -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); diff --git a/stand/efi/libefi/efienv.c b/stand/efi/libefi/efienv.c index d71281ce6d62..3a3822eef8e1 100644 --- a/stand/efi/libefi/efienv.c +++ b/stand/efi/libefi/efienv.c @@ -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; +}