summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/mount.go
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2019-01-14 20:33:29 -0800
committerShentubot <shentubot@google.com>2019-01-14 20:34:28 -0800
commitdc8450b5676d4c4ac9bcfa23cabd862e0060527d (patch)
treea4ef1ad59764f46f674b7003221ba8ae399b9e65 /pkg/sentry/fs/mount.go
parent343ebe9789087b099ea7feae19879f5c24e59bf1 (diff)
Remove fs.Handle, ramfs.Entry, and all the DeprecatedFileOperations.
More helper structs have been added to the fsutil package to make it easier to implement fs.InodeOperations and fs.FileOperations. PiperOrigin-RevId: 229305982 Change-Id: Ib6f8d3862f4216745116857913dbfa351530223b
Diffstat (limited to 'pkg/sentry/fs/mount.go')
-rw-r--r--pkg/sentry/fs/mount.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/pkg/sentry/fs/mount.go b/pkg/sentry/fs/mount.go
index 24e28ddb2..dd6e64b4c 100644
--- a/pkg/sentry/fs/mount.go
+++ b/pkg/sentry/fs/mount.go
@@ -43,8 +43,6 @@ type DirentOperations interface {
// MountSourceOperations contains filesystem specific operations.
type MountSourceOperations interface {
// TODO: Add:
- //
- // StatFS() (Info, error)
// BlockSize() int64
// FS() Filesystem
@@ -249,7 +247,7 @@ func (msrc *MountSource) FlushDirentRefs() {
}
// NewCachingMountSource returns a generic mount that will cache dirents
-// aggressively. Filesystem may be nil if there is no backing filesystem.
+// aggressively.
func NewCachingMountSource(filesystem Filesystem, flags MountSourceFlags) *MountSource {
return NewMountSource(&SimpleMountSourceOperations{
keep: true,
@@ -258,7 +256,6 @@ func NewCachingMountSource(filesystem Filesystem, flags MountSourceFlags) *Mount
}
// NewNonCachingMountSource returns a generic mount that will never cache dirents.
-// Filesystem may be nil if there is no backing filesystem.
func NewNonCachingMountSource(filesystem Filesystem, flags MountSourceFlags) *MountSource {
return NewMountSource(&SimpleMountSourceOperations{
keep: false,
@@ -275,6 +272,15 @@ func NewRevalidatingMountSource(filesystem Filesystem, flags MountSourceFlags) *
}, filesystem, flags)
}
+// NewPseudoMountSource returns a "pseudo" mount source that is not backed by
+// an actual filesystem. It is always non-caching.
+func NewPseudoMountSource() *MountSource {
+ return NewMountSource(&SimpleMountSourceOperations{
+ keep: false,
+ revalidate: false,
+ }, nil, MountSourceFlags{})
+}
+
// SimpleMountSourceOperations implements MountSourceOperations.
//
// +stateify savable