[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RESEND PATCH 11/12] golang/xenlight: do not negate ret when converting to Error
There are several locations where the return code from calling into C is negated when being converted to Error. This results in error strings like "libxl error: <x>", rather than the correct message. Fix all occurrances of this by running: gofmt -w -r 'Error(-ret) -> Error(ret)' xenlight.go from tools/golang/xenlight. Signed-off-by: Nick Rosbrook <rosbrookn@xxxxxxxxxxxx> --- tools/golang/xenlight/xenlight.go | 46 +++++++++++++++---------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go index d153feb851..6fb22665cc 100644 --- a/tools/golang/xenlight/xenlight.go +++ b/tools/golang/xenlight/xenlight.go @@ -668,7 +668,7 @@ func SchedulerFromString(name string) (s Scheduler, err error) { ret := C.libxl_scheduler_from_string(cname, &cs) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } @@ -707,7 +707,7 @@ func (ctx *Context) CpupoolInfo(Poolid uint32) (pool Cpupoolinfo, err error) { ret := C.libxl_cpupool_info(ctx.ctx, &c_cpupool, C.uint32_t(Poolid)) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } defer C.libxl_cpupoolinfo_dispose(&c_cpupool) @@ -741,7 +741,7 @@ func (ctx *Context) CpupoolCreate(Name string, Scheduler Scheduler, Cpumap Bitma ret := C.libxl_cpupool_create(ctx.ctx, name, C.libxl_scheduler(Scheduler), cbm, &uuid, &poolid) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } @@ -754,7 +754,7 @@ func (ctx *Context) CpupoolCreate(Name string, Scheduler Scheduler, Cpumap Bitma func (ctx *Context) CpupoolDestroy(Poolid uint32) (err error) { ret := C.libxl_cpupool_destroy(ctx.ctx, C.uint32_t(Poolid)) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } @@ -765,7 +765,7 @@ func (ctx *Context) CpupoolDestroy(Poolid uint32) (err error) { func (ctx *Context) CpupoolCpuadd(Poolid uint32, Cpu int) (err error) { ret := C.libxl_cpupool_cpuadd(ctx.ctx, C.uint32_t(Poolid), C.int(Cpu)) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } @@ -783,7 +783,7 @@ func (ctx *Context) CpupoolCpuaddCpumap(Poolid uint32, Cpumap Bitmap) (err error ret := C.libxl_cpupool_cpuadd_cpumap(ctx.ctx, C.uint32_t(Poolid), &cbm) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } @@ -794,7 +794,7 @@ func (ctx *Context) CpupoolCpuaddCpumap(Poolid uint32, Cpumap Bitmap) (err error func (ctx *Context) CpupoolCpuremove(Poolid uint32, Cpu int) (err error) { ret := C.libxl_cpupool_cpuremove(ctx.ctx, C.uint32_t(Poolid), C.int(Cpu)) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } @@ -812,7 +812,7 @@ func (ctx *Context) CpupoolCpuremoveCpumap(Poolid uint32, Cpumap Bitmap) (err er ret := C.libxl_cpupool_cpuremove_cpumap(ctx.ctx, C.uint32_t(Poolid), &cbm) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } @@ -826,7 +826,7 @@ func (ctx *Context) CpupoolRename(Name string, Poolid uint32) (err error) { ret := C.libxl_cpupool_rename(ctx.ctx, name, C.uint32_t(Poolid)) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } @@ -839,7 +839,7 @@ func (ctx *Context) CpupoolCpuaddNode(Poolid uint32, Node int) (Cpus int, err er ret := C.libxl_cpupool_cpuadd_node(ctx.ctx, C.uint32_t(Poolid), C.int(Node), &ccpus) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } @@ -854,7 +854,7 @@ func (ctx *Context) CpupoolCpuremoveNode(Poolid uint32, Node int) (Cpus int, err ret := C.libxl_cpupool_cpuremove_node(ctx.ctx, C.uint32_t(Poolid), C.int(Node), &ccpus) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } @@ -867,7 +867,7 @@ func (ctx *Context) CpupoolCpuremoveNode(Poolid uint32, Node int) (Cpus int, err func (ctx *Context) CpupoolMovedomain(Poolid uint32, Id Domid) (err error) { ret := C.libxl_cpupool_movedomain(ctx.ctx, C.uint32_t(Poolid), C.uint32_t(Id)) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } @@ -1028,7 +1028,7 @@ func (bm Bitmap) String() (s string) { func (ctx *Context) GetMaxCpus() (maxCpus int, err error) { ret := C.libxl_get_max_cpus(ctx.ctx) if ret < 0 { - err = Error(-ret) + err = Error(ret) return } maxCpus = int(ret) @@ -1039,7 +1039,7 @@ func (ctx *Context) GetMaxCpus() (maxCpus int, err error) { func (ctx *Context) GetOnlineCpus() (onCpus int, err error) { ret := C.libxl_get_online_cpus(ctx.ctx) if ret < 0 { - err = Error(-ret) + err = Error(ret) return } onCpus = int(ret) @@ -1050,7 +1050,7 @@ func (ctx *Context) GetOnlineCpus() (onCpus int, err error) { func (ctx *Context) GetMaxNodes() (maxNodes int, err error) { ret := C.libxl_get_max_nodes(ctx.ctx) if ret < 0 { - err = Error(-ret) + err = Error(ret) return } maxNodes = int(ret) @@ -1063,7 +1063,7 @@ func (ctx *Context) GetFreeMemory() (memkb uint64, err error) { ret := C.libxl_get_free_memory(ctx.ctx, &cmem) if ret < 0 { - err = Error(-ret) + err = Error(ret) return } @@ -1108,7 +1108,7 @@ func (ctx *Context) DomainInfo(Id Domid) (di *Dominfo, err error) { ret := C.libxl_domain_info(ctx.ctx, &cdi, C.uint32_t(Id)) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } @@ -1121,7 +1121,7 @@ func (ctx *Context) DomainUnpause(Id Domid) (err error) { ret := C.libxl_domain_unpause(ctx.ctx, C.uint32_t(Id), nil) if ret != 0 { - err = Error(-ret) + err = Error(ret) } return } @@ -1131,7 +1131,7 @@ func (ctx *Context) DomainPause(id Domid) (err error) { ret := C.libxl_domain_pause(ctx.ctx, C.uint32_t(id), nil) if ret != 0 { - err = Error(-ret) + err = Error(ret) } return } @@ -1141,7 +1141,7 @@ func (ctx *Context) DomainShutdown(id Domid) (err error) { ret := C.libxl_domain_shutdown(ctx.ctx, C.uint32_t(id), nil) if ret != 0 { - err = Error(-ret) + err = Error(ret) } return } @@ -1151,7 +1151,7 @@ func (ctx *Context) DomainReboot(id Domid) (err error) { ret := C.libxl_domain_reboot(ctx.ctx, C.uint32_t(id), nil) if ret != 0 { - err = Error(-ret) + err = Error(ret) } return } @@ -1214,7 +1214,7 @@ func (ctx *Context) ConsoleGetTty(id Domid, consNum int, conType ConsoleType) (p 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) + err = Error(ret) return } defer C.free(unsafe.Pointer(cpath)) @@ -1229,7 +1229,7 @@ func (ctx *Context) PrimaryConsoleGetTty(domid uint32) (path string, err error) var cpath *C.char ret := C.libxl_primary_console_get_tty(ctx.ctx, C.uint32_t(domid), &cpath) if ret != 0 { - err = Error(-ret) + err = Error(ret) return } defer C.free(unsafe.Pointer(cpath)) -- 2.17.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |