[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] golang/xenlight: Implement get console path operations
commit 8766c5cc7dfe4d2f82844bddb79bf87fecb5a383 Author: Ronald Rojas <ronladred@xxxxxxxxx> AuthorDate: Wed Apr 5 17:05:53 2017 +0100 Commit: George Dunlap <george.dunlap@xxxxxxxxxx> CommitDate: Thu Apr 6 15:34:38 2017 +0100 golang/xenlight: Implement get console path operations Implement Golang enumeration of libxl_console_type as ConsoleType Implement the following libxl functions: - libxl_console_get_tty - libxl_primary_console_get_tty Signed-off-by: Ronald Rojas <ronladred@xxxxxxxxx> Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxx> --- tools/golang/xenlight/xenlight.go | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go index a8ade4f..82aeb22 100644 --- a/tools/golang/xenlight/xenlight.go +++ b/tools/golang/xenlight/xenlight.go @@ -835,3 +835,58 @@ func (Ctx *Context) ListVcpu(id Domid) (glist []Vcpuinfo) { return } + +type ConsoleType int + +const ( + ConsoleTypeUnknown = ConsoleType(C.LIBXL_CONSOLE_TYPE_UNKNOWN) + ConsoleTypeSerial = ConsoleType(C.LIBXL_CONSOLE_TYPE_SERIAL) + ConsoleTypePV = ConsoleType(C.LIBXL_CONSOLE_TYPE_PV) +) + +func (ct ConsoleType) String() (str string) { + cstr := C.libxl_console_type_to_string(C.libxl_console_type(ct)) + str = C.GoString(cstr) + + return +} + +//int libxl_console_get_tty(libxl_ctx *ctx, uint32_t domid, int cons_num, +//libxl_console_type type, char **path); +func (Ctx *Context) ConsoleGetTty(id Domid, consNum int, conType ConsoleType) (path string, err error) { + err = Ctx.CheckOpen() + if err != nil { + return + } + + var cpath *C.char + ret := C.libxl_console_get_tty(Ctx.ctx, C.uint32_t(id), C.int(consNum), C.libxl_console_type(conType), &cpath) + if ret != 0 { + err = Error(-ret) + return + } + defer C.free(cpath) + + path = C.GoString(cpath) + return +} + +//int libxl_primary_console_get_tty(libxl_ctx *ctx, uint32_t domid_vm, +// char **path); +func (Ctx *Context) PrimaryConsoleGetTty(domid uint32) (path string, err error) { + err = Ctx.CheckOpen() + if err != nil { + return + } + + var cpath *C.char + ret := C.libxl_primary_console_get_tty(Ctx.ctx, C.uint32_t(domid), &cpath) + if ret != 0 { + err = Error(-ret) + return + } + defer C.free(cpath) + + path = C.GoString(cpath) + return +} -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |