summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel
diff options
context:
space:
mode:
authorAyush Ranjan <ayushranjan@google.com>2021-10-26 16:57:12 -0700
committergVisor bot <gvisor-bot@google.com>2021-10-26 17:00:07 -0700
commit7b8f19dc76a9fecbf4d2e5f43a47c6d47d53e100 (patch)
tree632c24c56d874298eb2cca543ec5e5aee01df30f /pkg/sentry/kernel
parentf54a25c1f03e705f2fb65be7389ddeb37bc5e64e (diff)
Simplify vfs.NewDisconnectedMount signature and callpoints.
vfs.NewDisconnectedMount has no error paths. Its much prettier without the error return value. Also simplify MountDisconnected which would immediately drop the refs taken by NewDisconnectedMount. Instead make it directly call newMount. PiperOrigin-RevId: 405767966
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r--pkg/sentry/kernel/kernel.go17
1 files changed, 3 insertions, 14 deletions
diff --git a/pkg/sentry/kernel/kernel.go b/pkg/sentry/kernel/kernel.go
index d4851ccda..83299a9fb 100644
--- a/pkg/sentry/kernel/kernel.go
+++ b/pkg/sentry/kernel/kernel.go
@@ -418,10 +418,7 @@ func (k *Kernel) Init(args InitKernelArgs) error {
return fmt.Errorf("failed to create pipefs filesystem: %v", err)
}
defer pipeFilesystem.DecRef(ctx)
- pipeMount, err := k.vfs.NewDisconnectedMount(pipeFilesystem, nil, &vfs.MountOptions{})
- if err != nil {
- return fmt.Errorf("failed to create pipefs mount: %v", err)
- }
+ pipeMount := k.vfs.NewDisconnectedMount(pipeFilesystem, nil, &vfs.MountOptions{})
k.pipeMount = pipeMount
tmpfsFilesystem, tmpfsRoot, err := tmpfs.NewFilesystem(ctx, &k.vfs, auth.NewRootCredentials(k.rootUserNamespace))
@@ -430,22 +427,14 @@ func (k *Kernel) Init(args InitKernelArgs) error {
}
defer tmpfsFilesystem.DecRef(ctx)
defer tmpfsRoot.DecRef(ctx)
- shmMount, err := k.vfs.NewDisconnectedMount(tmpfsFilesystem, tmpfsRoot, &vfs.MountOptions{})
- if err != nil {
- return fmt.Errorf("failed to create tmpfs mount: %v", err)
- }
- k.shmMount = shmMount
+ k.shmMount = k.vfs.NewDisconnectedMount(tmpfsFilesystem, tmpfsRoot, &vfs.MountOptions{})
socketFilesystem, err := sockfs.NewFilesystem(&k.vfs)
if err != nil {
return fmt.Errorf("failed to create sockfs filesystem: %v", err)
}
defer socketFilesystem.DecRef(ctx)
- socketMount, err := k.vfs.NewDisconnectedMount(socketFilesystem, nil, &vfs.MountOptions{})
- if err != nil {
- return fmt.Errorf("failed to create sockfs mount: %v", err)
- }
- k.socketMount = socketMount
+ k.socketMount = k.vfs.NewDisconnectedMount(socketFilesystem, nil, &vfs.MountOptions{})
k.socketsVFS2 = make(map[*vfs.FileDescription]*SocketRecord)