diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2019-07-24 16:02:07 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-07-24 16:03:30 -0700 |
commit | 2ed832ff86ee29970d0a3991297de818bda67b9c (patch) | |
tree | 09908e3db91dabe713b1e871ec94e2f45fbcc42f /pkg/sentry/fs/ext/dentry.go | |
parent | 40e682759fd68bf94d324cef584c5e9288acb049 (diff) |
ext: testing environment setup with VFS2 support.
PiperOrigin-RevId: 259835948
Diffstat (limited to 'pkg/sentry/fs/ext/dentry.go')
-rw-r--r-- | pkg/sentry/fs/ext/dentry.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pkg/sentry/fs/ext/dentry.go b/pkg/sentry/fs/ext/dentry.go index 71cd217df..07be99a84 100644 --- a/pkg/sentry/fs/ext/dentry.go +++ b/pkg/sentry/fs/ext/dentry.go @@ -14,10 +14,34 @@ package ext +import ( + "gvisor.dev/gvisor/pkg/sentry/vfs" +) + // dentry implements vfs.DentryImpl. type dentry struct { + vfsd vfs.Dentry + // inode is the inode represented by this dentry. Multiple Dentries may // share a single non-directory Inode (with hard links). inode is // immutable. inode *inode } + +// Compiles only if dentry implements vfs.DentryImpl. +var _ vfs.DentryImpl = (*dentry)(nil) + +// IncRef implements vfs.DentryImpl.IncRef. +func (d *dentry) IncRef(vfsfs *vfs.Filesystem) { + d.inode.incRef() +} + +// TryIncRef implements vfs.DentryImpl.TryIncRef. +func (d *dentry) TryIncRef(vfsfs *vfs.Filesystem) bool { + return d.inode.tryIncRef() +} + +// DecRef implements vfs.DentryImpl.DecRef. +func (d *dentry) DecRef(vfsfs *vfs.Filesystem) { + d.inode.decRef(vfsfs.Impl().(*filesystem)) +} |