diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-05-03 15:24:13 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-05-03 15:12:45 +0000 |
| commit | 3a81775029176dd4c693542e6715b985fa7ade4d (patch) | |
| tree | 8b6558acff0249792c4be3b26a018f70dbd4535d /pkg/vminfo | |
| parent | 3ff099b95730725adf7e5a1fae1a1463a3647a3d (diff) | |
pkg/host: remove FileInfo
Switch to flatrpc.FileInfoT instead.
In preparation for pkg/host removal and to avoid
circular dependencies in future changes.
Diffstat (limited to 'pkg/vminfo')
| -rw-r--r-- | pkg/vminfo/linux_test.go | 6 | ||||
| -rw-r--r-- | pkg/vminfo/syscalls.go | 4 | ||||
| -rw-r--r-- | pkg/vminfo/vminfo.go | 10 | ||||
| -rw-r--r-- | pkg/vminfo/vminfo_test.go | 3 |
4 files changed, 12 insertions, 11 deletions
diff --git a/pkg/vminfo/linux_test.go b/pkg/vminfo/linux_test.go index 63a352924..1573a4c78 100644 --- a/pkg/vminfo/linux_test.go +++ b/pkg/vminfo/linux_test.go @@ -13,7 +13,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/syzkaller/pkg/host" + "github.com/google/syzkaller/pkg/flatrpc" "github.com/google/syzkaller/pkg/ipc" "github.com/google/syzkaller/pkg/rpctype" "github.com/google/syzkaller/sys/targets" @@ -35,7 +35,7 @@ func TestLinuxSyscalls(t *testing.T) { "minix", "adfs", "ufs", "sysv", "reiserfs", "ocfs2", "nilfs2", "iso9660", "hpfs", "binder", "bcachefs", "", } - files := []host.FileInfo{ + files := []flatrpc.FileInfoT{ { Name: "/proc/version", Exists: true, @@ -128,7 +128,7 @@ func TestCannedCPUInfoLinux(t *testing.T) { } for i, test := range tests { t.Run(fmt.Sprint(i), func(t *testing.T) { - files := createVirtualFilesystem([]host.FileInfo{{ + files := createVirtualFilesystem([]flatrpc.FileInfoT{{ Name: "/proc/cpuinfo", Exists: true, Data: []byte(test.data), diff --git a/pkg/vminfo/syscalls.go b/pkg/vminfo/syscalls.go index 060215eef..6f62be251 100644 --- a/pkg/vminfo/syscalls.go +++ b/pkg/vminfo/syscalls.go @@ -11,8 +11,8 @@ import ( "strings" "syscall" + "github.com/google/syzkaller/pkg/flatrpc" "github.com/google/syzkaller/pkg/hash" - "github.com/google/syzkaller/pkg/host" "github.com/google/syzkaller/pkg/ipc" "github.com/google/syzkaller/pkg/mgrconfig" "github.com/google/syzkaller/pkg/rpctype" @@ -148,7 +148,7 @@ func (ctx *checkContext) startCheck() []rpctype.ExecutionRequest { return progs } -func (ctx *checkContext) finishCheck(fileInfos []host.FileInfo, progs []rpctype.ExecutionResult) ( +func (ctx *checkContext) finishCheck(fileInfos []flatrpc.FileInfoT, progs []rpctype.ExecutionResult) ( map[*prog.Syscall]bool, map[*prog.Syscall]string, error) { ctx.fs = createVirtualFilesystem(fileInfos) for i := range progs { diff --git a/pkg/vminfo/vminfo.go b/pkg/vminfo/vminfo.go index eae8ae4a3..5ede174f7 100644 --- a/pkg/vminfo/vminfo.go +++ b/pkg/vminfo/vminfo.go @@ -22,7 +22,7 @@ import ( "strings" "github.com/google/syzkaller/pkg/cover" - "github.com/google/syzkaller/pkg/host" + "github.com/google/syzkaller/pkg/flatrpc" "github.com/google/syzkaller/pkg/mgrconfig" "github.com/google/syzkaller/pkg/rpctype" "github.com/google/syzkaller/prog" @@ -48,7 +48,7 @@ func New(cfg *mgrconfig.Config) *Checker { } } -func (checker *Checker) MachineInfo(fileInfos []host.FileInfo) ([]cover.KernelModule, []byte, error) { +func (checker *Checker) MachineInfo(fileInfos []flatrpc.FileInfoT) ([]cover.KernelModule, []byte, error) { files := createVirtualFilesystem(fileInfos) modules, err := checker.parseModules(files) if err != nil { @@ -77,7 +77,7 @@ func (checker *Checker) StartCheck() ([]string, []rpctype.ExecutionRequest) { return checker.checkFiles(), checker.checkContext.startCheck() } -func (checker *Checker) FinishCheck(files []host.FileInfo, progs []rpctype.ExecutionResult) ( +func (checker *Checker) FinishCheck(files []flatrpc.FileInfoT, progs []rpctype.ExecutionResult) ( map[*prog.Syscall]bool, map[*prog.Syscall]string, error) { ctx := checker.checkContext checker.checkContext = nil @@ -94,9 +94,9 @@ type checker interface { syscallCheck(*checkContext, *prog.Syscall) string } -type filesystem map[string]host.FileInfo +type filesystem map[string]flatrpc.FileInfoT -func createVirtualFilesystem(fileInfos []host.FileInfo) filesystem { +func createVirtualFilesystem(fileInfos []flatrpc.FileInfoT) filesystem { files := make(filesystem) for _, file := range fileInfos { if file.Exists { diff --git a/pkg/vminfo/vminfo_test.go b/pkg/vminfo/vminfo_test.go index 9ffb0dd31..52ddca22e 100644 --- a/pkg/vminfo/vminfo_test.go +++ b/pkg/vminfo/vminfo_test.go @@ -8,6 +8,7 @@ import ( "strings" "testing" + "github.com/google/syzkaller/pkg/flatrpc" "github.com/google/syzkaller/pkg/host" "github.com/google/syzkaller/pkg/ipc" "github.com/google/syzkaller/pkg/mgrconfig" @@ -41,7 +42,7 @@ func TestHostMachineInfo(t *testing.T) { } } -func hostChecker(t *testing.T) (*Checker, []host.FileInfo) { +func hostChecker(t *testing.T) (*Checker, []flatrpc.FileInfoT) { cfg := testConfig(t, runtime.GOOS, runtime.GOARCH) checker := New(cfg) files := host.ReadFiles(checker.RequiredFiles()) |
