Commit 1b71459f authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: add NewListDirStream()

parent 3e1c2619
// Copyright 2019 the Go-FUSE Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package nodefs
import (
"github.com/hanwen/go-fuse/fuse"
)
type dirArray struct {
entries []fuse.DirEntry
}
func (a *dirArray) HasNext() bool {
return len(a.entries) > 0
}
func (a *dirArray) Next() (fuse.DirEntry, fuse.Status) {
e := a.entries[0]
a.entries = a.entries[1:]
return e, fuse.OK
}
func (a *dirArray) Close() {
}
func NewListDirStream(list []fuse.DirEntry) DirStream {
return &dirArray{list}
}
......@@ -11,24 +11,6 @@ import (
"github.com/hanwen/go-fuse/fuse"
)
type dirArray struct {
Entries []fuse.DirEntry
}
func (a *dirArray) HasNext() bool {
return len(a.Entries) > 0
}
func (a *dirArray) Next() (fuse.DirEntry, fuse.Status) {
e := a.Entries[0]
a.Entries = a.Entries[1:]
return e, fuse.OK
}
func (a *dirArray) Close() {
}
func NewLoopbackDirStream(nm string) (DirStream, fuse.Status) {
f, err := os.Open(nm)
if err != nil {
......
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