[U-Boot] [PATCH RFC] env: add command to set individual variables to default

Wolfgang Denk wd at denx.de
Thu Oct 6 23:39:00 CEST 2011


Dear Gerlando Falauto,

In message <1315471768-21608-1-git-send-email-gerlando.falauto at keymile.com> you wrote:
> Here I am proposing an implementation for setting individual variables
> to their default values as outlined in
> http://www.denx.de/wiki/U-Boot/TaskSetEnvironmentDefaults
> 
> For instance, to reset defautl values for variables bootcmd and bootdelay:
> => env default bootcmd bootdelay
> 
> There are a few issues which are not fully covered.
> [In braces I put the behavior of this patch].
> 
> 1) Previous implementation of “env default” only worked for the whole
> environment, and “-f” was necessary in order to prevent the unexperienced
> user from messing up the environment by just typing command names.
> Should this behavior be kept? [Yes]
> 
> 2) When a variable is not defined in the default environment, should
> it get deleted (if existing)? [Yes] Should a warning be issued? [No]
> What if it is neither defined in the current nor in the default env?
> 
> 3) Should it be possible to disable this feature (i.e. to save space)?
> [No]
> Any suggestions for a meaningful configuration token?
> I was thinking of CONFIG_RESTORE_INDIVIDUAL_ENV_VARS.
> 
> 4) This implementation comes mostly from himport_r().
> It crossed my mind that it might also be useful to *import*
> individual variables from a file (rather that the default env).
> 
> For instance:
> env import [flags] addr size vars...
> 
> Would only import variables "vars" and ignore all others.
> 
> With this idea in mind I kept all himport_r()'s support for external files
> (i.e., comments, separator other than '\0', quoting).
> If no one else envisions any use for such import commands, the code could
> obviously be much smaller and simpler.
> 
> Signed-off-by: Gerlando Falauto <gerlando.falauto at keymile.com>
> Signed-off-by: Holger Brunck <holger.brunck at keymile.com>
> cc: Wolfgang Denk <wd at denx.de>
> ---
>  common/cmd_nvedit.c   |   12 +++++-
>  common/env_common.c   |  106 +++++++++++++++++++++++++++++++++++++++++++++++++
>  include/environment.h |    3 +
>  3 files changed, 119 insertions(+), 2 deletions(-)

Checkpatch says:

total: 5 errors, 0 warnings, 147 lines checked

Please clean up and resubmit.  Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Zero is an enigmatic value. It can mean success (fclose)  or  failure
(scanf).  It  can  mean  black  or  white. It can mean no permissions
(chmod) or all permissions (umask). It can mean now (setjmp) or later
(atexit). It can mean the beginning (lseek) or the end (read). It can
mean myself (getpgrp) or child (fork). It can mean  all  (kill's  1st
argument)  or  nothing  (kill's  2nd argument). It can mean `default'
(SIG_IGN) or `I don't care' (waitpid) or  `try  to  guess'  (strtol).
Indeed 0 lets you talk to God (setuid).
Verily is 0 all things to all people.


More information about the U-Boot mailing list