[fidlgen][go] add bindings test for factory methods
add tests for fxr/313205
Test: fx run-test go_fidl_tests
Change-Id: I7fd873f14e683914fd25c5d4cacd1df87940713e
diff --git a/src/syscall/zx/fdio/node.go b/src/syscall/zx/fdio/node.go
index 04f5dc4..a197cd3 100644
--- a/src/syscall/zx/fdio/node.go
+++ b/src/syscall/zx/fdio/node.go
@@ -19,7 +19,7 @@
}
return nil, &zx.Error{Status: zx.ErrNotSupported, Text: "io.node"}
}
- switch info.NodeInfoTag {
+ switch info.Which() {
case io.NodeInfoService:
// TODO(mknyszek): Figure out the correct type to return here.
result = &Node{NodeInterface: node}
diff --git a/src/syscall/zx/fidl/bindingstest/impl.go b/src/syscall/zx/fidl/bindingstest/impl.go
index 10cb006..4ae9581 100644
--- a/src/syscall/zx/fidl/bindingstest/impl.go
+++ b/src/syscall/zx/fidl/bindingstest/impl.go
@@ -230,8 +230,8 @@
type TestVector2 struct {
_ struct{} `fidl2:"s,64,8"`
A [2][]int8
- B [][]int8 `fidl:",2" fidl2:"2,"`
- C []*[]string `fidl:"5,2,2" fidl2:"2,2,5"`
+ B [][]int8 `fidl:"2," fidl2:"2,"`
+ C []*[]string `fidl:"2,2,5" fidl2:"2,2,5"`
}
var _mTestVector2 = _bindings.CreateLazyMarshaler(TestVector2{})
@@ -372,10 +372,10 @@
type TestHandle1 struct {
_ struct{} `fidl2:"s,16,4"`
- A _zx.Handle `fidl2:"0"`
- B _zx.Handle `fidl:"*" fidl2:"1"`
- C _zx.VMO `fidl2:"0"`
- D _zx.VMO `fidl:"*" fidl2:"1"`
+ A _zx.Handle `fidl:"0" fidl2:"0"`
+ B _zx.Handle `fidl:"1" fidl2:"1"`
+ C _zx.VMO `fidl:"0" fidl2:"0"`
+ D _zx.VMO `fidl:"1" fidl2:"1"`
}
var _mTestHandle1 = _bindings.CreateLazyMarshaler(TestHandle1{})
@@ -386,8 +386,8 @@
type TestHandle2 struct {
_ struct{} `fidl2:"s,32,8"`
- A []_zx.Handle `fidl:"1" fidl2:"1,0"`
- B []_zx.VMO `fidl:"*,1" fidl2:"1,1"`
+ A []_zx.Handle `fidl:"1,0" fidl2:"1,0"`
+ B []_zx.VMO `fidl:"1,1" fidl2:"1,1"`
}
var _mTestHandle2 = _bindings.CreateLazyMarshaler(TestHandle2{})
@@ -399,9 +399,9 @@
type TestInterface1 struct {
_ struct{} `fidl2:"s,16,4"`
A Test1Interface
- B Test1Interface `fidl:"*"`
- C Test1InterfaceRequest `fidl2:"0"`
- D Test1InterfaceRequest `fidl:"*" fidl2:"1"`
+ B Test1Interface
+ C Test1InterfaceRequest `fidl:"0" fidl2:"0"`
+ D Test1InterfaceRequest `fidl:"1" fidl2:"1"`
}
var _mTestInterface1 = _bindings.CreateLazyMarshaler(TestInterface1{})
@@ -515,10 +515,10 @@
return _mTestAddEthernetDeviceRequest
}
-type Union1Tag uint32
+type I_union1Tag uint32
const (
- _ Union1Tag = iota
+ _ I_union1Tag = iota
Union1A
Union1B
Union1C
@@ -526,41 +526,65 @@
)
type Union1 struct {
- Union1Tag `fidl:"tag" fidl2:"u,16,8"`
- A [3]int8
- B TestSimple
- C *TestSimple
- D float32
+ I_union1Tag `fidl:"tag" fidl2:"u,16,8"`
+ A [3]int8
+ B TestSimple
+ C *TestSimple
+ D float32
}
-func (u *Union1) Which() Union1Tag {
- return u.Union1Tag
+func (u *Union1) Which() I_union1Tag {
+ return u.I_union1Tag
}
func (u *Union1) SetA(a [3]int8) {
- u.Union1Tag = Union1A
+ u.I_union1Tag = Union1A
u.A = a
}
+func Union1WithA(a [3]int8) Union1 {
+ var _u Union1
+ _u.SetA(a)
+ return _u
+}
+
func (u *Union1) SetB(b TestSimple) {
- u.Union1Tag = Union1B
+ u.I_union1Tag = Union1B
u.B = b
}
+func Union1WithB(b TestSimple) Union1 {
+ var _u Union1
+ _u.SetB(b)
+ return _u
+}
+
func (u *Union1) SetC(c *TestSimple) {
- u.Union1Tag = Union1C
+ u.I_union1Tag = Union1C
u.C = c
}
+func Union1WithC(c *TestSimple) Union1 {
+ var _u Union1
+ _u.SetC(c)
+ return _u
+}
+
func (u *Union1) SetD(d float32) {
- u.Union1Tag = Union1D
+ u.I_union1Tag = Union1D
u.D = d
}
-type SimpleUnionTag uint32
+func Union1WithD(d float32) Union1 {
+ var _u Union1
+ _u.SetD(d)
+ return _u
+}
+
+type I_simpleUnionTag uint32
const (
- _ SimpleUnionTag = iota
+ _ I_simpleUnionTag = iota
SimpleUnionI32
SimpleUnionI64
SimpleUnionS
@@ -569,72 +593,114 @@
)
type SimpleUnion struct {
- SimpleUnionTag `fidl:"tag" fidl2:"u,24,8"`
- I32 int32
- I64 int64
- S Int64Struct
- Os *Int64Struct
- Str string
+ I_simpleUnionTag `fidl:"tag" fidl2:"u,24,8"`
+ I32 int32
+ I64 int64
+ S Int64Struct
+ Os *Int64Struct
+ Str string
}
-func (u *SimpleUnion) Which() SimpleUnionTag {
- return u.SimpleUnionTag
+func (u *SimpleUnion) Which() I_simpleUnionTag {
+ return u.I_simpleUnionTag
}
func (u *SimpleUnion) SetI32(i32 int32) {
- u.SimpleUnionTag = SimpleUnionI32
+ u.I_simpleUnionTag = SimpleUnionI32
u.I32 = i32
}
+func SimpleUnionWithI32(i32 int32) SimpleUnion {
+ var _u SimpleUnion
+ _u.SetI32(i32)
+ return _u
+}
+
func (u *SimpleUnion) SetI64(i64 int64) {
- u.SimpleUnionTag = SimpleUnionI64
+ u.I_simpleUnionTag = SimpleUnionI64
u.I64 = i64
}
+func SimpleUnionWithI64(i64 int64) SimpleUnion {
+ var _u SimpleUnion
+ _u.SetI64(i64)
+ return _u
+}
+
func (u *SimpleUnion) SetS(s Int64Struct) {
- u.SimpleUnionTag = SimpleUnionS
+ u.I_simpleUnionTag = SimpleUnionS
u.S = s
}
+func SimpleUnionWithS(s Int64Struct) SimpleUnion {
+ var _u SimpleUnion
+ _u.SetS(s)
+ return _u
+}
+
func (u *SimpleUnion) SetOs(os *Int64Struct) {
- u.SimpleUnionTag = SimpleUnionOs
+ u.I_simpleUnionTag = SimpleUnionOs
u.Os = os
}
+func SimpleUnionWithOs(os *Int64Struct) SimpleUnion {
+ var _u SimpleUnion
+ _u.SetOs(os)
+ return _u
+}
+
func (u *SimpleUnion) SetStr(str string) {
- u.SimpleUnionTag = SimpleUnionStr
+ u.I_simpleUnionTag = SimpleUnionStr
u.Str = str
}
-type IpAddressConfigTag uint32
+func SimpleUnionWithStr(str string) SimpleUnion {
+ var _u SimpleUnion
+ _u.SetStr(str)
+ return _u
+}
+
+type I_ipAddressConfigTag uint32
const (
- _ IpAddressConfigTag = iota
+ _ I_ipAddressConfigTag = iota
IpAddressConfigPaddingSize24Align4
IpAddressConfigDhcp
)
type IpAddressConfig struct {
- IpAddressConfigTag `fidl:"tag" fidl2:"u,28,4"`
- PaddingSize24Align4 [6]uint32
- Dhcp bool
+ I_ipAddressConfigTag `fidl:"tag" fidl2:"u,28,4"`
+ PaddingSize24Align4 [6]uint32
+ Dhcp bool
}
-func (u *IpAddressConfig) Which() IpAddressConfigTag {
- return u.IpAddressConfigTag
+func (u *IpAddressConfig) Which() I_ipAddressConfigTag {
+ return u.I_ipAddressConfigTag
}
func (u *IpAddressConfig) SetPaddingSize24Align4(paddingSize24Align4 [6]uint32) {
- u.IpAddressConfigTag = IpAddressConfigPaddingSize24Align4
+ u.I_ipAddressConfigTag = IpAddressConfigPaddingSize24Align4
u.PaddingSize24Align4 = paddingSize24Align4
}
+func IpAddressConfigWithPaddingSize24Align4(paddingSize24Align4 [6]uint32) IpAddressConfig {
+ var _u IpAddressConfig
+ _u.SetPaddingSize24Align4(paddingSize24Align4)
+ return _u
+}
+
func (u *IpAddressConfig) SetDhcp(dhcp bool) {
- u.IpAddressConfigTag = IpAddressConfigDhcp
+ u.I_ipAddressConfigTag = IpAddressConfigDhcp
u.Dhcp = dhcp
}
-type XUnion1Tag uint32
+func IpAddressConfigWithDhcp(dhcp bool) IpAddressConfig {
+ var _u IpAddressConfig
+ _u.SetDhcp(dhcp)
+ return _u
+}
+
+type I_xUnion1Tag uint32
const (
XUnion1_unknownData = 0 // 0x00000000
@@ -644,15 +710,15 @@
)
type XUnion1 struct {
- XUnion1Tag `fidl2:"x,24,8"`
+ I_xUnion1Tag `fidl2:"x,24,8"`
I_unknownData []byte
A [3]int8 `fidl:"416714395" fidl2:"416714395"`
B TestSimple `fidl:"863456686" fidl2:"863456686"`
D float32 `fidl:"1912225229" fidl2:"1912225229"`
}
-func (_m *XUnion1) Which() XUnion1Tag {
- switch _m.XUnion1Tag {
+func (_m *XUnion1) Which() I_xUnion1Tag {
+ switch _m.I_xUnion1Tag {
case 416714395:
return XUnion1A
case 863456686:
@@ -665,25 +731,43 @@
}
func (_m *XUnion1) Ordinal() uint32 {
- return uint32(_m.XUnion1Tag)
+ return uint32(_m.I_xUnion1Tag)
}
func (_m *XUnion1) SetA(a [3]int8) {
- _m.XUnion1Tag = XUnion1A
+ _m.I_xUnion1Tag = XUnion1A
_m.A = a
}
+func XUnion1WithA(a [3]int8) XUnion1 {
+ var _u XUnion1
+ _u.SetA(a)
+ return _u
+}
+
func (_m *XUnion1) SetB(b TestSimple) {
- _m.XUnion1Tag = XUnion1B
+ _m.I_xUnion1Tag = XUnion1B
_m.B = b
}
+func XUnion1WithB(b TestSimple) XUnion1 {
+ var _u XUnion1
+ _u.SetB(b)
+ return _u
+}
+
func (_m *XUnion1) SetD(d float32) {
- _m.XUnion1Tag = XUnion1D
+ _m.I_xUnion1Tag = XUnion1D
_m.D = d
}
-type StrictXUnion1Tag uint32
+func XUnion1WithD(d float32) XUnion1 {
+ var _u XUnion1
+ _u.SetD(d)
+ return _u
+}
+
+type I_strictXUnion1Tag uint32
const (
StrictXUnion1A = 1988029217 // 0x767eeb21
@@ -692,36 +776,54 @@
)
type StrictXUnion1 struct {
- StrictXUnion1Tag `fidl2:"x!,24,8"`
- I_unknownData []byte
- A [3]int8 `fidl:"1988029217" fidl2:"1988029217"`
- B TestSimple `fidl:"1259078458" fidl2:"1259078458"`
- D float32 `fidl:"881204552" fidl2:"881204552"`
+ I_strictXUnion1Tag `fidl2:"x!,24,8"`
+ I_unknownData []byte
+ A [3]int8 `fidl:"1988029217" fidl2:"1988029217"`
+ B TestSimple `fidl:"1259078458" fidl2:"1259078458"`
+ D float32 `fidl:"881204552" fidl2:"881204552"`
}
-func (_m *StrictXUnion1) Which() StrictXUnion1Tag {
- return _m.StrictXUnion1Tag
+func (_m *StrictXUnion1) Which() I_strictXUnion1Tag {
+ return _m.I_strictXUnion1Tag
}
func (_m *StrictXUnion1) Ordinal() uint32 {
- return uint32(_m.StrictXUnion1Tag)
+ return uint32(_m.I_strictXUnion1Tag)
}
func (_m *StrictXUnion1) SetA(a [3]int8) {
- _m.StrictXUnion1Tag = StrictXUnion1A
+ _m.I_strictXUnion1Tag = StrictXUnion1A
_m.A = a
}
+func StrictXUnion1WithA(a [3]int8) StrictXUnion1 {
+ var _u StrictXUnion1
+ _u.SetA(a)
+ return _u
+}
+
func (_m *StrictXUnion1) SetB(b TestSimple) {
- _m.StrictXUnion1Tag = StrictXUnion1B
+ _m.I_strictXUnion1Tag = StrictXUnion1B
_m.B = b
}
+func StrictXUnion1WithB(b TestSimple) StrictXUnion1 {
+ var _u StrictXUnion1
+ _u.SetB(b)
+ return _u
+}
+
func (_m *StrictXUnion1) SetD(d float32) {
- _m.StrictXUnion1Tag = StrictXUnion1D
+ _m.I_strictXUnion1Tag = StrictXUnion1D
_m.D = d
}
+func StrictXUnion1WithD(d float32) StrictXUnion1 {
+ var _u StrictXUnion1
+ _u.SetD(d)
+ return _u
+}
+
type SimpleTable struct {
_ struct{} `fidl2:"t,16,8"`
X int64 `fidl:"1" fidl2:"1"`
diff --git a/src/syscall/zx/fidl/conformance/impl.go b/src/syscall/zx/fidl/conformance/impl.go
index 6b605bd..1ed1cde 100644
--- a/src/syscall/zx/fidl/conformance/impl.go
+++ b/src/syscall/zx/fidl/conformance/impl.go
@@ -123,7 +123,6 @@
type StructWithArrays struct {
_ struct{} `fidl2:"s,72,8"`
- ArrEmpty [0]int32
ArrInt [2]int32
ArrString [2]string
ArrStruct [2]StructWithInt
@@ -233,6 +232,138 @@
return _mStructWithOptionals
}
+type MyBool struct {
+ _ struct{} `fidl2:"s,1,1"`
+ Value bool
+}
+
+var _mMyBool = _bindings.CreateLazyMarshaler(MyBool{})
+
+func (msg *MyBool) Marshaler() _bindings.Marshaler {
+ return _mMyBool
+}
+
+type MyByte struct {
+ _ struct{} `fidl2:"s,1,1"`
+ Value uint8
+}
+
+var _mMyByte = _bindings.CreateLazyMarshaler(MyByte{})
+
+func (msg *MyByte) Marshaler() _bindings.Marshaler {
+ return _mMyByte
+}
+
+type MyInt8 struct {
+ _ struct{} `fidl2:"s,1,1"`
+ Value int8
+}
+
+var _mMyInt8 = _bindings.CreateLazyMarshaler(MyInt8{})
+
+func (msg *MyInt8) Marshaler() _bindings.Marshaler {
+ return _mMyInt8
+}
+
+type MyInt16 struct {
+ _ struct{} `fidl2:"s,2,2"`
+ Value int16
+}
+
+var _mMyInt16 = _bindings.CreateLazyMarshaler(MyInt16{})
+
+func (msg *MyInt16) Marshaler() _bindings.Marshaler {
+ return _mMyInt16
+}
+
+type MyInt32 struct {
+ _ struct{} `fidl2:"s,4,4"`
+ Value int32
+}
+
+var _mMyInt32 = _bindings.CreateLazyMarshaler(MyInt32{})
+
+func (msg *MyInt32) Marshaler() _bindings.Marshaler {
+ return _mMyInt32
+}
+
+type MyInt64 struct {
+ _ struct{} `fidl2:"s,8,8"`
+ Value int64
+}
+
+var _mMyInt64 = _bindings.CreateLazyMarshaler(MyInt64{})
+
+func (msg *MyInt64) Marshaler() _bindings.Marshaler {
+ return _mMyInt64
+}
+
+type MyUint8 struct {
+ _ struct{} `fidl2:"s,1,1"`
+ Value uint8
+}
+
+var _mMyUint8 = _bindings.CreateLazyMarshaler(MyUint8{})
+
+func (msg *MyUint8) Marshaler() _bindings.Marshaler {
+ return _mMyUint8
+}
+
+type MyUint16 struct {
+ _ struct{} `fidl2:"s,2,2"`
+ Value uint16
+}
+
+var _mMyUint16 = _bindings.CreateLazyMarshaler(MyUint16{})
+
+func (msg *MyUint16) Marshaler() _bindings.Marshaler {
+ return _mMyUint16
+}
+
+type MyUint32 struct {
+ _ struct{} `fidl2:"s,4,4"`
+ Value uint32
+}
+
+var _mMyUint32 = _bindings.CreateLazyMarshaler(MyUint32{})
+
+func (msg *MyUint32) Marshaler() _bindings.Marshaler {
+ return _mMyUint32
+}
+
+type MyUint64 struct {
+ _ struct{} `fidl2:"s,8,8"`
+ Value uint64
+}
+
+var _mMyUint64 = _bindings.CreateLazyMarshaler(MyUint64{})
+
+func (msg *MyUint64) Marshaler() _bindings.Marshaler {
+ return _mMyUint64
+}
+
+type MyFloat32 struct {
+ _ struct{} `fidl2:"s,4,4"`
+ Value float32
+}
+
+var _mMyFloat32 = _bindings.CreateLazyMarshaler(MyFloat32{})
+
+func (msg *MyFloat32) Marshaler() _bindings.Marshaler {
+ return _mMyFloat32
+}
+
+type MyFloat64 struct {
+ _ struct{} `fidl2:"s,8,8"`
+ Value float64
+}
+
+var _mMyFloat64 = _bindings.CreateLazyMarshaler(MyFloat64{})
+
+func (msg *MyFloat64) Marshaler() _bindings.Marshaler {
+ return _mMyFloat64
+}
+
type Length2StringWrapper struct {
_ struct{} `fidl2:"s,16,8"`
Length2String string `fidl:"2" fidl2:"2"`
@@ -388,66 +519,101 @@
return _mTestStrictXUnionInStruct
}
-type IpAddressConfigTag uint32
+type TestFlexibleXUnionInStruct struct {
+ _ struct{} `fidl2:"s,24,8"`
+ Xu SampleXUnion
+}
+
+var _mTestFlexibleXUnionInStruct = _bindings.CreateLazyMarshaler(TestFlexibleXUnionInStruct{})
+
+func (msg *TestFlexibleXUnionInStruct) Marshaler() _bindings.Marshaler {
+ return _mTestFlexibleXUnionInStruct
+}
+
+type I_ipAddressConfigTag uint32
const (
- _ IpAddressConfigTag = iota
+ _ I_ipAddressConfigTag = iota
IpAddressConfigPaddingSize24Align4
IpAddressConfigDhcp
)
type IpAddressConfig struct {
- IpAddressConfigTag `fidl:"tag" fidl2:"u,28,4"`
- PaddingSize24Align4 [6]uint32
- Dhcp bool
+ I_ipAddressConfigTag `fidl:"tag" fidl2:"u,28,4"`
+ PaddingSize24Align4 [6]uint32
+ Dhcp bool
}
-func (u *IpAddressConfig) Which() IpAddressConfigTag {
- return u.IpAddressConfigTag
+func (u *IpAddressConfig) Which() I_ipAddressConfigTag {
+ return u.I_ipAddressConfigTag
}
func (u *IpAddressConfig) SetPaddingSize24Align4(paddingSize24Align4 [6]uint32) {
- u.IpAddressConfigTag = IpAddressConfigPaddingSize24Align4
+ u.I_ipAddressConfigTag = IpAddressConfigPaddingSize24Align4
u.PaddingSize24Align4 = paddingSize24Align4
}
+func IpAddressConfigWithPaddingSize24Align4(paddingSize24Align4 [6]uint32) IpAddressConfig {
+ var _u IpAddressConfig
+ _u.SetPaddingSize24Align4(paddingSize24Align4)
+ return _u
+}
+
func (u *IpAddressConfig) SetDhcp(dhcp bool) {
- u.IpAddressConfigTag = IpAddressConfigDhcp
+ u.I_ipAddressConfigTag = IpAddressConfigDhcp
u.Dhcp = dhcp
}
-type UnionWithEmptyStructTag uint32
+func IpAddressConfigWithDhcp(dhcp bool) IpAddressConfig {
+ var _u IpAddressConfig
+ _u.SetDhcp(dhcp)
+ return _u
+}
+
+type I_unionWithEmptyStructTag uint32
const (
- _ UnionWithEmptyStructTag = iota
+ _ I_unionWithEmptyStructTag = iota
UnionWithEmptyStructS
UnionWithEmptyStructS2
)
type UnionWithEmptyStruct struct {
- UnionWithEmptyStructTag `fidl:"tag" fidl2:"u,16,8"`
- S EmptyStruct
- S2 *EmptyStruct
+ I_unionWithEmptyStructTag `fidl:"tag" fidl2:"u,16,8"`
+ S EmptyStruct
+ S2 *EmptyStruct
}
-func (u *UnionWithEmptyStruct) Which() UnionWithEmptyStructTag {
- return u.UnionWithEmptyStructTag
+func (u *UnionWithEmptyStruct) Which() I_unionWithEmptyStructTag {
+ return u.I_unionWithEmptyStructTag
}
func (u *UnionWithEmptyStruct) SetS(s EmptyStruct) {
- u.UnionWithEmptyStructTag = UnionWithEmptyStructS
+ u.I_unionWithEmptyStructTag = UnionWithEmptyStructS
u.S = s
}
+func UnionWithEmptyStructWithS(s EmptyStruct) UnionWithEmptyStruct {
+ var _u UnionWithEmptyStruct
+ _u.SetS(s)
+ return _u
+}
+
func (u *UnionWithEmptyStruct) SetS2(s2 *EmptyStruct) {
- u.UnionWithEmptyStructTag = UnionWithEmptyStructS2
+ u.I_unionWithEmptyStructTag = UnionWithEmptyStructS2
u.S2 = s2
}
-type SimpleUnionTag uint32
+func UnionWithEmptyStructWithS2(s2 *EmptyStruct) UnionWithEmptyStruct {
+ var _u UnionWithEmptyStruct
+ _u.SetS2(s2)
+ return _u
+}
+
+type I_simpleUnionTag uint32
const (
- _ SimpleUnionTag = iota
+ _ I_simpleUnionTag = iota
SimpleUnionI32
SimpleUnionI64
SimpleUnionS
@@ -456,44 +622,74 @@
)
type SimpleUnion struct {
- SimpleUnionTag `fidl:"tag" fidl2:"u,24,8"`
- I32 int32
- I64 int64
- S Int64Struct
- Os *Int64Struct
- Str string
+ I_simpleUnionTag `fidl:"tag" fidl2:"u,24,8"`
+ I32 int32
+ I64 int64
+ S Int64Struct
+ Os *Int64Struct
+ Str string
}
-func (u *SimpleUnion) Which() SimpleUnionTag {
- return u.SimpleUnionTag
+func (u *SimpleUnion) Which() I_simpleUnionTag {
+ return u.I_simpleUnionTag
}
func (u *SimpleUnion) SetI32(i32 int32) {
- u.SimpleUnionTag = SimpleUnionI32
+ u.I_simpleUnionTag = SimpleUnionI32
u.I32 = i32
}
+func SimpleUnionWithI32(i32 int32) SimpleUnion {
+ var _u SimpleUnion
+ _u.SetI32(i32)
+ return _u
+}
+
func (u *SimpleUnion) SetI64(i64 int64) {
- u.SimpleUnionTag = SimpleUnionI64
+ u.I_simpleUnionTag = SimpleUnionI64
u.I64 = i64
}
+func SimpleUnionWithI64(i64 int64) SimpleUnion {
+ var _u SimpleUnion
+ _u.SetI64(i64)
+ return _u
+}
+
func (u *SimpleUnion) SetS(s Int64Struct) {
- u.SimpleUnionTag = SimpleUnionS
+ u.I_simpleUnionTag = SimpleUnionS
u.S = s
}
+func SimpleUnionWithS(s Int64Struct) SimpleUnion {
+ var _u SimpleUnion
+ _u.SetS(s)
+ return _u
+}
+
func (u *SimpleUnion) SetOs(os *Int64Struct) {
- u.SimpleUnionTag = SimpleUnionOs
+ u.I_simpleUnionTag = SimpleUnionOs
u.Os = os
}
+func SimpleUnionWithOs(os *Int64Struct) SimpleUnion {
+ var _u SimpleUnion
+ _u.SetOs(os)
+ return _u
+}
+
func (u *SimpleUnion) SetStr(str string) {
- u.SimpleUnionTag = SimpleUnionStr
+ u.I_simpleUnionTag = SimpleUnionStr
u.Str = str
}
-type XUnionWithEmptyStructTag uint32
+func SimpleUnionWithStr(str string) SimpleUnion {
+ var _u SimpleUnion
+ _u.SetStr(str)
+ return _u
+}
+
+type I_xUnionWithEmptyStructTag uint32
const (
XUnionWithEmptyStruct_unknownData = 0 // 0x00000000
@@ -501,13 +697,13 @@
)
type XUnionWithEmptyStruct struct {
- XUnionWithEmptyStructTag `fidl2:"x,24,8"`
- I_unknownData []byte
- S EmptyStruct `fidl:"1956241662" fidl2:"1956241662"`
+ I_xUnionWithEmptyStructTag `fidl2:"x,24,8"`
+ I_unknownData []byte
+ S EmptyStruct `fidl:"1956241662" fidl2:"1956241662"`
}
-func (_m *XUnionWithEmptyStruct) Which() XUnionWithEmptyStructTag {
- switch _m.XUnionWithEmptyStructTag {
+func (_m *XUnionWithEmptyStruct) Which() I_xUnionWithEmptyStructTag {
+ switch _m.I_xUnionWithEmptyStructTag {
case 1956241662:
return XUnionWithEmptyStructS
default:
@@ -516,15 +712,21 @@
}
func (_m *XUnionWithEmptyStruct) Ordinal() uint32 {
- return uint32(_m.XUnionWithEmptyStructTag)
+ return uint32(_m.I_xUnionWithEmptyStructTag)
}
func (_m *XUnionWithEmptyStruct) SetS(s EmptyStruct) {
- _m.XUnionWithEmptyStructTag = XUnionWithEmptyStructS
+ _m.I_xUnionWithEmptyStructTag = XUnionWithEmptyStructS
_m.S = s
}
-type SampleXUnionTag uint32
+func XUnionWithEmptyStructWithS(s EmptyStruct) XUnionWithEmptyStruct {
+ var _u XUnionWithEmptyStruct
+ _u.SetS(s)
+ return _u
+}
+
+type I_sampleXUnionTag uint32
const (
SampleXUnion_unknownData = 0 // 0x00000000
@@ -534,15 +736,15 @@
)
type SampleXUnion struct {
- SampleXUnionTag `fidl2:"x,24,8"`
- I_unknownData []byte
- U uint32 `fidl:"949769906" fidl2:"949769906"`
- Su SimpleUnion `fidl:"2033143581" fidl2:"2033143581"`
- St SimpleTable `fidl:"35514581" fidl2:"35514581"`
+ I_sampleXUnionTag `fidl2:"x,24,8"`
+ I_unknownData []byte
+ U uint32 `fidl:"949769906" fidl2:"949769906"`
+ Su SimpleUnion `fidl:"2033143581" fidl2:"2033143581"`
+ St SimpleTable `fidl:"35514581" fidl2:"35514581"`
}
-func (_m *SampleXUnion) Which() SampleXUnionTag {
- switch _m.SampleXUnionTag {
+func (_m *SampleXUnion) Which() I_sampleXUnionTag {
+ switch _m.I_sampleXUnionTag {
case 949769906:
return SampleXUnionU
case 2033143581:
@@ -555,25 +757,43 @@
}
func (_m *SampleXUnion) Ordinal() uint32 {
- return uint32(_m.SampleXUnionTag)
+ return uint32(_m.I_sampleXUnionTag)
}
func (_m *SampleXUnion) SetU(u uint32) {
- _m.SampleXUnionTag = SampleXUnionU
+ _m.I_sampleXUnionTag = SampleXUnionU
_m.U = u
}
+func SampleXUnionWithU(u uint32) SampleXUnion {
+ var _u SampleXUnion
+ _u.SetU(u)
+ return _u
+}
+
func (_m *SampleXUnion) SetSu(su SimpleUnion) {
- _m.SampleXUnionTag = SampleXUnionSu
+ _m.I_sampleXUnionTag = SampleXUnionSu
_m.Su = su
}
+func SampleXUnionWithSu(su SimpleUnion) SampleXUnion {
+ var _u SampleXUnion
+ _u.SetSu(su)
+ return _u
+}
+
func (_m *SampleXUnion) SetSt(st SimpleTable) {
- _m.SampleXUnionTag = SampleXUnionSt
+ _m.I_sampleXUnionTag = SampleXUnionSt
_m.St = st
}
-type SampleStrictXUnionTag uint32
+func SampleXUnionWithSt(st SimpleTable) SampleXUnion {
+ var _u SampleXUnion
+ _u.SetSt(st)
+ return _u
+}
+
+type I_sampleStrictXUnionTag uint32
const (
SampleStrictXUnionU = 149088882 // 0x08e2ea72
@@ -582,43 +802,61 @@
)
type SampleStrictXUnion struct {
- SampleStrictXUnionTag `fidl2:"x!,24,8"`
- I_unknownData []byte
- U uint32 `fidl:"149088882" fidl2:"149088882"`
- Su SimpleUnion `fidl:"670279483" fidl2:"670279483"`
- St SimpleTable `fidl:"925062383" fidl2:"925062383"`
+ I_sampleStrictXUnionTag `fidl2:"x!,24,8"`
+ I_unknownData []byte
+ U uint32 `fidl:"149088882" fidl2:"149088882"`
+ Su SimpleUnion `fidl:"670279483" fidl2:"670279483"`
+ St SimpleTable `fidl:"925062383" fidl2:"925062383"`
}
-func (_m *SampleStrictXUnion) Which() SampleStrictXUnionTag {
- return _m.SampleStrictXUnionTag
+func (_m *SampleStrictXUnion) Which() I_sampleStrictXUnionTag {
+ return _m.I_sampleStrictXUnionTag
}
func (_m *SampleStrictXUnion) Ordinal() uint32 {
- return uint32(_m.SampleStrictXUnionTag)
+ return uint32(_m.I_sampleStrictXUnionTag)
}
func (_m *SampleStrictXUnion) SetU(u uint32) {
- _m.SampleStrictXUnionTag = SampleStrictXUnionU
+ _m.I_sampleStrictXUnionTag = SampleStrictXUnionU
_m.U = u
}
+func SampleStrictXUnionWithU(u uint32) SampleStrictXUnion {
+ var _u SampleStrictXUnion
+ _u.SetU(u)
+ return _u
+}
+
func (_m *SampleStrictXUnion) SetSu(su SimpleUnion) {
- _m.SampleStrictXUnionTag = SampleStrictXUnionSu
+ _m.I_sampleStrictXUnionTag = SampleStrictXUnionSu
_m.Su = su
}
+func SampleStrictXUnionWithSu(su SimpleUnion) SampleStrictXUnion {
+ var _u SampleStrictXUnion
+ _u.SetSu(su)
+ return _u
+}
+
func (_m *SampleStrictXUnion) SetSt(st SimpleTable) {
- _m.SampleStrictXUnionTag = SampleStrictXUnionSt
+ _m.I_sampleStrictXUnionTag = SampleStrictXUnionSt
_m.St = st
}
+func SampleStrictXUnionWithSt(st SimpleTable) SampleStrictXUnion {
+ var _u SampleStrictXUnion
+ _u.SetSt(st)
+ return _u
+}
+
type XUnionInTable struct {
_ struct{} `fidl2:"t,16,8"`
- Before string `fidl:",1" fidl2:"1,"`
+ Before string `fidl:"1," fidl2:"1,"`
BeforePresent bool
Xu SampleXUnion `fidl:"2" fidl2:"2"`
XuPresent bool
- After string `fidl:",3" fidl2:"3,"`
+ After string `fidl:"3," fidl2:"3,"`
AfterPresent bool
}
@@ -782,11 +1020,11 @@
type TableWithStringAndVector struct {
_ struct{} `fidl2:"t,16,8"`
- Foo string `fidl:",1" fidl2:"1,"`
+ Foo string `fidl:"1," fidl2:"1,"`
FooPresent bool
Bar int32 `fidl:"2" fidl2:"2"`
BarPresent bool
- Baz []uint8 `fidl:",3" fidl2:"3,"`
+ Baz []uint8 `fidl:"3," fidl2:"3,"`
BazPresent bool
}
diff --git a/src/syscall/zx/fidl/fidl_test/bindings_test.go b/src/syscall/zx/fidl/fidl_test/bindings_test.go
index bd0cae6..8e7188e 100644
--- a/src/syscall/zx/fidl/fidl_test/bindings_test.go
+++ b/src/syscall/zx/fidl/fidl_test/bindings_test.go
@@ -177,3 +177,66 @@
}
})
}
+
+func TestUnionStructFieldFactory(t *testing.T) {
+ b := TestSimple{X: 13}
+ union := Union1WithB(b)
+ if union.Which() != Union1B {
+ t.Error("expected union with tag Union1B")
+ }
+ if union.B != b {
+ t.Error("union has incorrect value")
+ }
+}
+
+func TestUnionPrimitiveFieldFactory(t *testing.T) {
+ union := Union1WithD(3.14)
+ if union.Which() != Union1D {
+ t.Error("expected union with tag Union1D")
+ }
+ if union.D != 3.14 {
+ t.Error("union has incorrect value")
+ }
+}
+
+func TestUnionOptionalFieldFactory(t *testing.T) {
+ union := Union1WithC(nil)
+ if union.Which() != Union1C {
+ t.Error("expected union with tag Union1C")
+ }
+ if union.C != nil {
+ t.Error("union has incorrect value")
+ }
+}
+
+func TestXUnionStructFieldFactory(t *testing.T) {
+ b := TestSimple{X: 13}
+ xunion := XUnion1WithB(b)
+ if xunion.Which() != XUnion1B {
+ t.Error("expected xunion with tag XUnion1B")
+ }
+ if xunion.B != b {
+ t.Error("xunion has incorrect value")
+ }
+}
+
+func TestXUnionPrimitiveFieldFactory(t *testing.T) {
+ xunion := XUnion1WithD(3.14)
+ if xunion.Which() != XUnion1D {
+ t.Error("expected xunion with tag XUnion1D")
+ }
+ if xunion.D != 3.14 {
+ t.Error("xunion has incorrect value")
+ }
+}
+
+func TestXUnionArrayFieldFactory(t *testing.T) {
+ a := [3]int8{1, 2, 3}
+ xunion := XUnion1WithA(a)
+ if xunion.Which() != XUnion1A {
+ t.Error("expected xunion with tag XUnion1A")
+ }
+ if xunion.A != a {
+ t.Error("xunion has incorrect value")
+ }
+}
diff --git a/src/syscall/zx/fidl/fidl_test/encoding_new_test.go b/src/syscall/zx/fidl/fidl_test/encoding_new_test.go
index 4ce07b2..0c0cca4 100644
--- a/src/syscall/zx/fidl/fidl_test/encoding_new_test.go
+++ b/src/syscall/zx/fidl/fidl_test/encoding_new_test.go
@@ -157,8 +157,8 @@
t.Fatalf("TestXUnionWithUnknownData failed: %s", err)
}
- if int(message.Xu.XUnion1Tag) != int(input[0]) {
- t.Fatalf("XUnion1Tag expected=%d actual=%d", input[0], message.Xu.XUnion1Tag)
+ if int(message.Xu.Ordinal()) != int(input[0]) {
+ t.Fatalf("XUnion1Tag expected=%d actual=%d", input[0], message.Xu.Ordinal())
}
if !bytes.Equal(message.Xu.I_unknownData, input[24:32]) {
@@ -782,7 +782,7 @@
B: nil,
}, ErrInvalidUnionTag},
{"union1-A-tag-out-of-bounds", &TestUnion1{
- A: Union1{Union1Tag: Union1D + 1},
+ A: Union1{I_union1Tag: Union1D + 1},
B: nil,
}, ErrInvalidUnionTag},
}
diff --git a/src/syscall/zx/io/impl.go b/src/syscall/zx/io/impl.go
index 54504e0..050ba96 100644
--- a/src/syscall/zx/io/impl.go
+++ b/src/syscall/zx/io/impl.go
@@ -37,6 +37,8 @@
OpenRightWritable uint32 = 2
// Connection can mount/umount filesystem.
OpenRightAdmin uint32 = 4
+ // Connection can map target object executable.
+ OpenRightExecutable uint32 = 8
// Create the object if it doesn't exist.
OpenFlagCreate uint32 = 65536
// (with Create) Fail if the object already exists.
@@ -69,9 +71,10 @@
OpenFlagDescribe uint32 = 8388608
// Specify this flag to request POSIX-compatibility. Currently, it affects permission handling.
// During Open:
- // - If the target path is a directory, the rights on the new connection expands to include
+ // - If the target path is a directory, the rights on the new connection expand to include
// `OPEN_RIGHT_WRITABLE` if and only if the current connection and all intermediate mount points
- // are writable.
+ // are writable, and to include `OPEN_RIGHT_EXECUTABLE` if and only if the current connection and
+ // all intermediate mount points are executable.
// - Otherwise, this flag is ignored. It is an access denied error to request more rights
// than those on the current connection, or any intermediate mount points.
//
@@ -214,7 +217,7 @@
// connection that does not have the capability to read.
//
// The "`FILE_SIGNAL_`" values may be observed on this event.
- Event _zx.Event `fidl:"*" fidl2:"1"`
+ Event _zx.Event `fidl:"1" fidl2:"1"`
}
var _mFileObject = _bindings.CreateLazyMarshaler(FileObject{})
@@ -237,7 +240,7 @@
// The object is accompanied by a pipe.
type Pipe struct {
_ struct{} `fidl2:"s,4,4"`
- Socket _zx.Socket `fidl2:"0"`
+ Socket _zx.Socket `fidl:"0" fidl2:"0"`
}
var _mPipe = _bindings.CreateLazyMarshaler(Pipe{})
@@ -249,7 +252,7 @@
// The object is accompanied by a socket.
type Socket struct {
_ struct{} `fidl2:"s,4,4"`
- Socket _zx.Socket `fidl2:"0"`
+ Socket _zx.Socket `fidl:"0" fidl2:"0"`
}
var _mSocket = _bindings.CreateLazyMarshaler(Socket{})
@@ -265,7 +268,7 @@
type Vmofile struct {
_ struct{} `fidl2:"s,24,8"`
// The VMO which backs this file.
- Vmo _zx.VMO `fidl2:"0"`
+ Vmo _zx.VMO `fidl:"0" fidl2:"0"`
// The index into `vmo` which represents the first byte of the file.
Offset uint64
// The number of bytes, starting at `offset`, which may be used to represent this file.
@@ -284,7 +287,7 @@
// An optional event which transmits information about a device's state.
//
// The "`DEVICE_SIGNAL_`" values may be observed on this event.
- Event _zx.Handle `fidl:"*" fidl2:"1"`
+ Event _zx.Handle `fidl:"1" fidl2:"1"`
}
var _mDevice = _bindings.CreateLazyMarshaler(Device{})
@@ -296,7 +299,7 @@
// The object may be cast to interface 'Tty'
type Tty struct {
_ struct{} `fidl2:"s,4,4"`
- Event _zx.Handle `fidl:"*" fidl2:"1"`
+ Event _zx.Handle `fidl:"1" fidl2:"1"`
}
var _mTty = _bindings.CreateLazyMarshaler(Tty{})
@@ -376,10 +379,10 @@
return _mFilesystemInfo
}
-type NodeInfoTag uint32
+type I_nodeInfoTag uint32
const (
- _ NodeInfoTag = iota
+ _ I_nodeInfoTag = iota
NodeInfoService
NodeInfoFile
NodeInfoDirectory
@@ -395,61 +398,109 @@
//
// Refer to `Node::Describe()` and `Node::OnOpen()` for usage.
type NodeInfo struct {
- NodeInfoTag `fidl:"tag" fidl2:"u,32,8"`
- Service Service
- File FileObject
- Directory DirectoryObject
- Pipe Pipe
- Vmofile Vmofile
- Device Device
- Tty Tty
- Socket Socket
+ I_nodeInfoTag `fidl:"tag" fidl2:"u,32,8"`
+ Service Service
+ File FileObject
+ Directory DirectoryObject
+ Pipe Pipe
+ Vmofile Vmofile
+ Device Device
+ Tty Tty
+ Socket Socket
}
-func (u *NodeInfo) Which() NodeInfoTag {
- return u.NodeInfoTag
+func (u *NodeInfo) Which() I_nodeInfoTag {
+ return u.I_nodeInfoTag
}
func (u *NodeInfo) SetService(service Service) {
- u.NodeInfoTag = NodeInfoService
+ u.I_nodeInfoTag = NodeInfoService
u.Service = service
}
+func NodeInfoWithService(service Service) NodeInfo {
+ var _u NodeInfo
+ _u.SetService(service)
+ return _u
+}
+
func (u *NodeInfo) SetFile(file FileObject) {
- u.NodeInfoTag = NodeInfoFile
+ u.I_nodeInfoTag = NodeInfoFile
u.File = file
}
+func NodeInfoWithFile(file FileObject) NodeInfo {
+ var _u NodeInfo
+ _u.SetFile(file)
+ return _u
+}
+
func (u *NodeInfo) SetDirectory(directory DirectoryObject) {
- u.NodeInfoTag = NodeInfoDirectory
+ u.I_nodeInfoTag = NodeInfoDirectory
u.Directory = directory
}
+func NodeInfoWithDirectory(directory DirectoryObject) NodeInfo {
+ var _u NodeInfo
+ _u.SetDirectory(directory)
+ return _u
+}
+
func (u *NodeInfo) SetPipe(pipe Pipe) {
- u.NodeInfoTag = NodeInfoPipe
+ u.I_nodeInfoTag = NodeInfoPipe
u.Pipe = pipe
}
+func NodeInfoWithPipe(pipe Pipe) NodeInfo {
+ var _u NodeInfo
+ _u.SetPipe(pipe)
+ return _u
+}
+
func (u *NodeInfo) SetVmofile(vmofile Vmofile) {
- u.NodeInfoTag = NodeInfoVmofile
+ u.I_nodeInfoTag = NodeInfoVmofile
u.Vmofile = vmofile
}
+func NodeInfoWithVmofile(vmofile Vmofile) NodeInfo {
+ var _u NodeInfo
+ _u.SetVmofile(vmofile)
+ return _u
+}
+
func (u *NodeInfo) SetDevice(device Device) {
- u.NodeInfoTag = NodeInfoDevice
+ u.I_nodeInfoTag = NodeInfoDevice
u.Device = device
}
+func NodeInfoWithDevice(device Device) NodeInfo {
+ var _u NodeInfo
+ _u.SetDevice(device)
+ return _u
+}
+
func (u *NodeInfo) SetTty(tty Tty) {
- u.NodeInfoTag = NodeInfoTty
+ u.I_nodeInfoTag = NodeInfoTty
u.Tty = tty
}
+func NodeInfoWithTty(tty Tty) NodeInfo {
+ var _u NodeInfo
+ _u.SetTty(tty)
+ return _u
+}
+
func (u *NodeInfo) SetSocket(socket Socket) {
- u.NodeInfoTag = NodeInfoSocket
+ u.I_nodeInfoTag = NodeInfoSocket
u.Socket = socket
}
+func NodeInfoWithSocket(socket Socket) NodeInfo {
+ var _u NodeInfo
+ _u.SetSocket(socket)
+ return _u
+}
+
const (
NodeCloneOrdinal uint64 = 0x17fe6a4c00000000
NodeCloseOrdinal uint64 = 0x52b9568700000000
@@ -464,7 +515,7 @@
type nodeCloneRequest struct {
_ struct{} `fidl2:"s,8,0"`
Flags uint32
- Object NodeInterfaceRequest `fidl2:"0"`
+ Object NodeInterfaceRequest `fidl:"0" fidl2:"0"`
}
var _mnodeCloneRequest = _bindings.CreateLazyMarshaler(nodeCloneRequest{})
@@ -557,7 +608,7 @@
_ struct{} `fidl2:"s,48,0"`
Opcode uint32
MaxOut uint64
- Handles []_zx.Handle `fidl:"2" fidl2:"2,0"`
+ Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"`
In []uint8 `fidl:"8192" fidl2:"8192"`
}
@@ -570,7 +621,7 @@
type nodeIoctlResponse struct {
_ struct{} `fidl2:"s,40,0"`
S int32
- Handles []_zx.Handle `fidl:"2" fidl2:"2,0"`
+ Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"`
Out []uint8 `fidl:"8192" fidl2:"8192"`
}
@@ -849,7 +900,7 @@
type fileCloneRequest struct {
_ struct{} `fidl2:"s,8,0"`
Flags uint32
- Object NodeInterfaceRequest `fidl2:"0"`
+ Object NodeInterfaceRequest `fidl:"0" fidl2:"0"`
}
var _mfileCloneRequest = _bindings.CreateLazyMarshaler(fileCloneRequest{})
@@ -942,7 +993,7 @@
_ struct{} `fidl2:"s,48,0"`
Opcode uint32
MaxOut uint64
- Handles []_zx.Handle `fidl:"2" fidl2:"2,0"`
+ Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"`
In []uint8 `fidl:"8192" fidl2:"8192"`
}
@@ -955,7 +1006,7 @@
type fileIoctlResponse struct {
_ struct{} `fidl2:"s,40,0"`
S int32
- Handles []_zx.Handle `fidl:"2" fidl2:"2,0"`
+ Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"`
Out []uint8 `fidl:"8192" fidl2:"8192"`
}
@@ -1757,7 +1808,7 @@
type directoryCloneRequest struct {
_ struct{} `fidl2:"s,8,0"`
Flags uint32
- Object NodeInterfaceRequest `fidl2:"0"`
+ Object NodeInterfaceRequest `fidl:"0" fidl2:"0"`
}
var _mdirectoryCloneRequest = _bindings.CreateLazyMarshaler(directoryCloneRequest{})
@@ -1850,7 +1901,7 @@
_ struct{} `fidl2:"s,48,0"`
Opcode uint32
MaxOut uint64
- Handles []_zx.Handle `fidl:"2" fidl2:"2,0"`
+ Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"`
In []uint8 `fidl:"8192" fidl2:"8192"`
}
@@ -1863,7 +1914,7 @@
type directoryIoctlResponse struct {
_ struct{} `fidl2:"s,40,0"`
S int32
- Handles []_zx.Handle `fidl:"2" fidl2:"2,0"`
+ Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"`
Out []uint8 `fidl:"8192" fidl2:"8192"`
}
@@ -1878,7 +1929,7 @@
Flags uint32
Mode uint32
Path string `fidl:"4096" fidl2:"4096"`
- Object NodeInterfaceRequest `fidl2:"0"`
+ Object NodeInterfaceRequest `fidl:"0" fidl2:"0"`
}
var _mdirectoryOpenRequest = _bindings.CreateLazyMarshaler(directoryOpenRequest{})
@@ -1946,7 +1997,7 @@
type directoryGetTokenResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
- Token _zx.Handle `fidl:"*" fidl2:"1"`
+ Token _zx.Handle `fidl:"1" fidl2:"1"`
}
var _mdirectoryGetTokenResponse = _bindings.CreateLazyMarshaler(directoryGetTokenResponse{})
@@ -1958,7 +2009,7 @@
type directoryRenameRequest struct {
_ struct{} `fidl2:"s,40,0"`
Src string `fidl:"4096" fidl2:"4096"`
- DstParentToken _zx.Handle `fidl2:"0"`
+ DstParentToken _zx.Handle `fidl:"0" fidl2:"0"`
Dst string `fidl:"4096" fidl2:"4096"`
}
@@ -1982,7 +2033,7 @@
type directoryLinkRequest struct {
_ struct{} `fidl2:"s,40,0"`
Src string `fidl:"4096" fidl2:"4096"`
- DstParentToken _zx.Handle `fidl2:"0"`
+ DstParentToken _zx.Handle `fidl:"0" fidl2:"0"`
Dst string `fidl:"4096" fidl2:"4096"`
}
@@ -2007,7 +2058,7 @@
_ struct{} `fidl2:"s,16,0"`
Mask uint32
Options uint32
- Watcher _zx.Channel `fidl2:"0"`
+ Watcher _zx.Channel `fidl:"0" fidl2:"0"`
}
var _mdirectoryWatchRequest = _bindings.CreateLazyMarshaler(directoryWatchRequest{})
@@ -2671,7 +2722,7 @@
type directoryAdminCloneRequest struct {
_ struct{} `fidl2:"s,8,0"`
Flags uint32
- Object NodeInterfaceRequest `fidl2:"0"`
+ Object NodeInterfaceRequest `fidl:"0" fidl2:"0"`
}
var _mdirectoryAdminCloneRequest = _bindings.CreateLazyMarshaler(directoryAdminCloneRequest{})
@@ -2764,7 +2815,7 @@
_ struct{} `fidl2:"s,48,0"`
Opcode uint32
MaxOut uint64
- Handles []_zx.Handle `fidl:"2" fidl2:"2,0"`
+ Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"`
In []uint8 `fidl:"8192" fidl2:"8192"`
}
@@ -2777,7 +2828,7 @@
type directoryAdminIoctlResponse struct {
_ struct{} `fidl2:"s,40,0"`
S int32
- Handles []_zx.Handle `fidl:"2" fidl2:"2,0"`
+ Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"`
Out []uint8 `fidl:"8192" fidl2:"8192"`
}
@@ -2792,7 +2843,7 @@
Flags uint32
Mode uint32
Path string `fidl:"4096" fidl2:"4096"`
- Object NodeInterfaceRequest `fidl2:"0"`
+ Object NodeInterfaceRequest `fidl:"0" fidl2:"0"`
}
var _mdirectoryAdminOpenRequest = _bindings.CreateLazyMarshaler(directoryAdminOpenRequest{})
@@ -2860,7 +2911,7 @@
type directoryAdminGetTokenResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
- Token _zx.Handle `fidl:"*" fidl2:"1"`
+ Token _zx.Handle `fidl:"1" fidl2:"1"`
}
var _mdirectoryAdminGetTokenResponse = _bindings.CreateLazyMarshaler(directoryAdminGetTokenResponse{})
@@ -2872,7 +2923,7 @@
type directoryAdminRenameRequest struct {
_ struct{} `fidl2:"s,40,0"`
Src string `fidl:"4096" fidl2:"4096"`
- DstParentToken _zx.Handle `fidl2:"0"`
+ DstParentToken _zx.Handle `fidl:"0" fidl2:"0"`
Dst string `fidl:"4096" fidl2:"4096"`
}
@@ -2896,7 +2947,7 @@
type directoryAdminLinkRequest struct {
_ struct{} `fidl2:"s,40,0"`
Src string `fidl:"4096" fidl2:"4096"`
- DstParentToken _zx.Handle `fidl2:"0"`
+ DstParentToken _zx.Handle `fidl:"0" fidl2:"0"`
Dst string `fidl:"4096" fidl2:"4096"`
}
@@ -2921,7 +2972,7 @@
_ struct{} `fidl2:"s,16,0"`
Mask uint32
Options uint32
- Watcher _zx.Channel `fidl2:"0"`
+ Watcher _zx.Channel `fidl:"0" fidl2:"0"`
}
var _mdirectoryAdminWatchRequest = _bindings.CreateLazyMarshaler(directoryAdminWatchRequest{})
@@ -3001,7 +3052,7 @@
type directoryAdminUnmountNodeResponse struct {
_ struct{} `fidl2:"s,8,0"`
S int32
- Remote DirectoryInterface `fidl:"*"`
+ Remote DirectoryInterface
}
var _mdirectoryAdminUnmountNodeResponse = _bindings.CreateLazyMarshaler(directoryAdminUnmountNodeResponse{})
diff --git a/src/syscall/zx/mem/impl.go b/src/syscall/zx/mem/impl.go
index ea778f4..42df624 100644
--- a/src/syscall/zx/mem/impl.go
+++ b/src/syscall/zx/mem/impl.go
@@ -25,7 +25,7 @@
type Buffer struct {
_ struct{} `fidl2:"s,16,8"`
// The vmo that contains the buffer.
- Vmo _zx.VMO `fidl2:"0"`
+ Vmo _zx.VMO `fidl:"0" fidl2:"0"`
// The number of bytes in the buffer.
//
// The content of the buffer begin at the start of the VMO and continue
@@ -46,7 +46,7 @@
type Range struct {
_ struct{} `fidl2:"s,24,8"`
// The vmo that contains the bytes.
- Vmo _zx.VMO `fidl2:"0"`
+ Vmo _zx.VMO `fidl:"0" fidl2:"0"`
// The offset of the first byte within the range relative to the start of
// the VMO.
//
@@ -69,7 +69,7 @@
return _mRange
}
-type DataTag uint32
+type I_dataTag uint32
const (
Data_unknownData = 0 // 0x00000000
@@ -84,16 +84,16 @@
// `bytes`) but also need to support arbitrary amounts of data (i.e., which
// need to be provided out-of-line in a `Buffer`).
type Data struct {
- DataTag `fidl2:"x,24,8"`
+ I_dataTag `fidl2:"x,24,8"`
I_unknownData []byte
// The binary data provided inline in the message.
- Bytes []uint8 `fidl:",835814982" fidl2:"835814982,"`
+ Bytes []uint8 `fidl:"835814982," fidl2:"835814982,"`
// The binary data provided out-of-line in a `Buffer`.
Buffer Buffer `fidl:"1925873109" fidl2:"1925873109"`
}
-func (_m *Data) Which() DataTag {
- switch _m.DataTag {
+func (_m *Data) Which() I_dataTag {
+ switch _m.I_dataTag {
case 835814982:
return DataBytes
case 1925873109:
@@ -104,15 +104,27 @@
}
func (_m *Data) Ordinal() uint32 {
- return uint32(_m.DataTag)
+ return uint32(_m.I_dataTag)
}
func (_m *Data) SetBytes(bytes []uint8) {
- _m.DataTag = DataBytes
+ _m.I_dataTag = DataBytes
_m.Bytes = bytes
}
+func DataWithBytes(bytes []uint8) Data {
+ var _u Data
+ _u.SetBytes(bytes)
+ return _u
+}
+
func (_m *Data) SetBuffer(buffer Buffer) {
- _m.DataTag = DataBuffer
+ _m.I_dataTag = DataBuffer
_m.Buffer = buffer
}
+
+func DataWithBuffer(buffer Buffer) Data {
+ var _u Data
+ _u.SetBuffer(buffer)
+ return _u
+}
diff --git a/src/syscall/zx/net/impl.go b/src/syscall/zx/net/impl.go
index 313e750..904a721 100644
--- a/src/syscall/zx/net/impl.go
+++ b/src/syscall/zx/net/impl.go
@@ -39,7 +39,7 @@
type controlCloneRequest struct {
_ struct{} `fidl2:"s,8,0"`
Flags uint32
- Object fuchsiaio.NodeInterfaceRequest `fidl2:"0"`
+ Object fuchsiaio.NodeInterfaceRequest `fidl:"0" fidl2:"0"`
}
var _mcontrolCloneRequest = _bindings.CreateLazyMarshaler(controlCloneRequest{})
@@ -132,7 +132,7 @@
_ struct{} `fidl2:"s,48,0"`
Opcode uint32
MaxOut uint64
- Handles []_zx.Handle `fidl:"2" fidl2:"2,0"`
+ Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"`
In []uint8 `fidl:"8192" fidl2:"8192"`
}
@@ -145,7 +145,7 @@
type controlIoctlResponse struct {
_ struct{} `fidl2:"s,40,0"`
S int32
- Handles []_zx.Handle `fidl:"2" fidl2:"2,0"`
+ Handles []_zx.Handle `fidl:"2,0" fidl2:"2,0"`
Out []uint8 `fidl:"8192" fidl2:"8192"`
}
@@ -235,7 +235,7 @@
type controlAcceptResponse struct {
_ struct{} `fidl2:"s,8,0"`
Code int16
- S ControlInterface `fidl:"*"`
+ S ControlInterface
}
var _mcontrolAcceptResponse = _bindings.CreateLazyMarshaler(controlAcceptResponse{})
@@ -537,10 +537,15 @@
return resp_.Code, resp_.Out, err
}
-// The control plane for a network socket. Once a socket has been retrieved from a
-// `Provider`, this interface is then used to further configure and use the socket.
-// This interface is essentially POSIX. Its implementation must support Linux-specific arguments
-// to {Get,Set}SockOpt.
+// The control plane for a network socket.
+//
+// Once a socket has been retrieved from a `Provider`, this interface is then used to further
+// configure and use the socket. This interface is essentially POSIX. Its implementation must
+// support Linux-specific arguments to {Get,Set}SockOpt.
+//
+// *Warning:* This protocol is not yet ready for direct use by clients. Instead, clients should
+// use the BSD sockets API to interact with sockets. We plan to change this protocol substantially
+// and clients that couple directly to this protocol will make those changes more difficult.
type Control interface {
// Create another connection to the same remote object.
//
@@ -797,7 +802,7 @@
type providerSocketResponse struct {
_ struct{} `fidl2:"s,8,0"`
Code int16
- S ControlInterface `fidl:"*"`
+ S ControlInterface
}
var _mproviderSocketResponse = _bindings.CreateLazyMarshaler(providerSocketResponse{})