> Yes, let's do that.
Okay, will do.
As a point of clarification, should I be waiting until you've reviewed
all patches in v1 before I send v2 of this series? Or do you prefer
that I send a v2 that addresses your review so far?
Thanks,
-NR
___
Xen-dev
> On the whole I think sending v2 earlier is better, since I'll have the
> discussions more recently in my head, and so will (hopefully) be able to
> get an Ack or R-b more quickly.
>
> When the development window is open, stuff can be checked in as it's
> reviewed, making the whole thing easier.
>
From: Nick Rosbrook
After Xen summit, we started the discussion in this[1] RFC thread
to figure out how to generate Go bindings for libxl. This series
implements that Go code generation using the existing IDL, and updates
the existing hand-written code in xenlight.go to use the generated
code
From: Nick Rosbrook
Define CpuidPolicyList as a string so that libxl_cpuid_parse_config can
be used in the toC function.
For now, fromC is a no-op since libxl does not support a way to read a
policy, modify it,and then give it back to libxl.
Signed-off-by: Nick Rosbrook
---
Changes in v2
From: Nick Rosbrook
Re-name and modify signature of toGo function to fromC. The reason for
using 'fromC' rather than 'toGo' is that it is not a good idea to define
methods on the C types. Also, add error return type to Bitmap's toC function.
Finally, as code-cleanu
From: Nick Rosbrook
Signed-off-by: Nick Rosbrook
Reviewed-by: George Dunlap
---
tools/golang/xenlight/xenlight.go | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/golang/xenlight/xenlight.go
b/tools/golang/xenlight/xenlight.go
index 640d82f35f..8ac26e63f0 100644
--- a/tools
From: Nick Rosbrook
Define MsVmGenid as [int(C.LIBXL_MS_VM_GENID_LEN)]byte and implement fromC and
toC functions.
Signed-off-by: Nick Rosbrook
Reviewed-by: George Dunlap
---
tools/golang/xenlight/xenlight.go | 23 +++
1 file changed, 23 insertions(+)
diff --git a/tools
From: Nick Rosbrook
Re-define Uuid as [16]byte and implement fromC, toC, and String functions.
Signed-off-by: Nick Rosbrook
---
tools/golang/xenlight/xenlight.go | 37 +--
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/tools/golang/xenlight
From: Nick Rosbrook
Define StringList as []string an implement fromC and toC functions.
Signed-off-by: Nick Rosbrook
---
Changes in v2:
- Define fromC with a pointer receiver since a newly-allocated slice
is being assigned to the StringList.
tools/golang/xenlight/xenlight.go | 29
From: Nick Rosbrook
Signed-off-by: Nick Rosbrook
Acked-by: George Dunlap
---
tools/golang/xenlight/xenlight.go | 2 --
1 file changed, 2 deletions(-)
diff --git a/tools/golang/xenlight/xenlight.go
b/tools/golang/xenlight/xenlight.go
index c2764af277..9420197bfb 100644
--- a/tools/golang
From: Nick Rosbrook
Add struct and keyed union generation to gengotypes.py. For keyed unions,
use a method similar to gRPC's oneof to interpret C unions as Go types.
Meaning, for a given struct with a union field, generate a struct for
each sub-struct defined in the union. Then, defi
From: Nick Rosbrook
Define Mac as [6]byte and implement fromC, toC, and String functions.
Signed-off-by: Nick Rosbrook
---
Changes in v2:
- Fix the format string in String function to use %02x.
- Use a value reciever for the toC function.
tools/golang/xenlight/xenlight.go | 35
From: Nick Rosbrook
Define KeyValueList as empty struct as there is currently no reason for
this type to be available in the Go package.
Implement fromC and toC functions as no-ops.
Signed-off-by: Nick Rosbrook
---
Changes in v2:
- Re-define KeyValueList as empty struct, as it was decided
From: Nick Rosbrook
Define Defbool as struct analagous to the C type, and define the type
'defboolVal' that represent true, false, and default defbool values.
Implement Set, Unset, SetIfDefault, IsDefault, Val, and String functions
on Defbool so that the type can be used in Go anal
From: Nick Rosbrook
Re-define Hwcap as [8]uint32, and implement toC function. Also, re-name and
modify signature of toGo function to fromC.
Signed-off-by: Nick Rosbrook
Reviewed-by: George Dunlap
---
Changes in v2:
- Fix comment in fromC since an array is being used now, not a slice.
- Use a
From: Nick Rosbrook
Introduce gengotypes.py to generate Go code the from IDL. As a first step,
implement 'enum' type generation.
As a result of the newly-generated code, remove the existing, and now
conflicting definitions in xenlight.go. In the case of the Error type,
rename the sli
From: Nick Rosbrook
Define EvLink as empty struct as there is currently no reason the internal of
this type should be used in Go.
Implement fromC and toC functions as no-ops.
Signed-off-by: Nick Rosbrook
Reviewed-by: George Dunlap
---
tools/golang/xenlight/xenlight.go | 10 ++
1
From: Nick Rosbrook
A previous commit that removed Context.CheckOpen revealed
an ineffectual assignent to err in Context.Cpupoolinfo, as
there is no error return type.
Since it appears that the intent is to return an error here,
add an error return value to the function signature.
Signed-off
From: Nick Rosbrook
Signed-off-by: Nick Rosbrook
---
tools/golang/xenlight/gengotypes.py | 39 +++-
tools/golang/xenlight/helpers.gen.go | 300 +++
2 files changed, 338 insertions(+), 1 deletion(-)
diff --git a/tools/golang/xenlight/gengotypes.py
b/tools/golang
From: Nick Rosbrook
Switch over union key to determine how to populate 'union' in Go struct.
Since the unions of C types cannot be directly accessed, add C structs in
cgo preamble to assist in marshaling keyed unions. This allows the C
type defined in the preamble to be populated
From: Nick Rosbrook
Implement conversion of basic type conversions such as strings
and integer types in toC functions.
Signed-off-by: Nick Rosbrook
---
tools/golang/xenlight/gengotypes.py | 80 ++
tools/golang/xenlight/helpers.gen.go | 1015 ++
2 files changed, 1095
From: Nick Rosbrook
Since the C union cannot be directly populated, populate the fields of the
corresponding C struct defined in the cgo preamble, and then copy that
struct as bytes into the byte slice that Go uses as the union.
Signed-off-by: Nick Rosbrook
---
tools/golang/xenlight
From: Nick Rosbrook
Implement basic type conversion in fromC functions such as strings and
integer types. Also, remove existing toGo functions from xenlight.go in
favor of the new generated functions.
Signed-off-by: Nick Rosbrook
---
Changes in v2:
- Add Makefile changes for helpers.gen.go
From: Nick Rosbrook
Signed-off-by: Nick Rosbrook
---
tools/golang/xenlight/gengotypes.py | 44 +++-
tools/golang/xenlight/helpers.gen.go | 359 +++
2 files changed, 402 insertions(+), 1 deletion(-)
diff --git a/tools/golang/xenlight/gengotypes.py
b/tools/golang
From: Nick Rosbrook
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 remov
> I implemented some tests for these methods to make sure everything
> worked as expected (they did); but there's an unexpected side-effect:
>
> - *_test.go files cannot `import "C"`
Yeah, this is unfortunate.
> - The fromC / toC methods aren't exported
>
> So it's not possible to do the followi
> Same thing with casting.
Ack for all such cases of this casting. That's a good way to simplify.
-NR
___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
> You should probably say here explicitly what kinds of elements you're
> supporting and not supporting in this patch; specifically:
>
> - You're converting built-ins (or is this any struct-like type?)
Any struct-like type, since the fromC functions are all defined in
this patch (excluding array f
> > It looks like this is duplicating (differently!) the field-copying code
> > from golang_define_from_C. Is there any reason you couldn't have a
> > single function, `xenlight_golang_fields_from_C`, which would be used
> > for both?
No, I should be able to re-factor that. Thanks.
> Actually, i
> Sorry to come back to this... I think this would be better explicitly
> listing out the files that are needed. As I said, the current way of
> doing things means gengotypes.py will *always* be re-run; and the
> result, when experimenting with the `typeof` before, was that my local
> changes to h
> So first of all, I noticed that the marshalling code for Union structs
> does what I suggest. :-)
Yeah I realized that. I must have figured out that my previous way
wasn't necessary, but forgot to go back and change it.
> I'm not super-strong on this, so I don't want to bike-shed. But I think
> It actually occurs to me that the "named struct elements of union" would
> still technically open up a window for divergence: i.e., if somehow the
> type of the named struct didn't match up with the union element.
>
> I.e., the following *shouldn't* happen, but technically it *could*:
>
>
>
> OK. FYI I'm going to have to stop reviewing here for a bit; if you
> re-send the series with the comments on 1-16 addressed though, I'll skim
> through and check it in if it looks good.
Okay, thanks for the heads up. I'm hoping to send v3 in the next few days.
-NR
From: Nick Rosbrook
After Xen summit, we started the discussion in this[1] RFC thread
to figure out how to generate Go bindings for libxl. This series
implements that Go code generation using the existing IDL, and updates
the existing hand-written code in xenlight.go to use the generated
code
From: Nick Rosbrook
Define Defbool as struct analagous to the C type, and define the type
'defboolVal' that represent true, false, and default defbool values.
Implement Set, Unset, SetIfDefault, IsDefault, Val, and String functions
on Defbool so that the type can be used in Go anal
From: Nick Rosbrook
Define KeyValueList as empty struct as there is currently no reason for
this type to be available in the Go package.
Implement fromC and toC functions as no-ops.
Signed-off-by: Nick Rosbrook
Reviewed-by: George Dunlap
---
Changes in v2:
- Re-define KeyValueList as empty
From: Nick Rosbrook
Define Mac as [6]byte and implement fromC, toC, and String functions.
Signed-off-by: Nick Rosbrook
Reviewed-by: George Dunlap
---
Changes in v2:
- Fix the format string in String function to use %02x.
- Use a value reciever for the toC function.
Changes in v3:
- Iterate
From: Nick Rosbrook
Define MsVmGenid as [int(C.LIBXL_MS_VM_GENID_LEN)]byte and implement fromC and
toC functions.
Signed-off-by: Nick Rosbrook
Reviewed-by: George Dunlap
---
Changes in v3:
- In fromC, iterate over the indirect of mvg instead of creating
a slice from the C type.
---
tools
From: Nick Rosbrook
Signed-off-by: Nick Rosbrook
Reviewed-by: George Dunlap
---
tools/golang/xenlight/xenlight.go | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/golang/xenlight/xenlight.go
b/tools/golang/xenlight/xenlight.go
index 640d82f35f..8ac26e63f0 100644
--- a/tools
From: Nick Rosbrook
Introduce gengotypes.py to generate Go code the from IDL. As a first step,
implement 'enum' type generation.
As a result of the newly-generated code, remove the existing, and now
conflicting definitions in xenlight.go. In the case of the Error type,
rename the sli
From: Nick Rosbrook
Define CpuidPolicyList as a string so that libxl_cpuid_parse_config can
be used in the toC function.
For now, fromC is a no-op since libxl does not support a way to read a
policy, modify it,and then give it back to libxl.
Signed-off-by: Nick Rosbrook
Reviewed-by: George
From: Nick Rosbrook
Define EvLink as empty struct as there is currently no reason the internal of
this type should be used in Go.
Implement fromC and toC functions as no-ops.
Signed-off-by: Nick Rosbrook
Reviewed-by: George Dunlap
---
tools/golang/xenlight/xenlight.go | 10 ++
1
From: Nick Rosbrook
Re-name and modify signature of toGo function to fromC. The reason for
using 'fromC' rather than 'toGo' is that it is not a good idea to define
methods on the C types. Also, add error return type to Bitmap's toC function.
Finally, as code-cleanu
From: Nick Rosbrook
Re-define Uuid as [16]byte and implement fromC, toC, and String functions.
Signed-off-by: Nick Rosbrook
---
Changes in v3:
- In fromC, iterate over the indirect of u instead of creating a
slice from the C type.
---
tools/golang/xenlight/xenlight.go | 35
From: Nick Rosbrook
Switch over union key to determine how to populate 'union' in Go struct.
Since the unions of C types cannot be directly accessed in cgo, use a
typeof trick to typedef a struct in the cgo preamble that is analagous
to each inner struct of a keyed union. For example,
From: Nick Rosbrook
Begin implementation of fromC marshaling functions for generated struct
types. This includes support for converting fields that are basic
primitive types such as string and integer types, nested anonymous
structs, nested libxl structs, and libxl built-in types.
This patch
From: Nick Rosbrook
Add struct and keyed union generation to gengotypes.py. For keyed unions,
use a method similar to gRPC's oneof to interpret C unions as Go types.
Meaning, for a given struct with a union field, generate a struct for
each sub-struct defined in the union. Then, defi
From: Nick Rosbrook
Signed-off-by: Nick Rosbrook
---
tools/golang/xenlight/gengotypes.py | 39 +++-
tools/golang/xenlight/helpers.gen.go | 300 +++
2 files changed, 338 insertions(+), 1 deletion(-)
diff --git a/tools/golang/xenlight/gengotypes.py
b/tools/golang
From: Nick Rosbrook
Define StringList as []string an implement fromC and toC functions.
Signed-off-by: Nick Rosbrook
Reviewed-by: George Dunlap
---
Changes in v2:
- Define fromC with a pointer receiver since a newly-allocated slice
is being assigned to the StringList.
---
tools/golang
From: Nick Rosbrook
Re-define Hwcap as [8]uint32, and implement toC function. Also, re-name and
modify signature of toGo function to fromC.
Signed-off-by: Nick Rosbrook
Reviewed-by: George Dunlap
---
Changes in v2:
- Fix comment in fromC since an array is being used now, not a slice.
- Use a
From: Nick Rosbrook
Signed-off-by: Nick Rosbrook
---
tools/golang/xenlight/gengotypes.py | 44 +++-
tools/golang/xenlight/helpers.gen.go | 359 +++
2 files changed, 402 insertions(+), 1 deletion(-)
diff --git a/tools/golang/xenlight/gengotypes.py
b/tools/golang
From: Nick Rosbrook
Since the C union cannot be directly populated, populate the fields of the
corresponding C struct defined in the cgo preamble, and then copy that
struct as bytes into the byte slice that Go uses as the union.
Signed-off-by: Nick Rosbrook
---
tools/golang/xenlight
From: Nick Rosbrook
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 remov
From: Nick Rosbrook
Implement conversion of basic type conversions such as strings
and integer types in toC functions.
Signed-off-by: Nick Rosbrook
---
tools/golang/xenlight/gengotypes.py | 80 ++
tools/golang/xenlight/helpers.gen.go | 1015 ++
2 files changed, 1095
From: Nick Rosbrook
A previous commit that removed Context.CheckOpen revealed
an ineffectual assignent to err in Context.Cpupoolinfo, as
there is no error return type.
Since it appears that the intent is to return an error here,
add an error return value to the function signature.
Signed-off
From: Nick Rosbrook
Signed-off-by: Nick Rosbrook
Acked-by: George Dunlap
---
tools/golang/xenlight/xenlight.go | 2 --
1 file changed, 2 deletions(-)
diff --git a/tools/golang/xenlight/xenlight.go
b/tools/golang/xenlight/xenlight.go
index 8f41047726..fb1c6d9e51 100644
--- a/tools/golang
> I was expecting you to change this if you sent a v3. :-)
>
> I can still change it on check-in, but if for some reason there's a v4,
> please make the change before resending. Thanks. :-)
Sorry, my mistake. I will make the change if I send v4.
Thanks,
-NR
_
On Tue, Dec 17, 2019 at 6:16 AM George Dunlap wrote:
>
> On 12/10/19 3:47 PM, Nick Rosbrook wrote:
> > From: Nick Rosbrook
> >
> > Signed-off-by: Nick Rosbrook
> > ---
> > tools/golang/xenlight/gengotypes.py | 39 +++-
> >
Implement conversion of basic type conversions such as strings
and integer types in toC functions.
Signed-off-by: Nick Rosbrook
---
tools/golang/xenlight/gengotypes.py | 80 ++
tools/golang/xenlight/helpers.gen.go | 1015 ++
2 files changed, 1095 insertions(+)
diff
Since the C union cannot be directly populated, populate the fields of the
corresponding C struct defined in the cgo preamble, and then copy that
struct as bytes into the byte slice that Go uses as the union.
Signed-off-by: Nick Rosbrook
---
tools/golang/xenlight/gengotypes.py | 77
Signed-off-by: Nick Rosbrook
---
Changes in v4:
- Call fromC using slice expression instead of creating temporary
variable and assigning later.
---
tools/golang/xenlight/gengotypes.py | 37 +++-
tools/golang/xenlight/helpers.gen.go | 246 +++
2 files changed, 282
://github.com/enr0n/xen/tree/golang-patches-v3
[5] https://github.com/enr0n/xen/tree/golang-patches-v4
Nick Rosbrook (6):
golang/xenlight: implement array C to Go marshaling
golang/xenlight: begin Go to C type marshaling
golang/xenlight: implement keyed union Go to C marshaling
golang/xenlight
Signed-off-by: Nick Rosbrook
---
tools/golang/xenlight/gengotypes.py | 44 +++-
tools/golang/xenlight/helpers.gen.go | 359 +++
2 files changed, 402 insertions(+), 1 deletion(-)
diff --git a/tools/golang/xenlight/gengotypes.py
b/tools/golang/xenlight/gengotypes.py
A previous commit that removed Context.CheckOpen revealed
an ineffectual assignent to err in Context.Cpupoolinfo, as
there is no error return type.
Since it appears that the intent is to return an error here,
add an error return value to the function signature.
Signed-off-by: Nick Rosbrook
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
Reviewed-by: George Dunlap
---
Changes in v4:
- Add line break to excessively long line in NewContex
> I realize this is all generated code, but there's still a massive amount
> of duplication here, which will at very least cause code bloat. I think
> it should be possible to do this all at once with a defer, like this:
>
> func (x *SpiceInfo) toC() (xc C.libxl_spice_info, err error) {
> C.li
From: Nick Rosbrook
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/xenlight.go | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/golang/xenlight/xenlight.go
b/tools/golang/xenlight/xenlight.go
index 7bf16dc03b..4d4fad2a9d
From: Nick Rosbrook
Re-name and modify signature of toGo function to fromC. The reason for
using 'fromC' rather than 'toGo' is that it is not a good idea to define
methods on the C types. Also, add error return type to Bitmap's toC function.
Finally, as code-cleanu
From: Nick Rosbrook
These functions require a third argument of type const *libxl_asyncop_how.
Pass nil to fix compilation errors. This will have the effect of
performing these operations synchronously.
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools
From: Nick Rosbrook
Define Defbool as struct analagous to the C type, and define the type
'defboolVal' that represent true, false, and default defbool values.
Implement Set, Unset, SetIfDefault, IsDefault, Val, and String functions
on Defbool so that the type can be used in Go anal
From: Nick Rosbrook
After Xen summit, we started the discussion in this[1] RFC thread
to figure out how to generate Go bindings for libxl. This series
implements that Go code generation using the existing IDL, and updates
the existing hand-written code in xenlight.go to use the generated
code
From: Nick Rosbrook
Define MsVmGenid as [int(C.LIBXL_MS_VM_GENID_LEN)]byte and implement fromC and
toC functions.
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/xenlight.go | 23 +++
1 file changed, 23 insertions
From: Nick Rosbrook
Introduce gengotypes.py to generate Go code the from IDL. As a first step,
implement 'enum' type generation.
As a result of the newly-generated code, remove the existing, and now
conflicting definitions in xenlight.go. In the case of the Error type,
rename the sli
From: Nick Rosbrook
Define KeyValueList builtin type, analagous to libxl_key_value_list as
map[string]string, and implement its fromC and toC functions.
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/xenlight.go | 33
From: Nick Rosbrook
Define StringList as []string an implement fromC and toC functions.
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/xenlight.go | 29 +
1 file changed, 29 insertions(+)
diff --git a/tools
From: Nick Rosbrook
Re-define Uuid as [16]byte and implement fromC, toC, and String functions.
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/xenlight.go | 37 +--
1 file changed, 35 insertions(+), 2
From: Nick Rosbrook
Define EvLink as empty struct as there is currently no reason the internal of
this type should be used in Go.
Implement fromC and toC functions as no-ops.
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/xenlight.go
From: Nick Rosbrook
Define CpuidPolicyList as a wrapper struct with field val of type
*C.libxl_cpuid_policy_list and implement fromC and toC functions.
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/xenlight.go | 20
From: Nick Rosbrook
Define Mac as [6]byte and implement fromC, toC, and String functions.
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/xenlight.go | 35 +++
1 file changed, 35 insertions(+)
diff --git a
From: Nick Rosbrook
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/xenlight.go | 2 --
1 file changed, 2 deletions(-)
diff --git a/tools/golang/xenlight/xenlight.go
b/tools/golang/xenlight/xenlight.go
index 0adb12d1bf..f91c0d2be2
From: Nick Rosbrook
Add struct and keyed union generation to gengotypes.py. For keyed unions,
use a method similar to gRPC's oneof to interpret C unions as Go types.
Meaning, for a given struct with a union field, generate a struct for
each sub-struct defined in the union. Then, defi
From: Nick Rosbrook
Re-define Hwcap as [8]uint32, and implement toC function. Also, re-name and
modify signature of toGo function to fromC.
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/xenlight.go | 29
From: Nick Rosbrook
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/gengotypes.py | 39 ++-
tools/golang/xenlight/xenlight_helpers.go | 300 ++
2 files changed, 338 insertions(+), 1 deletion(-)
diff --git a
From: Nick Rosbrook
Switch over union key to determine how to populate 'union' in Go struct.
Since the unions of C types cannot be directly accessed, add C structs in
cgo preamble to assist in marshaling keyed unions. This allows the C
type defined in the preamble to be populated
From: Nick Rosbrook
Since the C union cannot be directly populated, populate the fields of the
corresponding C struct defined in the cgo preamble, and then copy that
struct as bytes into the byte slice that Go uses as the union.
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian
From: Nick Rosbrook
A previous commit that removed Context.CheckOpen revealed
an ineffectual assignent to err in Context.Cpupoolinfo, as
there is no error return type.
Since it appears that the intent is to return an error here,
add an error return value to the function signature.
Signed-off
From: Nick Rosbrook
Remove the PKGSOURCES variable since adding xenlight_types.go
and xenlight_helpers.go to this list breaks the rest of the
Makefile.
Add xenlight_%.go target for generated files, and use full
file names within install, uninstall and $(XEN_GOPATH)$(GOXL_PKG_DIR)
rule.
Signed
From: Nick Rosbrook
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 remov
From: Nick Rosbrook
Implement conversion of basic type conversions such as strings
and integer types in toC functions.
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/gengotypes.py | 80 ++
tools/golang/xenlight
From: Nick Rosbrook
Implement basic type conversion in fromC functions such as strings and
integer types. Also, remove existing toGo functions from xenlight.go in
favor of the new generated functions.
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools
From: Nick Rosbrook
Signed-off-by: Nick Rosbrook
---
Cc: George Dunlap
Cc: Ian Jackson
Cc: Wei Liu
tools/golang/xenlight/gengotypes.py | 44 ++-
tools/golang/xenlight/xenlight_helpers.go | 359 ++
2 files changed, 402 insertions(+), 1 deletion(-)
diff --git a
> One standard practice when making a series is to try to avoid any
> regressions, including build regressions, in the middle of the series.
> This is particularly helpful to aid in bisections, but in this case it
> makes it easier to observe the action of the `gengotypes.py` script (and
> how it's
> So we *could* actually just `type KeyValueList struct { }`, and punt on
> all these initialization questions until such time as it turns out that
> they're needed.
If there is no clear need for this type to be implemented in the Go
package, then I would be in favor of not doing so. IMO, a smalle
> Ok, in that case let’s just leave the struct empty.
Ok, sounds like a plan.
> I think we basically have three options:
>
> 1. Try to arrange it so that the “zero” values correspond to “default” values
> in libxl; i.e., have DevID 0 -> libxl_devid -1, DevID 1 -> libxl_devid 0, &c
>
> 2. Add New
> Any particular reason to use `cslice` here rather than `mapslice` (or
> vice versa)?
>
> Not a big deal, but since they're of the came element in the C struct,
> it seems like it would be better to give them the same name. (Don't
> have a strong opinion on which one).
IIRC, I found the name `ma
> Doesn't this method want a pointer receiver?
Yes, since I'm allocating a new slice. If I wasn't allocating a new
slice, this would be okay since the slice contains a pointer to the
underlying array.
-NR
___
Xen-devel mailing list
Xen-devel@lists.xenp
> What's the point of this?
>
> I realize it's slightly annoying to have to type `mac[0], mac[1], ...`,
> but I'd rather do that once than make the runtime copy everything over
> into a slice of interfaces every String() call.
As I think you realized by looking at subsequent patches, this is to
ge
> Hmm, this introduces a pretty significant risk of memory leaks; but I
> don't really see any way around it. I guess we really want to do some
> SetFinalizer() magic on this to call libxl_cpuid_dispose()?
>
> We might also want to add something like a .Dispose() method to have
> predictable memor
> So the code you have is probably going to be about equally efficient anyway.
A quick benchmark [1] shows:
goos: linux
goarch: amd64
BenchmarkString1-8500 251 ns/op
BenchmarkString2-8500 247 ns/op
So yes, they're about the same :)
I'll leave it as is
> BTW I was discussing with Ian Jackson, and I think at some point it
> would be worth considering adding in an annotation or something to the
> IDL such that the generator can use time.Duration for these things.
> That opens up another can of works, like the fact that Duration is
> int64 rather t
1 - 100 of 279 matches
Mail list logo