From a72ab0ee0af4b1d0d401c09436e1e9ff04bc46e6 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 4 Sep 2024 17:24:25 +0200 Subject: pkg/manager: move coverage filter code out of syz-manager This will enable the reuse of the functionality elsewhere. --- pkg/mgrconfig/config.go | 4 ++-- pkg/mgrconfig/load.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'pkg/mgrconfig') diff --git a/pkg/mgrconfig/config.go b/pkg/mgrconfig/config.go index 2ea0d8ad9..f4857e613 100644 --- a/pkg/mgrconfig/config.go +++ b/pkg/mgrconfig/config.go @@ -152,7 +152,7 @@ type Config struct { // "pcs": specify raw PC table files name. // Each line of the file should be: "64-bit-pc:32-bit-weight\n". // eg. "0xffffffff81000000:0x10\n" - CovFilter covFilterCfg `json:"cover_filter,omitempty"` + CovFilter CovFilterCfg `json:"cover_filter,omitempty"` // For each prog in the corpus, remember the raw array of PCs obtained from the kernel. // It can be useful for debugging syzkaller descriptions and syzkaller itself. @@ -242,7 +242,7 @@ type Subsystem struct { Paths []string `json:"path"` } -type covFilterCfg struct { +type CovFilterCfg struct { Files []string `json:"files,omitempty"` Functions []string `json:"functions,omitempty"` RawPCs []string `json:"pcs,omitempty"` diff --git a/pkg/mgrconfig/load.go b/pkg/mgrconfig/load.go index aa22b3ea8..76a0bcf14 100644 --- a/pkg/mgrconfig/load.go +++ b/pkg/mgrconfig/load.go @@ -260,8 +260,8 @@ func checkNonEmpty(fields ...string) error { return nil } -func (cfg *Config) HasCovFilter() bool { - return len(cfg.CovFilter.Functions)+len(cfg.CovFilter.Files)+len(cfg.CovFilter.RawPCs) != 0 +func (cov *CovFilterCfg) Empty() bool { + return len(cov.Functions)+len(cov.Files)+len(cov.RawPCs) == 0 } func (cfg *Config) CompleteKernelDirs() { -- cgit mrf-deployment