diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-02-14 13:39:51 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-02-14 13:40:39 -0800 |
commit | e4c7f3e6f6c19f3259820a4c41b69e85c0454379 (patch) | |
tree | c63b9ac4d97a715a226feba4fbbd5cab03bb6743 /pkg/sentry/fsimpl/testutil/kernel.go | |
parent | 50c493193b72997a6b09f353fd9217349941c494 (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/fsimpl/testutil/kernel.go')
-rw-r--r-- | pkg/sentry/fsimpl/testutil/kernel.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/sentry/fsimpl/testutil/kernel.go b/pkg/sentry/fsimpl/testutil/kernel.go index a91b3ec4d..d0be32e72 100644 --- a/pkg/sentry/fsimpl/testutil/kernel.go +++ b/pkg/sentry/fsimpl/testutil/kernel.go @@ -102,12 +102,13 @@ func Boot() (*kernel.Kernel, error) { kernel.VFS2Enabled = true - vfsObj := vfs.New() - vfsObj.MustRegisterFilesystemType(tmpfs.Name, &tmpfs.FilesystemType{}, &vfs.RegisterFilesystemTypeOptions{ + if err := k.VFS().Init(); err != nil { + return nil, fmt.Errorf("VFS init: %v", err) + } + k.VFS().MustRegisterFilesystemType(tmpfs.Name, &tmpfs.FilesystemType{}, &vfs.RegisterFilesystemTypeOptions{ AllowUserMount: true, AllowUserList: true, }) - k.VFS = vfsObj ls, err := limits.NewLinuxLimitSet() if err != nil { |