[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] golang/xenlight: add DevicePciAdd/Remove wrappers
commit cb74bb259a0bef6411f30a240c4a1ab143aafc57 Author: Nick Rosbrook <rosbrookn@xxxxxxxxx> AuthorDate: Sun Apr 12 18:02:41 2020 -0400 Commit: George Dunlap <george.dunlap@xxxxxxxxxx> CommitDate: Thu Apr 23 11:30:54 2020 +0100 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> Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxx> --- 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 961939e947..bc2e9de0e5 100644 --- a/tools/golang/xenlight/xenlight.go +++ b/tools/golang/xenlight/xenlight.go @@ -1079,3 +1079,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 +} -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |