[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] golang/xenlight: add DeviceUsbdevAdd/Remove wrappers



commit f9e707aa97b204229dde5125116364c9e410ef67
Author:     Nick Rosbrook <rosbrookn@xxxxxxxxx>
AuthorDate: Sun Apr 12 18:02:42 2020 -0400
Commit:     George Dunlap <george.dunlap@xxxxxxxxxx>
CommitDate: Thu Apr 23 11:30:55 2020 +0100

    golang/xenlight: add DeviceUsbdevAdd/Remove wrappers
    
    Add DeviceUsbdevAdd and DeviceUsbdevRemove as wrappers for
    libxl_device_usbdev_add and libxl_device_usbdev_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 bc2e9de0e5..ff73c11889 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -1113,3 +1113,37 @@ func (Ctx *Context) DevicePciRemove(domid Domid, pci 
*DevicePci) error {
 
        return nil
 }
+
+// DeviceUsbdevAdd adds a USB device to a domain.
+func (Ctx *Context) DeviceUsbdevAdd(domid Domid, usbdev *DeviceUsbdev) error {
+       var cusbdev C.libxl_device_usbdev
+
+       if err := usbdev.toC(&cusbdev); err != nil {
+               return err
+       }
+       defer C.libxl_device_usbdev_dispose(&cusbdev)
+
+       ret := C.libxl_device_usbdev_add(Ctx.ctx, C.uint32_t(domid), &cusbdev, 
nil)
+       if ret != 0 {
+               return Error(ret)
+       }
+
+       return nil
+}
+
+// DeviceUsbdevRemove removes a USB device from a domain.
+func (Ctx *Context) DeviceUsbdevRemove(domid Domid, usbdev *DeviceUsbdev) 
error {
+       var cusbdev C.libxl_device_usbdev
+
+       if err := usbdev.toC(&cusbdev); err != nil {
+               return err
+       }
+       defer C.libxl_device_usbdev_dispose(&cusbdev)
+
+       ret := C.libxl_device_usbdev_remove(Ctx.ctx, C.uint32_t(domid), 
&cusbdev, nil)
+       if ret != 0 {
+               return Error(ret)
+       }
+
+       return nil
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.