From: Andreas Reichel <[email protected]> Add new enum member for ENV_STATUS_FAILSAFE flag to use bg_setenv and bg_getenv for it.
Signed-off-by: Andreas Reichel <[email protected]> --- env/env_api_fat.c | 24 ++++++++++++++++++++++++ include/env_api.h | 1 + 2 files changed, 25 insertions(+) diff --git a/env/env_api_fat.c b/env/env_api_fat.c index 2f71094..6f759f0 100644 --- a/env/env_api_fat.c +++ b/env/env_api_fat.c @@ -43,6 +43,10 @@ EBGENVKEY bgenv_str2enum(char *key) if (strncmp(key, "in_progress", strlen("in_progress") + 1) == 0) { return EBGENV_IN_PROGRESS; } + if (strncmp(key, "env_status_failsafe", + strlen("env_status_failsafe") + 1) == 0) { + return EBGENV_FAILSAFE; + } return EBGENV_UNKNOWN; } @@ -322,6 +326,11 @@ int bgenv_get(BGENV *env, char *key, uint64_t *type, void *data, env->data->status_flags & ENV_STATUS_IN_PROGRESS, USERVAR_TYPE_UINT8); + case EBGENV_FAILSAFE: + return bgenv_get_uint(buffer, type, data, + env->data->status_flags & + ENV_STATUS_FAILSAFE, + USERVAR_TYPE_UINT8); default: if (!data) { return 0; @@ -411,6 +420,21 @@ int bgenv_set(BGENV *env, char *key, uint64_t type, void *data, return -EINVAL; } break; + case EBGENV_FAILSAFE: + val = bgenv_convert_to_long(value); + if (val < 0) { + return val; + } + switch(val) { + case 1: + env->data->status_flags |= ENV_STATUS_FAILSAFE; + break; + case 0: + env->data->status_flags &= ~ENV_STATUS_FAILSAFE; + default: + return -EINVAL; + } + break; default: return -EINVAL; } diff --git a/include/env_api.h b/include/env_api.h index 45bf4b7..04516bb 100644 --- a/include/env_api.h +++ b/include/env_api.h @@ -54,6 +54,7 @@ typedef enum { EBGENV_REVISION, EBGENV_USTATE, EBGENV_IN_PROGRESS, + EBGENV_FAILSAFE, EBGENV_UNKNOWN } EBGENVKEY; -- 2.17.0 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/20180525120108.31055-13-andreas.reichel.ext%40siemens.com. For more options, visit https://groups.google.com/d/optout.
