From 16353944c10cfe1c41df151a0b666178c04a2d09 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 9 Dec 2014 14:46:45 +0100 Subject: scripts/pcidev: support modules.alias as well Starting with kernel 3.15, modules.pcimap is empty. Modules.alias provides everything necessary even on older kernels, it's just that the format is different. But "modprobe -R" can give us the module name and is much faster at parsing the file than the previous loop. So let's first try with modules.alias when it's present, and fall back to modules.pcimap. This makes it compatible with newer kernels and is faster to process the file. --- scripts/pcidev | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/pcidev b/scripts/pcidev index 892c82a..1b2086d 100755 --- a/scripts/pcidev +++ b/scripts/pcidev @@ -175,7 +175,10 @@ for device in $pcidev; do # look for modules supporting these devices. We exclude the rare modules # which pretend to support any vendor/product/subsys for PCI bridges because # they tend to pop up everywhere there is a bridge. - if [ ! -z "$MAPFILE" ]; then + if [ ! -z "$MAPFILE" -a -s "${MAPFILE%.pcimap}.alias" ]; then + alias=$(printf "pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X" $xvid $xpid $xsvid $xspid $(((xclass >> 16) & 0xff)) $(((xclass >> 8) & 0xff)) $((xclass & 0xff))) + list=$(modprobe -R "$alias") + elif [ ! -z "$MAPFILE" ]; then list="" while read f1 f2 f3 f4 f5 f6 f7 rest; do [ "$f1" != "#" -a -n "$f7" ] || continue -- 1.7.12.1