Commit 794d8cbe authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

UnionFs: insert all readdir entries directly into the channel.

parent c833c477
...@@ -65,7 +65,7 @@ type UnionFs struct { ...@@ -65,7 +65,7 @@ type UnionFs struct {
roots []string roots []string
branches []*fuse.LoopbackFileSystem branches []*fuse.LoopbackFileSystem
// The same, but as interfaces. // The same, but as interfaces.
fileSystems []fuse.FileSystem fileSystems []fuse.FileSystem
...@@ -644,16 +644,14 @@ func (me *UnionFs) OpenDir(directory string) (stream chan fuse.DirEntry, status ...@@ -644,16 +644,14 @@ func (me *UnionFs) OpenDir(directory string) (stream chan fuse.DirEntry, status
results[_READONLY] = 0, false results[_READONLY] = 0, false
} }
stream = make(chan fuse.DirEntry) stream = make(chan fuse.DirEntry, len(results))
go func() { for k, v := range results {
for k, v := range results { stream <- fuse.DirEntry{
stream <- fuse.DirEntry{ Name: k,
Name: k, Mode: v,
Mode: v,
}
} }
close(stream) }
}() close(stream)
return stream, fuse.OK return stream, fuse.OK
} }
......
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