[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 3/4] golang/xenlight: add DevicePciAdd/Remove wrappers
Add DevicePciAdd and DevicePciRemove as wrappers for libxl_device_pci_add and libxl_device_pci remove. Signed-off-by: Nick Rosbrook <rosbrookn@xxxxxxxxxxxx> --- tools/golang/xenlight/xenlight.go | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go index a56f913b81..c94b046667 100644 --- a/tools/golang/xenlight/xenlight.go +++ b/tools/golang/xenlight/xenlight.go @@ -1102,3 +1102,37 @@ func (Ctx *Context) DeviceNicRemove(domid Domid, nic *DeviceNic) error { return nil } + +// DevicePciAdd is used to passthrough a PCI device to a domain. +func (Ctx *Context) DevicePciAdd(domid Domid, pci *DevicePci) error { + var cpci C.libxl_device_pci + + if err := pci.toC(&cpci); err != nil { + return err + } + defer C.libxl_device_pci_dispose(&cpci) + + ret := C.libxl_device_pci_add(Ctx.ctx, C.uint32_t(domid), &cpci, nil) + if ret != 0 { + return Error(ret) + } + + return nil +} + +// DevicePciRemove removes a PCI device from a domain. +func (Ctx *Context) DevicePciRemove(domid Domid, pci *DevicePci) error { + var cpci C.libxl_device_pci + + if err := pci.toC(&cpci); err != nil { + return err + } + defer C.libxl_device_pci_dispose(&cpci) + + ret := C.libxl_device_pci_remove(Ctx.ctx, C.uint32_t(domid), &cpci, nil) + if ret != 0 { + return Error(ret) + } + + return nil +} -- 2.17.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |