Commit d25a1333 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: for readdirplus, use lookup inode number in the DirEntry inode field.

parent 23d23803
......@@ -30,6 +30,8 @@ type DirEntryList struct {
offset uint64
}
// NewDirEntryList creates a DirEntryList with the given data buffer
// and offset.
func NewDirEntryList(data []byte, off uint64) *DirEntryList {
return &DirEntryList{
buf: data[:0],
......@@ -79,9 +81,14 @@ func (l *DirEntryList) Add(prefix []byte, name string, inode uint64, mode uint32
// and its corresponding lookup. Pass a null EntryOut if the lookup
// data should be ignored.
func (l *DirEntryList) AddDirLookupEntry(e DirEntry, entryOut *raw.EntryOut) (bool, uint64) {
ino := uint64(raw.FUSE_UNKNOWN_INO)
if entryOut.Ino > 0 {
ino = entryOut.Ino
}
var lookup []byte
toSlice(&lookup, unsafe.Pointer(entryOut), unsafe.Sizeof(raw.EntryOut{}))
return l.Add(lookup, e.Name, uint64(raw.FUSE_UNKNOWN_INO), e.Mode)
return l.Add(lookup, e.Name, ino, e.Mode)
}
func (l *DirEntryList) bytes() []byte {
......
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