diff options
Diffstat (limited to 'pkg/subsystem/extractor.go')
| -rw-r--r-- | pkg/subsystem/extractor.go | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/pkg/subsystem/extractor.go b/pkg/subsystem/extractor.go index e54086b29..075c8079d 100644 --- a/pkg/subsystem/extractor.go +++ b/pkg/subsystem/extractor.go @@ -3,10 +3,6 @@ package subsystem -import ( - "github.com/google/syzkaller/pkg/subsystem/entity" -) - // Extractor deduces the subsystems from the list of crashes. type Extractor struct { raw rawExtractorInterface @@ -21,17 +17,17 @@ type Crash struct { // rawExtractorInterface simplifies testing. type rawExtractorInterface interface { - FromPath(path string) []*entity.Subsystem - FromProg(progBytes []byte) []*entity.Subsystem + FromPath(path string) []*Subsystem + FromProg(progBytes []byte) []*Subsystem } -func MakeExtractor(list []*entity.Subsystem) *Extractor { +func MakeExtractor(list []*Subsystem) *Extractor { return &Extractor{raw: makeRawExtractor(list)} } -func (e *Extractor) Extract(crashes []*Crash) []*entity.Subsystem { +func (e *Extractor) Extract(crashes []*Crash) []*Subsystem { // First put all subsystems to the same list. - subsystems := []*entity.Subsystem{} + subsystems := []*Subsystem{} for _, crash := range crashes { if crash.GuiltyPath != "" { subsystems = append(subsystems, e.raw.FromPath(crash.GuiltyPath)...) @@ -42,7 +38,7 @@ func (e *Extractor) Extract(crashes []*Crash) []*entity.Subsystem { } // If there are both parents and children, remove parents. - ignore := make(map[*entity.Subsystem]struct{}) + ignore := make(map[*Subsystem]struct{}) for _, entry := range subsystems { for p := range entry.ReachableParents() { ignore[p] = struct{}{} @@ -50,7 +46,7 @@ func (e *Extractor) Extract(crashes []*Crash) []*entity.Subsystem { } // And calculate counts. - counts := make(map[*entity.Subsystem]int) + counts := make(map[*Subsystem]int) maxCount := 0 for _, entry := range subsystems { if _, ok := ignore[entry]; ok { @@ -63,7 +59,7 @@ func (e *Extractor) Extract(crashes []*Crash) []*entity.Subsystem { } // Pick the most prevalent ones. - ret := []*entity.Subsystem{} + ret := []*Subsystem{} for entry, count := range counts { if count < maxCount { continue |
