From 7b8f19dc76a9fecbf4d2e5f43a47c6d47d53e100 Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Tue, 26 Oct 2021 16:57:12 -0700 Subject: 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 --- pkg/sentry/vfs/vfs.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'pkg/sentry/vfs/vfs.go') diff --git a/pkg/sentry/vfs/vfs.go b/pkg/sentry/vfs/vfs.go index 1b2a668c0..9c1ee549a 100644 --- a/pkg/sentry/vfs/vfs.go +++ b/pkg/sentry/vfs/vfs.go @@ -150,12 +150,7 @@ func (vfs *VirtualFilesystem) Init(ctx context.Context) error { } anonfs.vfsfs.Init(vfs, &anonFilesystemType{}, &anonfs) defer anonfs.vfsfs.DecRef(ctx) - anonMount, err := vfs.NewDisconnectedMount(&anonfs.vfsfs, nil, &MountOptions{}) - if err != nil { - // We should not be passing any MountOptions that would cause - // construction of this mount to fail. - panic(fmt.Sprintf("VirtualFilesystem.Init: anonfs mount failed: %v", err)) - } + anonMount := vfs.NewDisconnectedMount(&anonfs.vfsfs, nil, &MountOptions{}) vfs.anonMount = anonMount return nil -- cgit v1.2.3