From 95871dcc45f6531b4c692ff892aad56bdd95e16f Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 10 Feb 2023 12:14:36 +0100 Subject: pkg/subsystem: restructure the package Remove the entity and match subpackages. Regenerate the linux.go file. --- pkg/subsystem/raw_extractor.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'pkg/subsystem/raw_extractor.go') diff --git a/pkg/subsystem/raw_extractor.go b/pkg/subsystem/raw_extractor.go index 4a86b1f6b..fa964fd25 100644 --- a/pkg/subsystem/raw_extractor.go +++ b/pkg/subsystem/raw_extractor.go @@ -4,21 +4,19 @@ package subsystem import ( - "github.com/google/syzkaller/pkg/subsystem/entity" - "github.com/google/syzkaller/pkg/subsystem/match" "github.com/google/syzkaller/prog" ) // rawExtractor performs low-level subsystem matching (directly by a path or a syscall). type rawExtractor struct { - matcher *match.PathMatcher - perCall map[string][]*entity.Subsystem + matcher *PathMatcher + perCall map[string][]*Subsystem } -func makeRawExtractor(list []*entity.Subsystem) *rawExtractor { +func makeRawExtractor(list []*Subsystem) *rawExtractor { ret := &rawExtractor{ - matcher: match.MakePathMatcher(list), - perCall: make(map[string][]*entity.Subsystem), + matcher: MakePathMatcher(list), + perCall: make(map[string][]*Subsystem), } for _, subsystem := range list { for _, call := range subsystem.Syscalls { @@ -28,19 +26,19 @@ func makeRawExtractor(list []*entity.Subsystem) *rawExtractor { return ret } -func (e *rawExtractor) FromPath(path string) []*entity.Subsystem { +func (e *rawExtractor) FromPath(path string) []*Subsystem { return e.matcher.Match(path) } -func (e *rawExtractor) FromProg(progBytes []byte) []*entity.Subsystem { - calls := make(map[*entity.Subsystem]struct{}) +func (e *rawExtractor) FromProg(progBytes []byte) []*Subsystem { + calls := make(map[*Subsystem]struct{}) progCalls, _, _ := prog.CallSet(progBytes) for call := range progCalls { for _, subsystem := range e.perCall[call] { calls[subsystem] = struct{}{} } } - list := []*entity.Subsystem{} + list := []*Subsystem{} for key := range calls { list = append(list, key) } -- cgit mrf-deployment