[Toybox] [TOY] lspci
Rob Landley
rob at landley.net
Tue Aug 6 16:04:36 PDT 2013
On 08/02/2013 01:31:57 AM, Isaac wrote:
> On Sat, Jul 27, 2013 at 09:56:53AM +0200, Felix Janda wrote:
> > Anyway Isaac is doing (or planning to do) a major rewrite enabling
> lspci
> > to read the pciid database for human readable names of vendors and
> devices.
>
> I have a question or two in regards to that.
> 1-mmap or fgets?
> It's a smallish file as data goes (currently~600 kb), and can be
> searched
> in very little time if mmap()ed.
> The alternative is an fgets() based loop, which could involve
> reading over 11,000 entries, and decent performance would require
> using a linked list for temporary storage, extracting and sorting the
> entries
> from the linked list, looping over the sorted entries and storing the
> text,
> then printing from the linked list (though you can print from the
> sorted data
> if you don't care about order).
> I'm thinking mmap sounds more practical.
Whichever is simpler? (Is lspci performance critical?)
> 2-is there a way to allow configuring a path in the toybox build
> system?
> The database can live in several places, so I was thinking to have a
> customizeable default and allow setting the path in kconfig as well.
In theory yes, since it's kconfig. (A somewhat stale version thereof.)
config WALRUS
string
default "/etc/walrus.rc"
In practice, we don't source .config and the scripts/make.sh plumbing
that makes generated/config.h is only looking for defined and undefined
to make 0 and 1 with. Looks like I need to extend it to do strings.
(Back in busybox I passed through both CONFIG_BLAH and CFG_BLAH and
then the other developers were eternally unclear on which got used for
what...)
I'll put it on the todo list...
Rob
More information about the Toybox
mailing list