-
Notifications
You must be signed in to change notification settings - Fork 17
/
pcidb.go
41 lines (36 loc) · 1.19 KB
/
pcidb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// Use and distribution licensed under the Apache license version 2.
//
// See the COPYING file in the root project directory for full text.
//
package pcidb
import (
"github.com/jaypipes/pcidb/internal"
"github.com/jaypipes/pcidb/types"
)
type DB = types.DB
type Product = types.Product
type Vendor = types.Vendor
type Class = types.Class
type Subclass = types.Subclass
type ProgrammingInterface = types.ProgrammingInterface
type WithOption = types.WithOption
// Backward-compat, please refer to the pcidb types.DB type definition
type PCIDB = types.DB
// New returns a pointer to a pcidb.DB struct which contains information you can
// use to query PCI vendor, product and class information.
//
// It accepts zero or more pointers to WithOption structs. If you want to
// modify the behaviour of pcidb, use one of the option modifiers when calling
// New.
//
// For example, to change the root directory that pcidb uses when discovering
// pciids DB files, call New(WithChroot("/my/root/override"))
func New(opts ...*types.WithOption) (*types.DB, error) {
merged := internal.MergeOptions(opts...)
f, err := internal.Discover(merged)
if err != nil {
return nil, err
}
return internal.FromReader(f), nil
}