diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-06-22 20:37:41 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-06-22 20:37:41 +0000 |
commit | d01228b4707699238b93057065748e9391113358 (patch) | |
tree | 308e3df7de9d4d76d349daf8444e0e7d54e77b7b /pkg/sentry/fs | |
parent | a09dced0e1e48d31dea8b5b5d7b6b52269b6adcc (diff) | |
parent | 35719d52c7ac7faa87b610013aedd69ad5d99ecc (diff) |
Merge 35719d52 (automated)
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. // |