diff options
author | Rahat Mahmood <rahat@google.com> | 2020-08-28 14:29:16 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-08-28 14:31:11 -0700 |
commit | b4820e598681c61fbf0e8a7f4d3436d2599ce53c (patch) | |
tree | 9e7c5770ba0edba0ae77f35300803c13d6914970 /pkg/sentry/fsimpl/sys/sys.go | |
parent | bdd5996a73b14d6f6600ab7aa00cdaed459cab16 (diff) |
Implement StatFS for various VFS2 filesystems.
This mainly involved enabling kernfs' client filesystems to provide a
StatFS implementation.
Fixes #3411, #3515.
PiperOrigin-RevId: 329009864
Diffstat (limited to 'pkg/sentry/fsimpl/sys/sys.go')
-rw-r--r-- | pkg/sentry/fsimpl/sys/sys.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/sentry/fsimpl/sys/sys.go b/pkg/sentry/fsimpl/sys/sys.go index ea30a4ec2..39952d2d0 100644 --- a/pkg/sentry/fsimpl/sys/sys.go +++ b/pkg/sentry/fsimpl/sys/sys.go @@ -163,9 +163,16 @@ func (d *dir) DecRef(context.Context) { d.dirRefs.DecRef(d.Destroy) } +// StatFS implements kernfs.Inode.StatFS. +func (d *dir) StatFS(ctx context.Context, fs *vfs.Filesystem) (linux.Statfs, error) { + return vfs.GenericStatFS(linux.SYSFS_MAGIC), nil +} + // cpuFile implements kernfs.Inode. type cpuFile struct { + implStatFS kernfs.DynamicBytesFile + maxCores uint } @@ -182,3 +189,10 @@ func (fs *filesystem) newCPUFile(creds *auth.Credentials, maxCores uint, mode li d.Init(c) return d } + +type implStatFS struct{} + +// StatFS implements kernfs.Inode.StatFS. +func (*implStatFS) StatFS(context.Context, *vfs.Filesystem) (linux.Statfs, error) { + return vfs.GenericStatFS(linux.SYSFS_MAGIC), nil +} |