From: Andreas Reichel <[email protected]> This patch series introduces a new variable into the core environment called `in_progress`. This variable signals, that the corresponding environment is currently being used by an update process. This way, the updater can resume in case of unexpected aborts. Additional resume information can be handled by using user variables. `ustate` is now only set to `INSTALLED` after an update has been finalized (read below), whereas `in_progress` is automatically set to `1` when a new environment is created. `in_progress` is used as a flag for ebg_env_create_new, to detect if a new environment has already been created. The flag is removed from the context struct.
The boot loader is adapted to never boot environments which are `in progress`. The existing selection/update mechanism of the bootloader is not touched otherwise. The API gets a new function `ebg_env_finalize_update` which finalizes an update by setting `in_progress` to 0 and `ustate` to INSTALLED. Additionally: * Code duplication is reduced in the API and the tools. * Readability of the environment dump of the tools is improved. * Two minor memory leaks in the argument parser are fixed, that went undetected before. * The unused user data type for ustate is corrected from 16-bit to 8-bit for consistency. * Fix API header comments regarding errno / -errno * Fix printf/fprintf inconsistency in tools/bg_setenv.c Signed-off-by: Andreas Reichel <[email protected]> Andreas Reichel (11): env: Include update process indicator env: Simplify code for bgenv_get/set bootloader: Ignore latest environment if in progress API: Automatically set in_progress but keep ustate API: Add update finalize function tools: bg_setenv: Add support for in_progress variable Bugfix: Fix datatype returned for ustate tools: bg_setenv: Improve parser code tools: bg_setenv: Improve output to user tools: Fix printf/fprintf inconsistency API: Correct prototype comments on return value env/env_api.c | 33 +++++++-- env/env_api_fat.c | 155 +++++++++++++++++++++++------------------- env/fatvars.c | 7 +- include/ebgenv.h | 11 ++- include/env_api.h | 1 + include/envdata.h | 2 +- tools/bg_setenv.c | 144 +++++++++++++++++++++++++++------------ tools/tests/test_ebgenv_api.c | 51 ++++++++------ 8 files changed, 254 insertions(+), 150 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/20171127121430.31448-1-andreas.reichel.ext%40siemens.com. For more options, visit https://groups.google.com/d/optout.
