From: Andreas Reichel <[email protected]> This patch set contains a fixes and a small API change to accomodate swupdate's needs for global data storage and an update to the documentation.
It also adds tests for user variables. Fixes: * Deleting a user variable is done by setting its data type field to USERVAR_TYPE_DELETED. The deletion function checks if the variable exists and deletes it if this type is recognized. However, if the variable was not found, the function created the variable instead with this datatype stored into the environment. This is fixed so that deleting non existing variables has no effect. Small API change: * User types, which were not used yet except with deletion of variables, were formerly introduced as a string. However, by defining it as a big integer, flags as well as data type definitions can be handled much better. USERVAR_TYPE_DELETED is converted into bit 63 of the data type field, which, if detected, causes deletion of the variable. A new FLAG "USERVAR_TYPE_GLOBAL" is introduced, which gives a variable the property "global" such that it is saved into all environment copies. This implements a feature needed by swupdate, which wants to store a temporary state which must not alter in failure cases or rollback scenarios. This flag is set per default so that all user variables are global variables. If a user wants to create user variables that are managed by the update mechanism, the functions ebg_env_set_ex / ebg_env_get_ex can be used, to explicitely set the variable datatype and omit the flag. Tools: * When using the -f option with bg_setenv, the default type for user variables is masked to never be global. Otherwise, other environments might be changed and no user variables get stored into the file. Signed-off-by: Andreas Reichel <[email protected]> Andreas Reichel (6): uservars: change type data field from char* to uint64_t uservars: Implement USERVAR_TYPE_GLOBAL flag bugfix: uservars: Fix deletion of deleted variables. Implement tests for user variables documentation: Update docs configure.ac: Fix detection of pkg-config configure.ac | 5 ++ docs/API.md | 55 +++++++++++++++- docs/UPDATE.md | 2 + env/env_api.c | 9 ++- env/env_api_fat.c | 52 ++++++++++++--- env/uservars.c | 55 +++++++++------- include/ebgenv.h | 26 ++++++-- include/env_api.h | 11 ++-- include/uservars.h | 13 ++-- tools/bg_setenv.c | 98 ++++++++++++++++++++++------- tools/tests/test_ebgenv_api.c | 33 +++++----- tools/tests/test_ebgenv_api_internal.c | 112 +++++++++++++++++++++++++++------ 12 files changed, 360 insertions(+), 111 deletions(-) -- 2.15.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/20171114132044.1907-1-andreas.reichel.ext%40siemens.com. For more options, visit https://groups.google.com/d/optout.
