On 19.02.25 17:12, 'Jan Kiszka' via EFI Boot Guard wrote: > From: Jan Kiszka <jan.kis...@siemens.com> > > ebg_env_getglobalstate neither used nor needs a concrete environment > for retrieving the effective state over all envs. The passed parameter > has always been ignored and was probably only introduced to have a > consistent signature compared to ebg_env_setglobalstate or other > functions.
...but it does need a prior call to bgenv_init which is only officially available via open or create. I'm considering to add bgenv_init to this function here as well now. Jan > > At the same time, opening and closing an env via ebg_env_open_current > and ebg_env_close is unfortunately not side-effect free which can cause > surprises to users, see e.g. [1]. It is therefore better to avoid any > needless opening of envs by officially declaring the parameter as > reserved, just asking the user to pass NULL from now on. > > This does not change our API practically, it just makes it official that > the parameter is unneeded. For that reason, we do not even enforce the > parameter to be actually NULL. Users can continue to pass valid envs > as well. > > [1] https://groups.google.com/g/efibootguard-dev/c/hAFE-LQ5cvc > > Signed-off-by: Jan Kiszka <jan.kis...@siemens.com> > --- > env/env_api.c | 2 +- > include/ebgenv.h | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/env/env_api.c b/env/env_api.c > index 0feb127..e11f8c3 100644 > --- a/env/env_api.c > +++ b/env/env_api.c > @@ -176,7 +176,7 @@ uint32_t ebg_env_user_free(ebgenv_t *e) > return bgenv_user_free(((BGENV *)e->bgenv)->data->userdata); > } > > -uint16_t ebg_env_getglobalstate(ebgenv_t __attribute__((unused)) *e) > +uint16_t ebg_env_getglobalstate(void __attribute__((unused)) *reserved) > { > BGENV *env; > int res = USTATE_UNKNOWN; > diff --git a/include/ebgenv.h b/include/ebgenv.h > index c62d271..60ba81c 100644 > --- a/include/ebgenv.h > +++ b/include/ebgenv.h > @@ -136,10 +136,10 @@ int ebg_env_get_ex(ebgenv_t *e, char *key, uint64_t > *datatype, uint8_t *buffer, > uint32_t ebg_env_user_free(ebgenv_t *e); > > /** @brief Get global ustate value, accounting for all environments > - * @param e A pointer to an ebgenv_t context. > + * @param reserved Historic parameter, must be NULL. > * @return ustate value > */ > -uint16_t ebg_env_getglobalstate(ebgenv_t *e); > +uint16_t ebg_env_getglobalstate(void *reserved); > > /** @brief Set global ustate value, accounting for all environments > * if state is set to zero and updating only current environment if -- Siemens AG, Foundational Technologies Linux Expert Center -- 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 efibootguard-dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/efibootguard-dev/bf2def5f-0a14-49bb-bdc8-fb0142a22806%40siemens.com.