On Tue, Nov 07, 2017 at 05:24:14PM +0100, Claudius Heine wrote:
> Hi,
>
> On 11/07/2017 03:12 PM, [ext] Andreas J. Reichel wrote:
> > From: Andreas Reichel <[email protected]>
> >
> > If the above flag is set in the type field of a user variable,
> > bgenv_set_uservar_global is called, which iterates all environments
> > and stores the given variable globally.
> >
> > If the flag is absent, only the environment specified by the context
> > handle gets affected.
> >
> > The flag is set per default if not otherwise specified.
> >
> > Signed-off-by: Andreas Reichel <[email protected]>
> > ---
> > env/env_api_fat.c | 36 ++++++++++++++++++++++++++++++++++++
> > include/env_api.h | 2 ++
> > 2 files changed, 38 insertions(+)
> >
> > diff --git a/env/env_api_fat.c b/env/env_api_fat.c
> > index 7d5e714..0aef867 100644
> > --- a/env/env_api_fat.c
> > +++ b/env/env_api_fat.c
> > @@ -320,6 +320,38 @@ int bgenv_get(BGENV *env, char *key, uint64_t *type,
> > void *data,
> > return 0;
> > }
> > +int bgenv_set_uservar_global(char *key, uint64_t type, void *data,
> > + uint32_t datalen)
> > +{
> > + int ret = 0;
> > + for (int i = 0; i < ENV_NUM_CONFIG_PARTS; i++) {
> > + BGENV *env = bgenv_open_by_index(i);
> > + if (!env) {
> > + ret = -EIO;
> > + VERBOSE(stderr, "bgenv_set_uservar_global: Could not "
> > + "open config partition #%d: (%s)\n",
> > + i, strerror(-ret));
>
> Not sure what 'VERBOSE' should stand for. Is is more for debugging messages
> or for any message?
>
> I would expect that errors that occurred should be printed out regardless of
> the logging level.
>
> Claudius
So far in the API we only printed something if the user activated
logging. If we want to change this, we should do that in an extra patch
for consistency reasons.
Andreas
>
> > + continue;
> > + }
> > + int r = bgenv_set_uservar(env->data->userdata, key, type, data,
> > + datalen);
> > + if (r) {
> > + VERBOSE(stderr, "bgenv_set_uservar_global: Could not "
> > + "set uservar on config partition "
> > + " #%d: (%s)\n", i, strerror(-r));
> > + ret = r;
> > + }
> > + if (!bgenv_write(env)) {
> > + ret = -EIO;
> > + VERBOSE(stderr, "bgenv_set_uservar_global: Could not "
> > + " store environment to partition "
> > + " #%d: (%s)\n", i, strerror(-ret));
> > + }
> > + (void)bgenv_close(env);
> > + }
> > + return ret;
> > +}
> > +
> > int bgenv_set(BGENV *env, char *key, uint64_t type, void *data,
> > uint32_t datalen)
> > {
> > @@ -337,6 +369,10 @@ int bgenv_set(BGENV *env, char *key, uint64_t type,
> > void *data,
> > return -EPERM;
> > }
> > if (e == EBGENV_UNKNOWN) {
> > + if (type & USERVAR_TYPE_GLOBAL) {
> > + return bgenv_set_uservar_global(key, type, data,
> > + datalen);
> > + }
> > return bgenv_set_uservar(env->data->userdata, key, type, data,
> > datalen);
> > }
> > diff --git a/include/env_api.h b/include/env_api.h
> > index 8ea2c11..3b1ba1f 100644
> > --- a/include/env_api.h
> > +++ b/include/env_api.h
> > @@ -83,5 +83,7 @@ extern int bgenv_get(BGENV *env, char *key, uint64_t
> > *type, void *data,
> > uint32_t maxlen);
> > extern int bgenv_set(BGENV *env, char *key, uint64_t type, void *data,
> > uint32_t datalen);
> > +extern int bgenv_set_uservar_global(char *key, uint64_t type,
> > + void *data, uint32_t datalen);
> > #endif // __ENV_API_H__
> >
>
> --
> 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]
--
Andreas Reichel
Dipl.-Phys. (Univ.)
Software Consultant
[email protected], +49-174-3180074
TNG Technology Consulting GmbH, Betastr. 13a, 85774 Unterfoehring
Geschaeftsfuehrer: Henrik Klagges, Dr. Robert Dahlke, Gerhard Mueller
Sitz: Unterfoehring * Amtsgericht Muenchen * HRB 135082
--
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/20171108091549.GA5299%40iiotirae.
For more options, visit https://groups.google.com/d/optout.