Commit 22637a49 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: hide Dirent type.

parent 1dc9cd8f
......@@ -9,7 +9,7 @@ import (
var eightPadding [8]byte
const direntSize = int(unsafe.Sizeof(Dirent{}))
const direntSize = int(unsafe.Sizeof(_Dirent{}))
// DirEntry is a type for PathFileSystem and NodeFileSystem to return
// directory contents in.
......@@ -60,11 +60,11 @@ func (l *DirEntryList) Add(prefix []byte, name string, inode uint64, mode uint32
l.buf = l.buf[:newLen]
copy(l.buf[oldLen:], prefix)
oldLen += len(prefix)
dirent := (*Dirent)(unsafe.Pointer(&l.buf[oldLen]))
dirent := (*_Dirent)(unsafe.Pointer(&l.buf[oldLen]))
dirent.Off = l.offset + 1
dirent.Ino = inode
dirent.NameLen = uint32(len(name))
dirent.Typ = ModeToType(mode)
dirent.Typ = (mode & 0170000) >> 12
oldLen += direntSize
copy(l.buf[oldLen:], name)
oldLen += len(name)
......
......@@ -59,11 +59,6 @@ func ToStatus(err error) Status {
return ENOSYS
}
func ModeToType(mode uint32) uint32 {
return (mode & 0170000) >> 12
}
// Thanks to Andrew Gerrand for this hack.
func toSlice(dest *[]byte, ptr unsafe.Pointer, byteCount uintptr) {
h := (*reflect.SliceHeader)(unsafe.Pointer(dest))
*h = reflect.SliceHeader{uintptr(ptr), int(byteCount), int(byteCount)}
......
......@@ -418,7 +418,9 @@ type StatfsOut struct {
Spare [6]uint32
}
type Dirent struct {
// _Dirent is what we send to the kernel, but we offer DirEntry and
// DirEntryList to the user.
type _Dirent struct {
Ino uint64
Off uint64
NameLen uint32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment