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

[Xen-devel] [PATCH 11/24] golang/xenlight: define CpuidPolicyList builtin type



From: Nick Rosbrook <rosbrookn@xxxxxxxxxxxx>

Define CpuidPolicyList as a wrapper struct with field val of type
*C.libxl_cpuid_policy_list and implement fromC and toC functions.

Signed-off-by: Nick Rosbrook <rosbrookn@xxxxxxxxxxxx>
---
Cc: George Dunlap <george.dunlap@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Wei Liu <wl@xxxxxxx>

 tools/golang/xenlight/xenlight.go | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tools/golang/xenlight/xenlight.go 
b/tools/golang/xenlight/xenlight.go
index d41de253f3..9c384485e1 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -249,6 +249,26 @@ type EvLink struct{}
 func (el *EvLink) fromC(cel *C.libxl_ev_link) error      { return nil }
 func (el *EvLink) toC() (cel C.libxl_ev_link, err error) { return }
 
+// CpuidPolicyList represents a libxl_cpuid_policy_list.
+type CpuidPolicyList struct {
+       val *C.libxl_cpuid_policy_list
+}
+
+func (cpl *CpuidPolicyList) fromC(ccpl *C.libxl_cpuid_policy_list) error {
+       cpl.val = ccpl
+       return nil
+}
+
+func (cpl *CpuidPolicyList) toC() (C.libxl_cpuid_policy_list, error) {
+       if cpl.val == nil {
+               var c C.libxl_cpuid_policy_list
+               return c, nil
+       }
+       ccpl := (*C.libxl_cpuid_policy_list)(unsafe.Pointer(cpl.val))
+
+       return *ccpl, nil
+}
+
 type Context struct {
        ctx    *C.libxl_ctx
        logger *C.xentoollog_logger_stdiostream
-- 
2.19.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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