summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-06-22 20:37:41 +0000
committergVisor bot <gvisor-bot@google.com>2019-06-22 20:37:41 +0000
commitd01228b4707699238b93057065748e9391113358 (patch)
tree308e3df7de9d4d76d349daf8444e0e7d54e77b7b /pkg/sentry/fs
parenta09dced0e1e48d31dea8b5b5d7b6b52269b6adcc (diff)
parent35719d52c7ac7faa87b610013aedd69ad5d99ecc (diff)
Merge 35719d52 (automated)
Diffstat (limited to 'pkg/sentry/fs')
-rw-r--r--pkg/sentry/fs/attr.go22
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.
//