On 2018-05-25 14:01, [ext] Andreas J. Reichel wrote:
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);

I should be possible to merge EBGENV_FAILSAFE with EBGENV_IN_PROGRESS.

        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;

This as well?

        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;

--
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: [email protected]

--
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/e6639fe7-5247-8462-8712-d13556e3ea38%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to