summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/ext/utils.go
diff options
context:
space:
mode:
authorAyush Ranjan <ayushranjan@google.com>2020-09-30 12:37:17 -0700
committergVisor bot <gvisor-bot@google.com>2020-09-30 12:39:25 -0700
commit3e450a991b844a6b45fc57e59bfb0030ba0d0f4c (patch)
tree1f49f4d58a3fc190b5b8d0291588470cf3d76b6e /pkg/sentry/fsimpl/ext/utils.go
parentb49a17fc3d33068a1235d97efd8cc8bc9f0f3ccf (diff)
[go-marshal] Port ext codebase to use go marshal.
PiperOrigin-RevId: 334656292
Diffstat (limited to 'pkg/sentry/fsimpl/ext/utils.go')
-rw-r--r--pkg/sentry/fsimpl/ext/utils.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/sentry/fsimpl/ext/utils.go b/pkg/sentry/fsimpl/ext/utils.go
index d8b728f8c..58ef7b9b8 100644
--- a/pkg/sentry/fsimpl/ext/utils.go
+++ b/pkg/sentry/fsimpl/ext/utils.go
@@ -17,21 +17,21 @@ package ext
import (
"io"
- "gvisor.dev/gvisor/pkg/binary"
+ "gvisor.dev/gvisor/pkg/marshal"
"gvisor.dev/gvisor/pkg/sentry/fsimpl/ext/disklayout"
"gvisor.dev/gvisor/pkg/syserror"
)
// readFromDisk performs a binary read from disk into the given struct from
// the absolute offset provided.
-func readFromDisk(dev io.ReaderAt, abOff int64, v interface{}) error {
- n := binary.Size(v)
+func readFromDisk(dev io.ReaderAt, abOff int64, v marshal.Marshallable) error {
+ n := v.SizeBytes()
buf := make([]byte, n)
if read, _ := dev.ReadAt(buf, abOff); read < int(n) {
return syserror.EIO
}
- binary.Unmarshal(buf, binary.LittleEndian, v)
+ v.UnmarshalBytes(buf)
return nil
}