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

[Xen-devel] [PATCH] golang/xenlight: Use the most generic pointer for xennoollog



From: Nicolas Belouin <nicolas.belouin@xxxxxxxxx>

It makes more sense for Ctx to contain the generic C.xentoollog_logger
type, rather than the specific type we end up assigning to it.  This
also allows one fewer cast.

Signed-off-by: Nicolas Belouin <nicolas.belouin@xxxxxxxxx>
Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---

Nicolas' submitted a patch fixing casts as well as making this change,
at my suggestion; but I ended up checking in an earlier patch that
fixed casts but didn't make this change.

CC: Ian Jackson <ian.jackson@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Nicolas Belouin <nicolas.belouin@xxxxxxxxx>
---
 tools/golang/xenlight/xenlight.go | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/golang/xenlight/xenlight.go 
b/tools/golang/xenlight/xenlight.go
index f5d171c2d5..a2af6f6ef9 100644
--- a/tools/golang/xenlight/xenlight.go
+++ b/tools/golang/xenlight/xenlight.go
@@ -122,7 +122,7 @@ type Uuid C.libxl_uuid
 
 type Context struct {
        ctx    *C.libxl_ctx
-       logger *C.xentoollog_logger_stdiostream
+       logger *C.xentoollog_logger
 }
 
 type Hwcap []C.uint32_t
@@ -847,14 +847,15 @@ func (Ctx *Context) Open() (err error) {
                return
        }
 
-       Ctx.logger = C.xtl_createlogger_stdiostream(C.stderr, C.XTL_ERROR, 0)
+       Ctx.logger = (*C.xentoollog_logger)(unsafe.Pointer(
+               C.xtl_createlogger_stdiostream(C.stderr, C.XTL_ERROR, 0)))
        if Ctx.logger == nil {
                err = fmt.Errorf("Cannot open stdiostream")
                return
        }
 
        ret := C.libxl_ctx_alloc(&Ctx.ctx, C.LIBXL_VERSION,
-               0, (*C.xentoollog_logger)(unsafe.Pointer(Ctx.logger)))
+               0, Ctx.logger)
 
        if ret != 0 {
                err = Error(-ret)
@@ -869,7 +870,7 @@ func (Ctx *Context) Close() (err error) {
        if ret != 0 {
                err = Error(-ret)
        }
-       C.xtl_logger_destroy((*C.xentoollog_logger)(unsafe.Pointer(Ctx.logger)))
+       C.xtl_logger_destroy(Ctx.logger)
        return
 }
 
-- 
2.20.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®.