summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/host
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-04-24 17:06:33 +0000
committergVisor bot <gvisor-bot@google.com>2020-04-24 17:06:33 +0000
commit57f05062f655eb7b1d9a43b407b82b97449195ee (patch)
treeda8b811d276923db6548c108d46c7c449d52de5f /pkg/sentry/fsimpl/host
parenta4ceffb96b9368657d2bf2ac10cc243de2eb8345 (diff)
parent1b88c63b3e6b330c8399bf92f148cc80374bee18 (diff)
Merge release-20200323.0-234-g1b88c63 (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/host')
-rwxr-xr-xpkg/sentry/fsimpl/host/host.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/pkg/sentry/fsimpl/host/host.go b/pkg/sentry/fsimpl/host/host.go
index 7847e3cc2..a26b13067 100755
--- a/pkg/sentry/fsimpl/host/host.go
+++ b/pkg/sentry/fsimpl/host/host.go
@@ -42,7 +42,7 @@ type filesystemType struct{}
// GetFilesystem implements FilesystemType.GetFilesystem.
func (filesystemType) GetFilesystem(context.Context, *vfs.VirtualFilesystem, *auth.Credentials, string, vfs.GetFilesystemOptions) (*vfs.Filesystem, *vfs.Dentry, error) {
- panic("cannot instaniate a host filesystem")
+ panic("host.filesystemType.GetFilesystem should never be called")
}
// Name implements FilesystemType.Name.
@@ -55,14 +55,14 @@ type filesystem struct {
kernfs.Filesystem
}
-// NewMount returns a new disconnected mount in vfsObj that may be passed to ImportFD.
-func NewMount(vfsObj *vfs.VirtualFilesystem) (*vfs.Mount, error) {
+// NewFilesystem sets up and returns a new hostfs filesystem.
+//
+// Note that there should only ever be one instance of host.filesystem,
+// a global mount for host fds.
+func NewFilesystem(vfsObj *vfs.VirtualFilesystem) *vfs.Filesystem {
fs := &filesystem{}
- fs.Init(vfsObj, &filesystemType{})
- vfsfs := fs.VFSFilesystem()
- // NewDisconnectedMount will take an additional reference on vfsfs.
- defer vfsfs.DecRef()
- return vfsObj.NewDisconnectedMount(vfsfs, nil, &vfs.MountOptions{})
+ fs.Init(vfsObj, filesystemType{})
+ return fs.VFSFilesystem()
}
// ImportFD sets up and returns a vfs.FileDescription from a donated fd.