diff options
author | Zach Koopmans <zkoopmans@google.com> | 2020-07-01 13:13:04 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-07-01 13:14:44 -0700 |
commit | 6a90c88b97481a6d81b05f09d5c8ed7158225dd5 (patch) | |
tree | e22db333e636d2dae96bcbf4f36d48eb81df3d0d /pkg/sentry/fsimpl/host | |
parent | 68e1c870d3ef5db71226927aee703f2fba61cab7 (diff) |
Port fallocate to VFS2.
PiperOrigin-RevId: 319283715
Diffstat (limited to 'pkg/sentry/fsimpl/host')
-rw-r--r-- | pkg/sentry/fsimpl/host/host.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/sentry/fsimpl/host/host.go b/pkg/sentry/fsimpl/host/host.go index d5e73ddae..007b3332e 100644 --- a/pkg/sentry/fsimpl/host/host.go +++ b/pkg/sentry/fsimpl/host/host.go @@ -543,6 +543,16 @@ func (f *fileDescription) Release() { // noop } +// Allocate implements vfs.FileDescriptionImpl. +func (f *fileDescription) Allocate(ctx context.Context, mode, offset, length uint64) error { + if !f.inode.seekable { + return syserror.ESPIPE + } + + // TODO(gvisor.dev/issue/2923): Implement Allocate for non-pipe hostfds. + return syserror.EOPNOTSUPP +} + // PRead implements FileDescriptionImpl. func (f *fileDescription) PRead(ctx context.Context, dst usermem.IOSequence, offset int64, opts vfs.ReadOptions) (int64, error) { i := f.inode |