All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Ronald Rojas <ronladred@gmail.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v4 11/14] golang/xenlight: Implement get console path operations
Date: Wed, 5 Apr 2017 12:04:12 +0100	[thread overview]
Message-ID: <CAFLBxZaosci=Yg8Emc1eNkXa4L9Ldx9=Zs7ozUr6=kZdamG80Q@mail.gmail.com> (raw)
In-Reply-To: <1489691330-17695-11-git-send-email-ronladred@gmail.com>

On Thu, Mar 16, 2017 at 7:08 PM, Ronald Rojas <ronladred@gmail.com> wrote:
> 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@gmail.com>
> ---
> CC: xen-devel@lists.xen.org
> CC: george.dunlap@citrix.com
> CC: ian.jackson@eu.citrix.com
> CC: wei.liu2@citrix.com
> ---
> ---
>  tools/golang/xenlight/xenlight.go | 57 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 57 insertions(+)
>
> diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go
> index 61d7f8f..d520f74 100644
> --- a/tools/golang/xenlight/xenlight.go
> +++ b/tools/golang/xenlight/xenlight.go
> @@ -1080,3 +1080,60 @@ 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
> +       defer C.free(cpath)
> +       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
> +       }

You can't call `defer C.free()` until you're certain that cpath will
contain a non-NULL pointer (here and in PrimaryConsole...)

Everything else looks fine.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-04-05 11:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16 19:08 [PATCH v4 01/14] golang/xenlight: Create stub package Ronald Rojas
2017-03-16 19:08 ` [PATCH v4 02/14] golang/xenlight: Add error constants and standard handling Ronald Rojas
2017-03-20 15:41   ` George Dunlap
2017-03-16 19:08 ` [PATCH v4 03/14] golang/xenlight: Add host-related functionality Ronald Rojas
2017-03-20 15:50   ` George Dunlap
2017-03-16 19:08 ` [PATCH v4 04/14] golang/xenlight: Implement libxl_domain_info and libxl_domain_unpause Ronald Rojas
2017-03-20 15:57   ` George Dunlap
2017-03-16 19:08 ` [PATCH v4 05/14] golang/xenlight: Add tests host related functionality functions Ronald Rojas
2017-03-20 17:49   ` George Dunlap
2017-03-20 18:15     ` Ian Jackson
2017-04-04 16:44       ` George Dunlap
2017-03-16 19:08 ` [PATCH v4 06/14] golang/xenlight: Implement libxl_bitmap and helper operations Ronald Rojas
2017-03-16 19:08 ` [PATCH v4 08/14] golang/xenlight: Implement cpupool operations Ronald Rojas
2017-03-16 19:08 ` [PATCH v4 09/14] golang/xenlight: Implement Domain operations Ronald Rojas
2017-04-05 10:23   ` George Dunlap
2017-03-16 19:08 ` [PATCH v4 10/14] golang/xenlight: Implement Vcpuinfo and ListVcpu Ronald Rojas
2017-03-16 19:08 ` [PATCH v4 11/14] golang/xenlight: Implement get console path operations Ronald Rojas
2017-04-05 11:04   ` George Dunlap [this message]
2017-03-16 19:08 ` [PATCH v4 12/14] golang/xenlight: Created boilerplate code for device related structs Ronald Rojas
2017-04-05 11:13   ` George Dunlap
2017-03-16 19:08 ` [PATCH v4 13/14] golang/xenlight: Implement ActionOnShutdown and DomainConfig Ronald Rojas
2017-03-16 19:08 ` [PATCH v4 14/14] golang/xenlight: Implement domain create/destroy operations Ronald Rojas
2017-03-20 14:45 ` [PATCH v4 01/14] golang/xenlight: Create stub package George Dunlap
2017-03-23 15:36   ` Ronald Rojas
2017-03-20 17:51 ` George Dunlap
2017-03-23 15:37   ` Ronald Rojas

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='CAFLBxZaosci=Yg8Emc1eNkXa4L9Ldx9=Zs7ozUr6=kZdamG80Q@mail.gmail.com' \
    --to=george.dunlap@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=ronladred@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.