summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/vfs/testutil.go
diff options
context:
space:
mode:
authorJamie Liu <jamieliu@google.com>2019-12-11 13:40:57 -0800
committergVisor bot <gvisor-bot@google.com>2019-12-11 14:26:32 -0800
commit481dbfa5ab24ec2c0752b9e748d3617285603c4e (patch)
treecec1be5f8514b22987d965f7531051da1985d376 /pkg/sentry/vfs/testutil.go
parent0d027262e09184f61ea0707935534fc2fc4af7e7 (diff)
Add vfs.Pathname{WithDeleted,ForGetcwd}.
The former is needed for vfs.FileDescription to implement memmap.MappingIdentity, and the latter is needed to implement getcwd(2). PiperOrigin-RevId: 285051855
Diffstat (limited to 'pkg/sentry/vfs/testutil.go')
-rw-r--r--pkg/sentry/vfs/testutil.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/sentry/vfs/testutil.go b/pkg/sentry/vfs/testutil.go
index 593144cb7..7a1d9e383 100644
--- a/pkg/sentry/vfs/testutil.go
+++ b/pkg/sentry/vfs/testutil.go
@@ -15,7 +15,10 @@
package vfs
import (
+ "fmt"
+
"gvisor.dev/gvisor/pkg/abi/linux"
+ "gvisor.dev/gvisor/pkg/fspath"
"gvisor.dev/gvisor/pkg/sentry/context"
"gvisor.dev/gvisor/pkg/sentry/kernel/auth"
"gvisor.dev/gvisor/pkg/syserror"
@@ -114,6 +117,12 @@ func (fs *FDTestFilesystem) UnlinkAt(ctx context.Context, rp *ResolvingPath) err
return syserror.EPERM
}
+// PrependPath implements FilesystemImpl.PrependPath.
+func (fs *FDTestFilesystem) PrependPath(ctx context.Context, vfsroot, vd VirtualDentry, b *fspath.Builder) error {
+ b.PrependComponent(fmt.Sprintf("vfs.fdTestDentry:%p", vd.dentry.impl.(*fdTestDentry)))
+ return PrependPathSyntheticError{}
+}
+
type fdTestDentry struct {
vfsd Dentry
}