From 3a81775029176dd4c693542e6715b985fa7ade4d Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 3 May 2024 15:24:13 +0200 Subject: pkg/host: remove FileInfo Switch to flatrpc.FileInfoT instead. In preparation for pkg/host removal and to avoid circular dependencies in future changes. --- pkg/host/machine_info.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'pkg/host') diff --git a/pkg/host/machine_info.go b/pkg/host/machine_info.go index ee344dd0b..476205255 100644 --- a/pkg/host/machine_info.go +++ b/pkg/host/machine_info.go @@ -7,17 +7,12 @@ import ( "os" "path/filepath" "strings" -) -type FileInfo struct { - Name string - Exists bool - Error string - Data []byte -} + "github.com/google/syzkaller/pkg/flatrpc" +) -func ReadFiles(files []string) []FileInfo { - var res []FileInfo +func ReadFiles(files []string) []flatrpc.FileInfoT { + var res []flatrpc.FileInfoT for _, glob := range files { glob = filepath.FromSlash(glob) if !strings.Contains(glob, "*") { @@ -26,7 +21,7 @@ func ReadFiles(files []string) []FileInfo { } matches, err := filepath.Glob(glob) if err != nil { - res = append(res, FileInfo{ + res = append(res, flatrpc.FileInfoT{ Name: glob, Error: err.Error(), }) @@ -39,13 +34,13 @@ func ReadFiles(files []string) []FileInfo { return res } -func readFile(file string) FileInfo { +func readFile(file string) flatrpc.FileInfoT { data, err := os.ReadFile(file) exists, errStr := true, "" if err != nil { exists, errStr = !os.IsNotExist(err), err.Error() } - return FileInfo{ + return flatrpc.FileInfoT{ Name: file, Exists: exists, Error: errStr, -- cgit mrf-deployment