From: John Schmoller <jschmoller@xes-inc.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC] env: Group environment variables
Date: Thu, 05 Nov 2009 14:25:39 -0600 [thread overview]
Message-ID: <1257452739.8937.1166.camel@johns> (raw)
In-Reply-To: <20091105195731.5BA593F6EC@gemini.denx.de>
On Thu, 2009-11-05 at 20:57 +0100, Wolfgang Denk wrote:
<snip>
>
> > 2) Trying to figure out which enviroment variables have already been printed
> > in groups is less than elegant. Currently, it's a brute-force approach of
> > looking through every entry until a variable is found in a group or not.
> > Suggestions for cleaner algorithms here would be appreciated.
>
> The repeated scanning and comparing doesn't make much sense to me.
> Probably it makes more sense to use a more suitable data structure
> here. How about performing a linear scan of the environment only
> once and convert it into a more easily processable data structure, say
> a hash table or a binary tree or whatever, and then operate on this.
> Here you can easily add additional flags like a pointer which group the
> variable belongs to (if any).
>
> Also, this would make it easier for example to print a sorted list.
>
> Eventually we should _always_ do that, i. e. replace the standard
> copy operation as done in env_relocate*() by a function that not only
> copies the environment, but converts it into a new internal
> representation. This might be beneficial to accelerate access to
> variables, too.
This is an excellent suggestion. I'll see what I can whip up.
>
> => print only a list of groups
>
> > If env_groups is defined, none of the grouping variables will be printed.
> > This seemed to clutter up the printenv output.
>
> I don't think this is a wise decision. Having "magic" variables which
> cannot be seen an idea I dislike. I think the standard "printenv"
> (without args) should print the grouping variables as first block.
Ok, I'll group the grouping variables into a group of their own.
> Also, it would be nice if "prontenv" now would allow to print a group,
> i. e. in your example something as "printenv net pci" should be
> supported.
This is already (accidentally :) supported. a "printenv $net" would do
just what you state.
> > Grouping environment variables will almost certainly lead to a reqirement for
> > bumping up CONFIG_SYS_MAXARGS.
>
> ...which raises the question why there is such a static limit in the
> first place. Yes, it was trivial to implement, but maybe this can be
> improved? Artificial limits on line lengths and numbers of arguments
> are a nice thing - to remove :-)
>
>
> Best regards,
>
> Wolfgang Denk
John
next prev parent reply other threads:[~2009-11-05 20:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-04 16:34 [U-Boot] [RFC] env: Group environment variables John Schmoller
2009-11-04 17:55 ` Mike Frysinger
2009-11-04 18:17 ` John Schmoller
2009-11-04 20:36 ` Mike Frysinger
2009-11-04 20:37 ` John Schmoller
2009-11-04 22:28 ` Wolfgang Denk
2009-11-05 19:57 ` Wolfgang Denk
2009-11-05 20:25 ` John Schmoller [this message]
2009-11-05 22:37 ` Wolfgang Denk
2009-11-05 22:42 ` John Schmoller
2009-11-16 23:15 ` 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=1257452739.8937.1166.camel@johns \
--to=jschmoller@xes-inc.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