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

[Xen-changelog] [xen master] golang/xenlight: Implement libxl_scheduler enumeration



commit fae494e6e48cdf7bdcec9962c9a08473cfdd6804
Author:     Ronald Rojas <ronladred@xxxxxxxxx>
AuthorDate: Wed Apr 5 17:05:50 2017 +0100
Commit:     George Dunlap <george.dunlap@xxxxxxxxxx>
CommitDate: Thu Apr 6 15:34:22 2017 +0100

    golang/xenlight: Implement libxl_scheduler enumeration
    
    Include both constants and a Stringification for libxl_scheduler.
    
    Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
    Signed-off-by: Ronald Rojas <ronladred@xxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxx>
---
 tools/golang/xenlight/xenlight.go | 52 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/tools/golang/xenlight/xenlight.go 
b/tools/golang/xenlight/xenlight.go
index 67eee63..86253c5 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -323,6 +323,58 @@ func (cdi *C.libxl_dominfo) toGo() (di *Dominfo) {
        return
 }
 
+// # Consistent with values defined in domctl.h
+// # Except unknown which we have made up
+// libxl_scheduler = Enumeration("scheduler", [
+//     (0, "unknown"),
+//     (4, "sedf"),
+//     (5, "credit"),
+//     (6, "credit2"),
+//     (7, "arinc653"),
+//     (8, "rtds"),
+//     ])
+type Scheduler int
+
+var (
+       SchedulerUnknown  Scheduler = C.LIBXL_SCHEDULER_UNKNOWN
+       SchedulerSedf     Scheduler = C.LIBXL_SCHEDULER_SEDF
+       SchedulerCredit   Scheduler = C.LIBXL_SCHEDULER_CREDIT
+       SchedulerCredit2  Scheduler = C.LIBXL_SCHEDULER_CREDIT2
+       SchedulerArinc653 Scheduler = C.LIBXL_SCHEDULER_ARINC653
+       SchedulerRTDS     Scheduler = C.LIBXL_SCHEDULER_RTDS
+)
+
+// const char *libxl_scheduler_to_string(libxl_scheduler p);
+func (s Scheduler) String() string {
+       cs := C.libxl_scheduler_to_string(C.libxl_scheduler(s))
+       // No need to free const return value
+
+       return C.GoString(cs)
+}
+
+// int libxl_scheduler_from_string(const char *s, libxl_scheduler *e);
+func (s *Scheduler) FromString(gstr string) (err error) {
+       *s, err = SchedulerFromString(gstr)
+       return
+}
+
+func SchedulerFromString(name string) (s Scheduler, err error) {
+       cname := C.CString(name)
+       defer C.free(unsafe.Pointer(cname))
+
+       var cs C.libxl_scheduler
+
+       ret := C.libxl_scheduler_from_string(cname, &cs)
+       if ret != 0 {
+               err = Error(-ret)
+               return
+       }
+
+       s = Scheduler(cs)
+
+       return
+}
+
 /*
  * Bitmap operations
  */
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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