pci

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 14 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddressFromString = pciaddr.FromString

backward compatibility, to be removed in 1.0.0

Functions

This section is empty.

Types

type Address

type Address pciaddr.Address

backward compatibility, to be removed in 1.0.0

type Device

type Device struct {
	// The PCI address of the device
	Address   string         `json:"address"`
	Vendor    *pcidb.Vendor  `json:"vendor"`
	Product   *pcidb.Product `json:"product"`
	Revision  string         `json:"revision"`
	Subsystem *pcidb.Product `json:"subsystem"`
	// optional subvendor/sub-device information
	Class *pcidb.Class `json:"class"`
	// optional sub-class for the device
	Subclass *pcidb.Subclass `json:"subclass"`
	// optional programming interface
	ProgrammingInterface *pcidb.ProgrammingInterface `json:"programming_interface"`
	// Topology node that the PCI device is affined to. Will be nil if the
	// architecture is not NUMA.
	Node   *topology.Node `json:"node,omitempty"`
	Driver string         `json:"driver"`
}

func (*Device) MarshalJSON

func (d *Device) MarshalJSON() ([]byte, error)

NOTE(jaypipes) Device has a custom JSON marshaller because we don't want to serialize the entire PCIDB information for the Vendor (which includes all of the vendor's products, etc). Instead, we simply serialize the ID and human-readable name of the vendor, product, class, etc.

func (*Device) String

func (d *Device) String() string

type Info

type Info struct {

	// All PCI devices on the host system
	Devices []*Device
	// hash of class ID -> class information
	// DEPRECATED. Will be removed in v1.0. Please use
	// github.com/jaypipes/pcidb to explore PCIDB information
	Classes map[string]*pcidb.Class `json:"-"`
	// hash of vendor ID -> vendor information
	// DEPRECATED. Will be removed in v1.0. Please use
	// github.com/jaypipes/pcidb to explore PCIDB information
	Vendors map[string]*pcidb.Vendor `json:"-"`
	// hash of vendor ID + product/device ID -> product information
	// DEPRECATED. Will be removed in v1.0. Please use
	// github.com/jaypipes/pcidb to explore PCIDB information
	Products map[string]*pcidb.Product `json:"-"`
	// contains filtered or unexported fields
}

func New

func New(opts ...*option.Option) (*Info, error)

New returns a pointer to an Info struct that contains information about the PCI devices on the host system

func (*Info) GetDevice

func (info *Info) GetDevice(address string) *Device

GetDevice returns a pointer to a Device struct that describes the PCI device at the requested address. If no such device could be found, returns nil.

func (*Info) JSONString

func (i *Info) JSONString(indent bool) string

JSONString returns a string with the PCI information formatted as JSON under a top-level "pci:" key

func (*Info) ListDevices

func (info *Info) ListDevices() []*Device

ListDevices returns a list of pointers to Device structs present on the host system DEPRECATED. Will be removed in v1.0. Please use github.com/jaypipes/pcidb to explore PCIDB information

func (*Info) ParseDevice

func (info *Info) ParseDevice(address, modalias string) *Device

ParseDevice returns a pointer to a Device given its describing data. The PCI device obtained this way may not exist in the system; use GetDevice to get a *Device which is found in the system

func (*Info) String

func (i *Info) String() string

func (*Info) YAMLString

func (i *Info) YAMLString() string

YAMLString returns a string with the PCI information formatted as YAML under a top-level "pci:" key

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL