diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-08-07 21:32:48 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-08-07 21:32:48 +0000 |
commit | 3d4b6ad4b210d4a09fcf7ad91e39e60a55012fe1 (patch) | |
tree | 739b4b3f2e514e593fecb46f54417c5a4a508f2b /pkg/sentry/syscalls | |
parent | abdd9fb7c165e6aae38d2af1bd83657ae4988caf (diff) | |
parent | 1c9781a4edce5fa9688f868149a2506f2ec5fa86 (diff) |
Merge 1c9781a4 (automated)
Diffstat (limited to 'pkg/sentry/syscalls')
-rw-r--r-- | pkg/sentry/syscalls/linux/sys_getdents.go | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_getdents.go b/pkg/sentry/syscalls/linux/sys_getdents.go index 63e2c5a5d..912cbe4ff 100644 --- a/pkg/sentry/syscalls/linux/sys_getdents.go +++ b/pkg/sentry/syscalls/linux/sys_getdents.go @@ -120,7 +120,7 @@ func newDirent(width uint, name string, attr fs.DentAttr, offset uint64) *dirent Ino: attr.InodeID, Off: offset, }, - Typ: toType(attr.Type), + Typ: fs.ToDirentType(attr.Type), }, Name: []byte(name), } @@ -142,28 +142,6 @@ func smallestDirent64(a arch.Context) uint { return uint(binary.Size(d.Hdr)) + a.Width() } -// toType converts an fs.InodeOperationsInfo to a linux dirent typ field. -func toType(nodeType fs.InodeType) uint8 { - switch nodeType { - case fs.RegularFile, fs.SpecialFile: - return linux.DT_REG - case fs.Symlink: - return linux.DT_LNK - case fs.Directory, fs.SpecialDirectory: - return linux.DT_DIR - case fs.Pipe: - return linux.DT_FIFO - case fs.CharacterDevice: - return linux.DT_CHR - case fs.BlockDevice: - return linux.DT_BLK - case fs.Socket: - return linux.DT_SOCK - default: - return linux.DT_UNKNOWN - } -} - // padRec pads the name field until the rec length is a multiple of the width, // which must be a power of 2. It returns the padded rec length. func (d *dirent) padRec(width int) uint16 { |