From: Ronald Rojas <ronladred@gmail.com>
To: xen-devel@lists.xen.org, george.dunlap@citrix.com,
ian.jackson@eu.citrix.com, wei.liu2@citrix.com
Cc: Ronald Rojas <ronladred@gmail.com>
Subject: [PATCH RFC 6/8] tools/xenlight: Implement libxl_scheduler enumeration
Date: Wed, 18 Jan 2017 14:56:44 -0500 [thread overview]
Message-ID: <1484769406-17416-6-git-send-email-ronladred@gmail.com> (raw)
In-Reply-To: <1484769406-17416-1-git-send-email-ronladred@gmail.com>
Include both constants and a Stringification for libxl_scheduler.
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Ronald Rojas <ronladred@gmail.com>
---
tools/golang/xenlight/xenlight.go | 72 +++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go
index 8aaca6a..64e867a 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -211,6 +211,78 @@ type Dominfo struct {
}
+// # 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) {
+ cstr := C.CString(gstr)
+ defer C.free(unsafe.Pointer(cstr))
+
+ var cs C.libxl_scheduler
+ ret := C.libxl_scheduler_from_string(cstr, &cs)
+ if ret != 0 {
+ err = Errorxl(ret)
+ return
+ }
+
+ *s = Scheduler(cs)
+ return
+}
+
+func translateCpupoolInfoCToGo(cci C.libxl_cpupoolinfo) (gci CpupoolInfo) {
+ gci.Poolid = uint32(cci.poolid)
+ gci.PoolName = C.GoString(cci.pool_name)
+ gci.Scheduler = Scheduler(cci.sched)
+ gci.DomainCount = int(cci.n_dom)
+ gci.Cpumap = bitmapCToGo(cci.cpumap)
+
+ 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 = Errorxl(ret)
+ return
+ }
+
+ s = Scheduler(cs)
+
+ return
+}
+
/*
* Bitmap operations
*/
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-01-18 19:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 19:56 [PATCH RFC 1/8] golang/xenlight: Create stub package Ronald Rojas
2017-01-18 19:56 ` [PATCH RFC 2/8] golang/xenlight: Add error constants and standard handling Ronald Rojas
2017-01-18 22:16 ` Dario Faggioli
2017-01-19 15:13 ` Ronald Rojas
2017-01-19 16:02 ` George Dunlap
2017-01-19 16:15 ` Wei Liu
2017-01-19 16:19 ` Dario Faggioli
2017-01-19 17:16 ` George Dunlap
2017-01-18 19:56 ` [PATCH RFC 3/8] golang/xenlight: Add host-related functionality Ronald Rojas
2017-01-19 17:51 ` George Dunlap
2017-01-18 19:56 ` [PATCH RFC 4/8] golang/xenlight: Implement libxl_domain_info and libxl_domain_unpause Ronald Rojas
2017-01-18 19:56 ` [PATCH RFC 5/8] golang/xenlight: Implement libxl_bitmap and helper operations Ronald Rojas
2017-01-18 19:56 ` Ronald Rojas [this message]
2017-01-18 19:56 ` [PATCH RFC 7/8] golang/xenlight: Implement cpupool operations Ronald Rojas
2017-01-18 19:56 ` [PATCH RFC 8/8] golang/xenlight: Add tests host related functinality functions Ronald Rojas
2017-01-18 22:10 ` [PATCH RFC 1/8] golang/xenlight: Create stub package Dario Faggioli
2017-01-18 22:37 ` Ronald Rojas
2017-01-19 12:03 ` Wei Liu
2017-01-19 15:15 ` Ronald Rojas
2017-01-19 16:16 ` George Dunlap
2017-01-19 16:40 ` George Dunlap
2017-01-19 16:45 ` George Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1484769406-17416-6-git-send-email-ronladred@gmail.com \
--to=ronladred@gmail.com \
--cc=george.dunlap@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).