aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-05-03 15:24:13 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-05-03 15:12:45 +0000
commit3a81775029176dd4c693542e6715b985fa7ade4d (patch)
tree8b6558acff0249792c4be3b26a018f70dbd4535d /pkg/host
parent3ff099b95730725adf7e5a1fae1a1463a3647a3d (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/host')
-rw-r--r--pkg/host/machine_info.go19
1 files changed, 7 insertions, 12 deletions
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,