[PATCH v3] env: remove vars that are not in default env

Simon Glass sjg at chromium.org
Tue Aug 13 14:17:20 CEST 2024


On Sun, 11 Aug 2024 at 12:44, Ravi Minnikanti <rminnikanti at marvell.com> wrote:
>
> current env_set_default_vars() doesn't delete
> var that are not in the imported env. hashtable
> removes vars that are not in the imported
> env but present in the current env only if H_NOCLEAR
> flag is not set.
>
> This change is to avoid passing H_NOCLEAR flag if
> specific vars are passed to env_set_default_vars()
>
> Without this change:
> Marvell>> env default boot_mode
> Marvell>>
>
> With the change:
> Marvell>> env default boot_mode
> WARNING: 'boot_mode' not in imported env, deleting it!
>
> Signed-off-by: Ravi Minnikanti <rminnikanti at marvell.com>
> ---
> Changes in v2:
> - Added env ut to test the scenario
> - Updated doc usage/cmd/env.rst
>
> => ut env
> Running 5 environment tests
> Test: env_test_attrs_lookup: attr.c
> Test: env_test_attrs_lookup_regex: attr.c
> Test: env_test_env_cmd: cmd_ut_env.c
> Test: env_test_htab_deletes: hashtable.c
> Test: env_test_htab_fill: hashtable.c
> Failures: 0
>
> Changes in v3:
> - Fixed review comments
> - Ran checkpatch.pl and fixed trailing whitespaces.
> - Used UT_TESTF_CONSOLE_REC flag instead of console_record_reset_enable()
> - Removed unnecessary ut_assert_nextline_empty() check
> ---
>  doc/usage/cmd/env.rst |  4 +++-
>  env/common.c          | 10 +++++++++-
>  test/env/cmd_ut_env.c | 27 +++++++++++++++++++++++++++
>  3 files changed, 39 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list