From 18847f55bb3fe9db41e46a2e9e49a9f7c28143af Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 10 Feb 2020 14:45:20 +0100 Subject: pkg/ast: introduce hex-encoded string literals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stringnozescapes does not make sense with filename, also we may need similar escaping for string flags. Handle escaped strings on ast level instead. This avoids introducing new type and works seamleassly with flags. As alternative I've also tried using strconv.Quote/Unquote but it leads to ugly half-escaped strings: "\xb0\x80s\xe8\xd4N\x91\xe3ڒ,\"C\x82D\xbb\x88\\i\xe2i\xc8\xe9\xd85\xb1\x14):M\xdcn" Make hex-encoded strings a separate string format instead. --- sys/linux/gen/386.go | 28 +++++++++++++------------- sys/linux/gen/amd64.go | 28 +++++++++++++------------- sys/linux/gen/arm.go | 28 +++++++++++++------------- sys/linux/gen/arm64.go | 28 +++++++++++++------------- sys/linux/gen/mips64le.go | 28 +++++++++++++------------- sys/linux/gen/ppc64le.go | 28 +++++++++++++------------- sys/linux/socket_netlink_generic_wireguard.txt | 18 ++++++++--------- 7 files changed, 93 insertions(+), 93 deletions(-) (limited to 'sys/linux') diff --git a/sys/linux/gen/386.go b/sys/linux/gen/386.go index fd02f81d5..6fc8564d3 100644 --- a/sys/linux/gen/386.go +++ b/sys/linux/gen/386.go @@ -30537,7 +30537,7 @@ var structDescs_386 = []*KeyedStruct{ &BufferType{TypeCommon: TypeCommon{TypeName: "void", FldName: "size"}, Kind: 1}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 2}}, IsPad: true}, }, 4}}, - {StructKey{Name: "nlattr_t[const[WGDEVICE_A_PRIVATE_KEY, int16], wireguard_private_key]"}, &StructDesc{TypeCommon{TypeName: "nlattr_t[const[WGDEVICE_A_PRIVATE_KEY, int16], wireguard_private_key]", TypeSize: 132}, []Type{ + {StructKey{Name: "nlattr_t[const[WGDEVICE_A_PRIVATE_KEY, int16], wireguard_private_key]"}, &StructDesc{TypeCommon{TypeName: "nlattr_t[const[WGDEVICE_A_PRIVATE_KEY, int16], wireguard_private_key]", TypeSize: 36}, []Type{ &LenType{IntTypeCommon{TypeCommon: TypeCommon{TypeName: "offsetof", FldName: "nla_len", TypeSize: 2}}, 8, true, []string{"size"}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "nla_type", TypeSize: 2}}, Val: 3}, &UnionType{Key: StructKey{Name: "wireguard_private_key"}, FldName: "payload"}, @@ -30580,7 +30580,7 @@ var structDescs_386 = []*KeyedStruct{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "payload", TypeSize: 4}}, Val: 1}, &BufferType{TypeCommon: TypeCommon{TypeName: "void", FldName: "size"}, Kind: 1}, }, 4}}, - {StructKey{Name: "nlattr_t[const[WGPEER_A_PUBLIC_KEY, int16], wireguard_public_key]"}, &StructDesc{TypeCommon{TypeName: "nlattr_t[const[WGPEER_A_PUBLIC_KEY, int16], wireguard_public_key]", TypeSize: 132}, []Type{ + {StructKey{Name: "nlattr_t[const[WGPEER_A_PUBLIC_KEY, int16], wireguard_public_key]"}, &StructDesc{TypeCommon{TypeName: "nlattr_t[const[WGPEER_A_PUBLIC_KEY, int16], wireguard_public_key]", TypeSize: 36}, []Type{ &LenType{IntTypeCommon{TypeCommon: TypeCommon{TypeName: "offsetof", FldName: "nla_len", TypeSize: 2}}, 8, true, []string{"size"}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "nla_type", TypeSize: 2}}, Val: 1}, &UnionType{Key: StructKey{Name: "wireguard_public_key"}, FldName: "payload"}, @@ -45532,18 +45532,18 @@ var structDescs_386 = []*KeyedStruct{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "xpix", TypeSize: 2, ArgDir: 1}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "upix", TypeSize: 2, ArgDir: 1}}}, }}}, - {StructKey{Name: "wireguard_private_key"}, &StructDesc{TypeCommon: TypeCommon{TypeName: "wireguard_private_key", TypeSize: 128}, Fields: []Type{ - &BufferType{TypeCommon: TypeCommon{TypeName: "stringnozescapes", FldName: "zero", TypeSize: 128}, Kind: 2, Values: []string{"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"}, NoZ: true}, - &BufferType{TypeCommon: TypeCommon{TypeName: "stringnozescapes", FldName: "a", TypeSize: 128}, Kind: 2, Values: []string{"\xa0\\\xa8Ol\x9c\x8e8S\xe2\xfdzp\xae\x0f\xb2\x0f\xa1R`\f\xb0\bE\x17O\b\ao\x8dxC"}, NoZ: true}, - &BufferType{TypeCommon: TypeCommon{TypeName: "stringnozescapes", FldName: "b", TypeSize: 128}, Kind: 2, Values: []string{"\xb0\x80s\xe8\xd4N\x91\xe3ڒ,\"C\x82D\xbb\x88\\i\xe2i\xc8\xe9\xd85\xb1\x14):M\xdcn"}, NoZ: true}, - &BufferType{TypeCommon: TypeCommon{TypeName: "stringnozescapes", FldName: "c", TypeSize: 128}, Kind: 2, Values: []string{"\xa0ˇ\x9aG\xf5\xbcdL\x0ei?\xa6\xd01\xc7J\x15S\xb6\xe9\x01\xb9\xff/Q\x8cx\x04/\xb5B"}, NoZ: true}, + {StructKey{Name: "wireguard_private_key"}, &StructDesc{TypeCommon: TypeCommon{TypeName: "wireguard_private_key", TypeSize: 32}, Fields: []Type{ + &BufferType{TypeCommon: TypeCommon{TypeName: "stringnoz", FldName: "zero", TypeSize: 32}, Kind: 2, Values: []string{"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"}, NoZ: true}, + &BufferType{TypeCommon: TypeCommon{TypeName: "stringnoz", FldName: "a", TypeSize: 32}, Kind: 2, Values: []string{"\xa0\\\xa8Ol\x9c\x8e8S\xe2\xfdzp\xae\x0f\xb2\x0f\xa1R`\f\xb0\bE\x17O\b\ao\x8dxC"}, NoZ: true}, + &BufferType{TypeCommon: TypeCommon{TypeName: "stringnoz", FldName: "b", TypeSize: 32}, Kind: 2, Values: []string{"\xb0\x80s\xe8\xd4N\x91\xe3ڒ,\"C\x82D\xbb\x88\\i\xe2i\xc8\xe9\xd85\xb1\x14):M\xdcn"}, NoZ: true}, + &BufferType{TypeCommon: TypeCommon{TypeName: "stringnoz", FldName: "c", TypeSize: 32}, Kind: 2, Values: []string{"\xa0ˇ\x9aG\xf5\xbcdL\x0ei?\xa6\xd01\xc7J\x15S\xb6\xe9\x01\xb9\xff/Q\x8cx\x04/\xb5B"}, NoZ: true}, }}}, - {StructKey{Name: "wireguard_public_key"}, &StructDesc{TypeCommon: TypeCommon{TypeName: "wireguard_public_key", TypeSize: 128}, Fields: []Type{ - &BufferType{TypeCommon: TypeCommon{TypeName: "stringnozescapes", FldName: "zero", TypeSize: 128}, Kind: 2, Values: []string{"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"}, NoZ: true}, - &BufferType{TypeCommon: TypeCommon{TypeName: "stringnozescapes", FldName: "neg", TypeSize: 128}, Kind: 2, Values: []string{"\xdb\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"}, NoZ: true}, - &BufferType{TypeCommon: TypeCommon{TypeName: "stringnozescapes", FldName: "a_g", TypeSize: 128}, Kind: 2, Values: []string{"\x97\\\x9d\x81Ƀ\xc8 \x9e\xe7\x81%K\x89\x9f\x8e\xd9%\xae\x9f\t#\xc2