Hello, tech@!
The pci/usb (and others) known_{products,vendors} generated from
{pci,usb}devs are really big and scanning them is not so efficient.
I took the reyk@'s bsearch() implementation found in ieee80211 code
and moved it to libkern.
To sort tables I've rewritten the devlist2h from awk to perl, since
it can sort :). Imho, this implementation is a bit cleaner and
does not have that big license header.
Since usb/pci is only supported so far, I hope if you like it I can
continue replacing the rest of autoconf matching goo to bsearch
What do you think?
Index: conf/files
===================================================================
RCS file: /cvs/src/sys/conf/files,v
retrieving revision 1.504
diff -u -p -r1.504 files
--- conf/files 6 Oct 2010 22:19:20 -0000 1.504
+++ conf/files 16 Dec 2010 00:12:53 -0000
@@ -1085,6 +1085,7 @@ file lib/libkern/mcount.c gprof
file lib/libkern/getsn.c
file lib/libkern/random.c
file lib/libkern/timingsafe_bcmp.c
+file lib/libkern/bsearch.c
file lib/libkern/arch/${MACHINE_ARCH}/strchr.S | lib/libkern/strchr.c
file lib/libkern/arch/${MACHINE_ARCH}/strrchr.S | lib/libkern/strrchr.c
file lib/libkern/arch/${MACHINE_ARCH}/__main.S | lib/libkern/__main.c
Index: dev/pci/Makefile
===================================================================
RCS file: /cvs/src/sys/dev/pci/Makefile,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile
--- dev/pci/Makefile 14 Oct 1996 09:01:34 -0000 1.4
+++ dev/pci/Makefile 16 Dec 2010 00:12:53 -0000
@@ -1,8 +1,6 @@
# $OpenBSD: Makefile,v 1.4 1996/10/14 09:01:34 deraadt Exp $
-# $NetBSD: Makefile,v 1.1 1995/06/18 01:07:04 cgd Exp $
-AWK= awk
+PERL?= perl
-pcidevs.h pcidevs_data.h: pcidevs devlist2h.awk
- /bin/rm -f pcidevs.h pcidevs_data.h
- ${AWK} -f devlist2h.awk pcidevs
+pcidevs.h pcidevs_data.h: pcidevs devlist2h.pl
+ ${PERL} devlist2h.pl < pcidevs
Index: dev/pci/devlist2h.pl
===================================================================
RCS file: ...