summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-02-14 13:39:51 -0800
committergVisor bot <gvisor-bot@google.com>2020-02-14 13:40:39 -0800
commite4c7f3e6f6c19f3259820a4c41b69e85c0454379 (patch)
treec63b9ac4d97a715a226feba4fbbd5cab03bb6743 /pkg/sentry/kernel
parent50c493193b72997a6b09f353fd9217349941c494 (diff)
Inline vfs.VirtualFilesystem in Kernel struct
This saves one pointer dereference per VFS access. Updates #1623 PiperOrigin-RevId: 295216176
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r--pkg/sentry/kernel/kernel.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/sentry/kernel/kernel.go b/pkg/sentry/kernel/kernel.go
index 2665f057c..ea21af33f 100644
--- a/pkg/sentry/kernel/kernel.go
+++ b/pkg/sentry/kernel/kernel.go
@@ -246,7 +246,7 @@ type Kernel struct {
SpecialOpts
// VFS keeps the filesystem state used across the kernel.
- VFS *vfs.VirtualFilesystem
+ vfs vfs.VirtualFilesystem
}
// InitKernelArgs holds arguments to Init.
@@ -815,7 +815,7 @@ func (k *Kernel) CreateProcess(args CreateProcessArgs) (*ThreadGroup, ThreadID,
FollowFinalSymlink: true,
}
var err error
- wd, err = k.VFS.GetDentryAt(ctx, args.Credentials, &pop, &vfs.GetDentryOptions{
+ wd, err = k.VFS().GetDentryAt(ctx, args.Credentials, &pop, &vfs.GetDentryOptions{
CheckSearchable: true,
})
if err != nil {
@@ -1506,3 +1506,8 @@ func (k *Kernel) EmitUnimplementedEvent(ctx context.Context) {
Registers: t.Arch().StateData().Proto(),
})
}
+
+// VFS returns the virtual filesystem for the kernel.
+func (k *Kernel) VFS() *vfs.VirtualFilesystem {
+ return &k.vfs
+}