summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/gofer/handle.go
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2020-04-23 11:06:59 -0700
committergVisor bot <gvisor-bot@google.com>2020-04-23 11:08:24 -0700
commite0c67014cb2200ad58cd28b12fddb3f55652a21b (patch)
treeb318bfd35d4b35538531c980b795288718317b7d /pkg/sentry/fsimpl/gofer/handle.go
parent7d1b7daf7e89c99899fc46187bcb1f3a3bcab7fb (diff)
Factor fsimpl/gofer.host{Preadv,Pwritev} out of fsimpl/gofer.
Also fix returning EOF when 0 bytes are read. PiperOrigin-RevId: 308089875
Diffstat (limited to 'pkg/sentry/fsimpl/gofer/handle.go')
-rw-r--r--pkg/sentry/fsimpl/gofer/handle.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/sentry/fsimpl/gofer/handle.go b/pkg/sentry/fsimpl/gofer/handle.go
index cfe66f797..724a3f1f7 100644
--- a/pkg/sentry/fsimpl/gofer/handle.go
+++ b/pkg/sentry/fsimpl/gofer/handle.go
@@ -20,6 +20,7 @@ import (
"gvisor.dev/gvisor/pkg/context"
"gvisor.dev/gvisor/pkg/p9"
"gvisor.dev/gvisor/pkg/safemem"
+ "gvisor.dev/gvisor/pkg/sentry/hostfd"
)
// handle represents a remote "open file descriptor", consisting of an opened
@@ -77,7 +78,7 @@ func (h *handle) readToBlocksAt(ctx context.Context, dsts safemem.BlockSeq, offs
}
if h.fd >= 0 {
ctx.UninterruptibleSleepStart(false)
- n, err := hostPreadv(h.fd, dsts, int64(offset))
+ n, err := hostfd.Preadv2(h.fd, dsts, int64(offset), 0 /* flags */)
ctx.UninterruptibleSleepFinish(false)
return n, err
}
@@ -103,7 +104,7 @@ func (h *handle) writeFromBlocksAt(ctx context.Context, srcs safemem.BlockSeq, o
}
if h.fd >= 0 {
ctx.UninterruptibleSleepStart(false)
- n, err := hostPwritev(h.fd, srcs, int64(offset))
+ n, err := hostfd.Pwritev2(h.fd, srcs, int64(offset), 0 /* flags */)
ctx.UninterruptibleSleepFinish(false)
return n, err
}