aboutsummaryrefslogtreecommitdiffstats
path: root/prog
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-03-21 12:18:36 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-03-21 12:18:36 +0100
commit7c62f718046a2204a35cfe8850f9006b686b1c22 (patch)
tree26f9cdda898f4cd455c585d741f67fb941ef4258 /prog
parent704259f6449a65324f92d2737a291da10fdac03f (diff)
sys/linux: add netlink fou descriptions
Diffstat (limited to 'prog')
-rw-r--r--prog/any.go7
-rw-r--r--prog/resources.go4
2 files changed, 10 insertions, 1 deletions
diff --git a/prog/any.go b/prog/any.go
index d20e56129..92e466280 100644
--- a/prog/any.go
+++ b/prog/any.go
@@ -10,18 +10,21 @@ type anyTypes struct {
blob *BufferType
ptrPtr *PtrType
ptr64 *PtrType
+ res16 *ResourceType
res32 *ResourceType
res64 *ResourceType
}
// This generates type descriptions for:
//
+// resource ANYRES16[int16]: 0xffffffffffffffff, 0
// resource ANYRES32[int32]: 0xffffffffffffffff, 0
// resource ANYRES64[int64]: 0xffffffffffffffff, 0
// ANY [
// bin array[int8]
// ptr ptr[in, array[ANY], opt]
// ptr64 ptr64[in, array[ANY], opt]
+// res16 ANYRES16
// res32 ANYRES32
// res64 ANYRES64
// ] [varlen]
@@ -86,6 +89,7 @@ func initAnyTypes(target *Target) {
},
}
}
+ target.any.res16 = createResource("ANYRES16", "int16", 2)
target.any.res32 = createResource("ANYRES32", "int32", 4)
target.any.res64 = createResource("ANYRES64", "int64", 8)
target.any.union.StructDesc = &StructDesc{
@@ -99,6 +103,7 @@ func initAnyTypes(target *Target) {
target.any.blob,
target.any.ptrPtr,
target.any.ptr64,
+ target.any.res16,
target.any.res32,
target.any.res64,
},
@@ -227,6 +232,8 @@ func (target *Target) squashPtrImpl(a Arg, elems *[]Arg) {
}
case *ResultArg:
switch arg.Size() {
+ case 2:
+ arg.typ = target.any.res16
case 4:
arg.typ = target.any.res32
case 8:
diff --git a/prog/resources.go b/prog/resources.go
index 299e8571c..e6ef080cd 100644
--- a/prog/resources.go
+++ b/prog/resources.go
@@ -33,7 +33,9 @@ func (target *Target) calcResourceCtors(kind []string, precise bool) []*Syscall
// isCompatibleResource returns true if resource of kind src can be passed as an argument of kind dst.
func (target *Target) isCompatibleResource(dst, src string) bool {
- if dst == target.any.res32.TypeName || dst == target.any.res64.TypeName {
+ if dst == target.any.res16.TypeName ||
+ dst == target.any.res32.TypeName ||
+ dst == target.any.res64.TypeName {
return true
}
dstRes := target.resourceMap[dst]