-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguest_common.go
38 lines (31 loc) · 898 Bytes
/
guest_common.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
package ivshmem
import (
"errors"
"fmt"
)
var ErrCannotFindDevice = errors.New("cannot find device")
var ErrAlreadyMapped = errors.New("already mapped")
var ErrAlreadyUnmapped = errors.New("already unmapped")
var ErrNotMapped = errors.New("not mapped yet")
// PCILocation contains info about the location of the device.
type PCILocation struct {
bus uint8
device uint8
function uint8
}
// String representation of the PCI location, as in windows device manager.
func (p PCILocation) String() string {
return fmt.Sprintf("PCI bus %d, device %d, function %d", p.bus, p.device, p.function)
}
// Bus returns the PCI device bus number.
func (p PCILocation) Bus() uint8 {
return p.bus
}
// Bus returns the PCI device number.
func (p PCILocation) Device() uint8 {
return p.device
}
// Bus returns the PCI device function.
func (p PCILocation) Function() uint8 {
return p.function
}