public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Gerlando Falauto <gerlando.falauto@keymile.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] env: set individual variables to default
Date: Wed, 28 Sep 2011 11:20:10 +0200	[thread overview]
Message-ID: <4E82E6CA.9030802@keymile.com> (raw)
In-Reply-To: <20110923095545.337E6140797A@gemini.denx.de>

On 09/23/2011 11:55 AM, Wolfgang Denk wrote:

[...]
>> While we're on this subject, do you think it would make any sense to
>> *import* individual variables?
>
> Tough question.  In theory yes, it would make perfect sense. On the
> other hand, this is a boot loader, and we should not try to be
> feature-complete.  So far I haven't seen a use case for this.

Well, at Keymile we are essentially using "env import" as a way to have 
"default" variables stored in an external file (e.g., because they are 
only needed for development and not for production, and that not only 
reduces the site of the environments, but also makes updates easier).
To this extent, "env import" and "env default" sort of have the same 
purpose...

>> If yes, what could the syntax be?
>>
>>     env import [flags] addr [size]<vars...>
>
> env import -n name[,..] [other_flags] addr [size]
>
> ?

Uhm, wouldn't that make the syntax completely unrelated to all other 
commands, leading to confusion?

How about something like:

env import [-f] [flags] addr [size] [-n name[ ...]]
env default [-f] -a|-n name[ ...]
env set [-f] name [val ...]

?
Where:
  -a in "env default" would be the way to prevent the inadverent user
     from wrecking the environment by mistake.
  -f forces overwriting of read-only or write-once variables
  -n allows to be selective about which variables should be restored
     from default/external environment

>> would make the optional argument "size" ambiguous (unless we take for
>> granted that variable names cannot start with a digit...).
>
> But they can, at least until now.

Slightly off-topic: how about variables starting with "-"?

[...]
>> Anyway, the whole thing was based on the assumption that it could make
>> some sense at some point to import individual variables from a
>> downloaded file. If that's the case, code should be factored together
>> with himport_r() as you suggested. If not, most of this code (the part
>> checking for comments, tabs, '\0'...) can be safely deleted (and I don't
>> think factoring the rest would be necessary).
>
> I agree that it makes sense to generalize and clean up this interface.
> It makes sense to select individual variables, and it makes sense to
> unify the "-f" handling to enforce actions on protected variables
> (while without "-f" only actions on the "normal" variables should be
> done).
>
> I can even imagine introducing a new variable that contains the name
> of the write-protected variables (and probably other properties, like
> being excluded from saveenv, etc.) - this has been discussed a number
> of times before, now we have the code base in place to actually
> implement it.
>
> All we need to do is extend the struct entry (in "include/search.h")
> by an "int flags"), and we can there register properties like
> read-only, don't-save etc.  In a first step this could be added
> transparently - so we could remove all the special handling of
> "ethaddr", "serial#" etc. in common/cmd_nvedit.c; then we could unify
> this to include "eth1addr" etc as well; then  we could extend it to
> read the names of such variables and their properties from a variable,
> etc.
>
> ... there is plenty of ideas someone could pick up...
>

OK, one step at a time.
But it's definitely worth knowing your thoughts before starting.
Thank you for sharing them!

Best,
Gerlando Falauto

  reply	other threads:[~2011-09-28  9:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-22 15:06 [U-Boot] [PATCH 0/2] implement set individual variables to default Gerlando Falauto
2011-09-22 15:06 ` [U-Boot] [PATCH 1/2] env: " Gerlando Falauto
2011-09-22 19:51   ` Wolfgang Denk
2011-09-23  7:31     ` Gerlando Falauto
2011-09-23  9:55       ` Wolfgang Denk
2011-09-28  9:20         ` Gerlando Falauto [this message]
2011-09-28 21:08           ` Wolfgang Denk
2011-09-29  6:13             ` Gerlando Falauto
2011-09-22 15:06 ` [U-Boot] [PATCH 2/2] km/common: enable "env default" for all keymile boards Gerlando Falauto
2011-10-21 22:37   ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E82E6CA.9030802@keymile.com \
    --to=gerlando.falauto@keymile.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox