diff options
author | Nicolas Lacasse <nlacasse@google.com> | 2019-06-22 13:28:21 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-06-22 13:29:26 -0700 |
commit | 35719d52c7ac7faa87b610013aedd69ad5d99ecc (patch) | |
tree | 32b3c190890687b6b1bc9b2af4d2575e474f9b52 /pkg/sentry/fs | |
parent | c1761378a93f8d596d7956c9b7ba2a9d3d0619bc (diff) |
Implement statx.
We don't have the plumbing for btime yet, so that field is left off. The
returned mask indicates that btime is absent.
Fixes #343
PiperOrigin-RevId: 254575752
Diffstat (limited to 'pkg/sentry/fs')
-rw-r--r-- | pkg/sentry/fs/attr.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pkg/sentry/fs/attr.go b/pkg/sentry/fs/attr.go index 1d9d7454a..9fc6a5bc2 100644 --- a/pkg/sentry/fs/attr.go +++ b/pkg/sentry/fs/attr.go @@ -89,6 +89,28 @@ func (n InodeType) String() string { } } +// LinuxType returns the linux file type for this inode type. +func (n InodeType) LinuxType() uint32 { + switch n { + case RegularFile, SpecialFile: + return linux.ModeRegular + case Directory, SpecialDirectory: + return linux.ModeDirectory + case Symlink: + return linux.ModeSymlink + case Pipe: + return linux.ModeNamedPipe + case CharacterDevice: + return linux.ModeCharacterDevice + case BlockDevice: + return linux.ModeBlockDevice + case Socket: + return linux.ModeSocket + default: + return 0 + } +} + // StableAttr contains Inode attributes that will be stable throughout the // lifetime of the Inode. // |