diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-09-05 10:46:34 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-09-05 10:46:34 +0200 |
| commit | 4fc47026945ebec3fc81d0c897547670034cfb58 (patch) | |
| tree | 11dcd72219d389aebffaaa593b13d4f2caeadf27 /prog/size.go | |
| parent | 5db39ab95395b60c5629a84812086f720adc9ccf (diff) | |
prog: dot-import sys
In preparation for moving sys types to prog to reduce later diffs.
Diffstat (limited to 'prog/size.go')
| -rw-r--r-- | prog/size.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/prog/size.go b/prog/size.go index 11f7cf835..b715f6f26 100644 --- a/prog/size.go +++ b/prog/size.go @@ -6,20 +6,20 @@ package prog import ( "fmt" - "github.com/google/syzkaller/sys" + . "github.com/google/syzkaller/sys" ) -func generateSize(arg Arg, lenType *sys.LenType) Arg { +func generateSize(arg Arg, lenType *LenType) Arg { if arg == nil { // Arg is an optional pointer, set size to 0. return constArg(lenType, 0) } switch arg.Type().(type) { - case *sys.VmaType: + case *VmaType: a := arg.(*PointerArg) return constArg(lenType, a.PagesNum*pageSize) - case *sys.ArrayType: + case *ArrayType: a := arg.(*GroupArg) if lenType.ByteSize != 0 { return constArg(lenType, a.Size()/lenType.ByteSize) @@ -39,7 +39,7 @@ func assignSizes(args []Arg, parentsMap map[Arg]Arg) { // Create a map from field names to args. argsMap := make(map[string]Arg) for _, arg := range args { - if sys.IsPad(arg.Type()) { + if IsPad(arg.Type()) { continue } argsMap[arg.Type().FieldName()] = arg @@ -50,7 +50,7 @@ func assignSizes(args []Arg, parentsMap map[Arg]Arg) { if arg = InnerArg(arg); arg == nil { continue // Pointer to optional len field, no need to fill in value. } - if typ, ok := arg.Type().(*sys.LenType); ok { + if typ, ok := arg.Type().(*LenType); ok { a := arg.(*ConstArg) buf, ok := argsMap[typ.Buf] @@ -91,7 +91,7 @@ func assignSizes(args []Arg, parentsMap map[Arg]Arg) { func assignSizesArray(args []Arg) { parentsMap := make(map[Arg]Arg) foreachArgArray(&args, nil, func(arg, base Arg, _ *[]Arg) { - if _, ok := arg.Type().(*sys.StructType); ok { + if _, ok := arg.Type().(*StructType); ok { for _, field := range arg.(*GroupArg).Inner { parentsMap[InnerArg(field)] = arg } @@ -99,7 +99,7 @@ func assignSizesArray(args []Arg) { }) assignSizes(args, parentsMap) foreachArgArray(&args, nil, func(arg, base Arg, _ *[]Arg) { - if _, ok := arg.Type().(*sys.StructType); ok { + if _, ok := arg.Type().(*StructType); ok { assignSizes(arg.(*GroupArg).Inner, parentsMap) } }) |
