All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Nick Rosbrook <rosbrookn@gmail.com>, <xen-devel@lists.xenproject.org>
Cc: Nick Rosbrook <rosbrookn@ainfosec.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	kerriganb@ainfosec.com, Wei Liu <wl@xen.org>
Subject: Re: [Xen-devel] [PATCH v3 21/22] golang/xenlight: revise use of Context type
Date: Tue, 17 Dec 2019 17:28:05 +0000	[thread overview]
Message-ID: <5b92c6b7-e515-0eae-8722-de91cfade9b7@citrix.com> (raw)
In-Reply-To: <8330ea427861ef6c5d3b20d381bf40e87937d448.1575990937.git.rosbrookn@ainfosec.com>

On 12/10/19 3:47 PM, Nick Rosbrook wrote:
> From: Nick Rosbrook <rosbrookn@ainfosec.com>
> 
> Remove the exported global context variable, 'Ctx.' Generally, it is
> better to not export global variables for use through a Go package.
> However, there are some exceptions that can be found in the standard
> library.
> 
> Add a NewContext function instead, and remove the Open, IsOpen, and
> CheckOpen functions as a result.
> 
> Also, comment-out an ineffectual assignment to 'err' inside the function
> Context.CpupoolInfo so that compilation does not fail.
> 
> Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>

Reviewed-by: George Dunlap <george.dunlap@citrix.com>

With one requested change...

> ---
>  tools/golang/xenlight/xenlight.go | 219 +++++-------------------------
>  1 file changed, 34 insertions(+), 185 deletions(-)
> 
> diff --git a/tools/golang/xenlight/xenlight.go b/tools/golang/xenlight/xenlight.go
> index f32eb11384..1c431fa4e5 100644
> --- a/tools/golang/xenlight/xenlight.go
> +++ b/tools/golang/xenlight/xenlight.go
> @@ -74,6 +74,39 @@ func (e Error) Error() string {
>  	return fmt.Sprintf("libxl error: %d", -e)
>  }
>  
> +// Context represents a libxl_ctx.
> +type Context struct {
> +	ctx    *C.libxl_ctx
> +	logger *C.xentoollog_logger_stdiostream
> +}
> +
> +// NewContext returns a new Context.
> +func NewContext() (*Context, error) {
> +	var ctx Context
> +
> +	ctx.logger = C.xtl_createlogger_stdiostream(C.stderr, C.XTL_ERROR, 0)
> +
> +	ret := C.libxl_ctx_alloc(&ctx.ctx, C.LIBXL_VERSION, 0, (*C.xentoollog_logger)(unsafe.Pointer(ctx.logger)))

This line looks to be 114 characters long, which seems a bit much. :-)
Mind breaking it just before the last argument?

Thanks,
 -George

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

  reply	other threads:[~2019-12-17 17:28 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 15:47 [Xen-devel] [PATCH v3 00/22] generated Go libxl bindings using IDL Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 01/22] golang/xenlight: generate enum types from IDL Nick Rosbrook
2019-12-16 17:07   ` George Dunlap
2019-12-16 17:50     ` Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 02/22] golang/xenlight: define Defbool builtin type Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 03/22] golang/xenlight: define Devid type as int Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 04/22] golang/xenlight: define KeyValueList as empty struct Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 05/22] golang/xenlight: re-name Bitmap marshaling functions Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 06/22] golang/xenlight: define StringList builtin type Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 07/22] golang/xenlight: define Mac " Nick Rosbrook
2019-12-16 17:15   ` George Dunlap
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 08/22] golang/xenlight: define MsVmGenid " Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 09/22] golang/xenlight: define EvLink builtin as empty struct Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 10/22] golang/xenlight: define CpuidPolicyList builtin type Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 11/22] golang/xenlight: re-factor Uuid type implementation Nick Rosbrook
2019-12-16 18:06   ` George Dunlap
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 12/22] golang/xenlight: re-factor Hwcap " Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 13/22] golang/xenlight: generate structs from the IDL Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 14/22] golang/xenlight: remove no-longer used type MemKB Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 15/22] golang/xenlight: begin C to Go type marshaling Nick Rosbrook
2019-12-16 17:56   ` George Dunlap
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 16/22] golang/xenlight: implement keyed union C to Go marshaling Nick Rosbrook
2019-12-16 17:57   ` George Dunlap
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 17/22] golang/xenlight: implement array " Nick Rosbrook
2019-12-17 11:16   ` George Dunlap
2019-12-17 14:51     ` Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 18/22] golang/xenlight: begin Go to C type marshaling Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 19/22] golang/xenlight: implement keyed union Go to C marshaling Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 20/22] golang/xenlight: implement array " Nick Rosbrook
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 21/22] golang/xenlight: revise use of Context type Nick Rosbrook
2019-12-17 17:28   ` George Dunlap [this message]
2019-12-10 15:47 ` [Xen-devel] [PATCH v3 22/22] golang/xenlight: add error return type to Context.Cpupoolinfo Nick Rosbrook
2019-12-17 17:29   ` 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=5b92c6b7-e515-0eae-8722-de91cfade9b7@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=kerriganb@ainfosec.com \
    --cc=rosbrookn@ainfosec.com \
    --cc=rosbrookn@gmail.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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.