github.com/charlievieth/fastwalk@v1.0.3/internal/dirent/dirent_js.go (about) 1 package dirent 2 3 import ( 4 "os" 5 "syscall" 6 "unsafe" 7 ) 8 9 func direntIno(buf []byte) (uint64, bool) { 10 return 1, true 11 } 12 13 func direntReclen(buf []byte) (uint64, bool) { 14 return readInt(buf, unsafe.Offsetof(syscall.Dirent{}.Reclen), unsafe.Sizeof(syscall.Dirent{}.Reclen)) 15 } 16 17 func direntNamlen(buf []byte) (uint64, bool) { 18 reclen, ok := direntReclen(buf) 19 if !ok { 20 return 0, false 21 } 22 return reclen - uint64(unsafe.Offsetof(syscall.Dirent{}.Name)), true 23 } 24 25 func direntType(buf []byte) os.FileMode { 26 return ^os.FileMode(0) // unknown 27 }