Documentation
¶
Index ¶
Constants ¶
const ( PCI_PATH = "/sys/bus/pci/devices" IVSHMEM_VENDOR = "0x1af4" // Red Hat, Inc. IVSHMEM_DEVICE = "0x1110" // Inter-VM shared memory )
Variables ¶
var ErrAlreadyMapped = errors.New("already mapped")
var ErrAlreadyUnmapped = errors.New("already unmapped")
var ErrCannotFindDevice = errors.New("cannot find device")
var ErrNotMapped = errors.New("not mapped yet")
Functions ¶
This section is empty.
Types ¶
type Guest ¶
type Guest struct {
// contains filtered or unexported fields
}
Guest allows to map a shared memory region.
func NewGuest ¶
func NewGuest(location PCILocation) (*Guest, error)
NewGuest returns a new Guest based on the PCI location.
func (Guest) Location ¶
func (g Guest) Location() PCILocation
Location returns the PCI location of the device.
func (Guest) SharedMem ¶
SharedMem returns the shared memory region. Panics if the shared memory isn't mapped yet.
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host represents the host machine, it maps the shared memory.
func (Host) SharedMem ¶
SharedMem returns the already mapped shared memory, panics if Map() didn't succeed.
type PCILocation ¶
type PCILocation struct {
// contains filtered or unexported fields
}
PCILocation contains info about the location of the device.
func ListDevices ¶
func ListDevices() ([]PCILocation, error)
ListDevices lists the available ivshmem devices by their locations. The devices are identified by their vendor and device ids.
func (PCILocation) Function ¶
func (p PCILocation) Function() uint8
Bus returns the PCI device function.
func (PCILocation) String ¶
func (p PCILocation) String() string
String representation of the PCI location, as in windows device manager.