Project

General

Profile

Actions

Feature #13630

closed

libpcidb could know about class codes

Added by Robert Mustacchi 6 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Category:
lib - userland libraries
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Currently libpcidb provides programmatic access to the PCI ID database and is used in a number of places including, prtconf, fwflash, smbios, topo, and libptt It would be great if it could also support translating class codes. As part of this, this adds a few things:

  • New functions in libpcidb for dealing with class codes
  • A private command for folks to play with (/usr/lib/pci/pcidb) that allows human and CLI driven access to the database
  • A test suite that exercises the combination of the command and libpcidb.

While the pcidb parsing logic today is rather assuming of a valid file being present, this change does not overhaul that but we should in the future.

Actions #1

Updated by Electric Monk 6 months ago

  • Gerrit CR set to 1330
Actions #2

Updated by Robert Mustacchi 6 months ago

To test this, I've manually used the new command, looked at differences in prtconf, and also went through and ran the test suites:

rm@beowulf:~$ pfexec /opt/util-tests/bin/utiltest 
Test: /opt/util-tests/tests/allowed-ips (run as root)             [00:00] [PASS]
Test: /opt/util-tests/tests/chown_test (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/date_test (run as root)               [00:00] [PASS]
Test: /opt/util-tests/tests/find/findtest (run as root)           [00:00] [PASS]
Test: /opt/util-tests/tests/grep_test (run as root)               [00:03] [PASS]
Test: /opt/util-tests/tests/head/head_test (run as root)          [00:00] [PASS]
Test: /opt/util-tests/tests/libjedec_test (run as root)           [00:00] [PASS]
Test: /opt/util-tests/tests/libsff/libsff (run as root)           [00:00] [PASS]
Test: /opt/util-tests/tests/make_test (run as root)               [00:00] [PASS]
Test: /opt/util-tests/tests/mdb/mdbtest (run as root)             [00:00] [PASS]
Test: /opt/util-tests/tests/mergeq/mqt (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/mergeq/wqt (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/pcidbtest (run as root)               [00:01] [PASS]
Test: /opt/util-tests/tests/printf_test (run as root)             [00:00] [PASS]
Test: /opt/util-tests/tests/set-linkprop (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/sleep/sleeptest (run as root)         [00:23] [PASS]
Test: /opt/util-tests/tests/smbios (run as root)                  [00:00] [PASS]
Test: /opt/util-tests/tests/xargs_test (run as root)              [00:00] [PASS]
Test: /opt/util-tests/tests/awk/runtests.sh (run as nobody)       [02:57] [PASS]
Test: /opt/util-tests/tests/ctf/precheck (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/ctf/ctftest (run as root)             [00:06] [PASS]
Test: /opt/util-tests/tests/demangle/afl-fast (run as root)       [00:01] [PASS]
Test: /opt/util-tests/tests/demangle/gcc-libstdc++ (run as root)  [00:00] [PASS]
Test: /opt/util-tests/tests/demangle/llvm-stdcxxabi (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libcustr/custr_remove (run as root)   [00:00] [PASS]
Test: /opt/util-tests/tests/libcustr/custr_trunc (run as root)    [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_00_blank (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_01_boolean (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_02_numbers (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_03_empty_arrays (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_04_number_arrays (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_05_strings (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_06_nested (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/libnvpair_json/json_07_nested_arrays (run as root) [00:00] [PASS]
Test: /opt/util-tests/tests/sed/sed_addr (run as root)            [00:00] [PASS]
Test: /opt/util-tests/tests/sed/multi_test (run as root)          [00:00] [PASS]

Results Summary
PASS      36

Running Time:   00:03:39
Percent passed: 100.0%
Log directory:  /var/tmp/test_results/20210318T183032
rm@beowulf:~$ /opt/util-tests/tests/pcidbtest 
TEST PASSED: successfully matched against -v -p -o vid pci8086 pci1de
TEST PASSED: successfully matched against -v -p -o vendor pci1022
TEST PASSED: successfully matched against -p -o vid,did,device pci1af4,1044
TEST PASSED: successfully matched against -s -p -o subvendor,subsystem pci1000,97.1028,1f45
TEST PASSED: successfully matched against -i -p -o bcc,scc,pi,interface pciclass,0c0330
TEST PASSED: successfully matched against -S -p -o subclass pciexclass,0e
TEST PASSED: successfully matched against -s -p -o subsystem pci1590,216,s
TEST PASSED: successfully matched against -d pciclass,03
TEST PASSED: successfully matched against -S pci1000
TEST PASSED: successfully matched against -v pci8086,1234
TEST PASSED: successfully matched against -c pciclass,010802
TEST PASSED: invalid filter foo
TEST PASSED: invalid filter ;ffvi
TEST PASSED: invalid filter 12345
TEST PASSED: invalid filter pc8086
TEST PASSED: invalid filter pciqwer
TEST PASSED: invalid filter pci12345
TEST PASSED: invalid filter pci8086,
TEST PASSED: invalid filter pci8086,locke
TEST PASSED: invalid filter pci8086sigh
TEST PASSED: invalid filter pci8086,p
TEST PASSED: invalid filter pci8086,12345
TEST PASSED: invalid filter pci8086,1234zz
TEST PASSED: invalid filter pci8086,1234.
TEST PASSED: invalid filter pci8086,1234,
TEST PASSED: invalid filter pci8086,1234,b
TEST PASSED: invalid filter pci8086,1234,8
TEST PASSED: invalid filter pci8086,1234,wat
TEST PASSED: invalid filter pci8086,1234.terra
TEST PASSED: invalid filter pci8086,1234.terra,celes
TEST PASSED: invalid filter pci8086,1234.fffff
TEST PASSED: invalid filter pci8086,1234.abcd,
TEST PASSED: invalid filter pci8086,1234.abcd.
TEST PASSED: invalid filter pci8086,1234.abcdqr
TEST PASSED: invalid filter pci8086,1234.abcd,2,p
TEST PASSED: invalid filter pci8086,1234.abcd,2000000000
TEST PASSED: invalid filter pci8086,1234.abcd,kefka
TEST PASSED: invalid filter pci8086,1234.abcd,34ultros
TEST PASSED: invalid filter pciexqwer
TEST PASSED: invalid filter pciex12345
TEST PASSED: invalid filter pciex8086,
TEST PASSED: invalid filter pciex8086,locke
TEST PASSED: invalid filter pciex8086sigh
TEST PASSED: invalid filter pciex8086,p
TEST PASSED: invalid filter pciex8086,12345
TEST PASSED: invalid filter pciex8086,1234zz
TEST PASSED: invalid filter pciex8086,1234.
TEST PASSED: invalid filter pciex8086,1234,
TEST PASSED: invalid filter pciex8086,1234,b
TEST PASSED: invalid filter pciex8086,1234,8
TEST PASSED: invalid filter pciex8086,1234,wat
TEST PASSED: invalid filter pciex8086,1234.terra
TEST PASSED: invalid filter pciex8086,1234.terra,celes
TEST PASSED: invalid filter pciex8086,1234.fffff
TEST PASSED: invalid filter pciex8086,1234.abcd,
TEST PASSED: invalid filter pciex8086,1234.abcd.
TEST PASSED: invalid filter pciex8086,1234.abcdqr
TEST PASSED: invalid filter pciex8086,1234.abcd,2,p
TEST PASSED: invalid filter pciex8086,1234.abcd,2000000000
TEST PASSED: invalid filter pciex8086,1234.abcd,kefka
TEST PASSED: invalid filter pciex8086,1234.abcd,34ultros
TEST PASSED: invalid filter pciclas
TEST PASSED: invalid filter pciclassedgar
TEST PASSED: invalid filter pciclass,sabin
TEST PASSED: invalid filter pciclass,0
TEST PASSED: invalid filter pciclass,013
TEST PASSED: invalid filter pciclass,01345
TEST PASSED: invalid filter pciclass,0134567
TEST PASSED: invalid filter pciclass,01,
TEST PASSED: invalid filter pciclass,010,
TEST PASSED: invalid filter pciclass,010aa,
TEST PASSED: invalid filter pciclass,0102as
TEST PASSED: invalid filter pciclass,0102.as
TEST PASSED: invalid filter pciclass,0102@as
TEST PASSED: invalid filter pciclass,010298aa
TEST PASSED: invalid filter pciclass,010298,
TEST PASSED: invalid filter pciclass,010298!
TEST PASSED: invalid filter pciclass,010298!shadow
TEST PASSED: invalid filter pciexclas
TEST PASSED: invalid filter pciexclassedgar
TEST PASSED: invalid filter pciexclass,sabin
TEST PASSED: invalid filter pciexclass,0
TEST PASSED: invalid filter pciexclass,013
TEST PASSED: invalid filter pciexclass,01345
TEST PASSED: invalid filter pciexclass,0134567
TEST PASSED: invalid filter pciexclass,01,
TEST PASSED: invalid filter pciexclass,010,
TEST PASSED: invalid filter pciexclass,010aa,
TEST PASSED: invalid filter pciexclass,0102as
TEST PASSED: invalid filter pciexclass,0102.as
TEST PASSED: invalid filter pciexclass,0102@as
TEST PASSED: invalid filter pciexclass,010298aa
TEST PASSED: invalid filter pciexclass,010298,
TEST PASSED: invalid filter pciexclass,010298!
TEST PASSED: invalid filter pciexclass,010298!shadow
TEST PASSED: invalid arguments -p
TEST PASSED: invalid arguments -o
TEST PASSED: invalid arguments -o -p
TEST PASSED: invalid arguments -p -o terra
TEST PASSED: invalid arguments -p -o subclass -v
TEST PASSED: invalid arguments -v -d -c
All tests passed successfully!
Actions #3

Updated by Electric Monk 6 months ago

  • Status changed from New to Closed
  • % Done changed from 90 to 100

git commit 8a37ae750765321f9d9de63763676fa7280d93da

commit  8a37ae750765321f9d9de63763676fa7280d93da
Author: Robert Mustacchi <rm@fingolfin.org>
Date:   2021-03-24T18:22:58.000Z

    13630 libpcidb could know about class codes
    Reviewed by: C Fraire <cfraire@me.com>
    Reviewed by: Patrick Mooney <pmooney@pfmooney.com>
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Reviewed by: Rich Lowe <richlowe@richlowe.net>
    Approved by: Rich Lowe <richlowe@richlowe.net>

Actions

Also available in: Atom PDF