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

Fixes for CachingFileSystem.

parent 51c0d8dc
package unionfs package unionfs
import ( import (
"fmt"
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
) )
var _ = fmt.Println
type attrResponse struct { type attrResponse struct {
*fuse.Attr *fuse.Attr
fuse.Status fuse.Status
...@@ -43,7 +44,6 @@ func readDir(fs fuse.FileSystem, name string) *dirResponse { ...@@ -43,7 +44,6 @@ func readDir(fs fuse.FileSystem, name string) *dirResponse {
} }
r.entries = append(r.entries, d) r.entries = append(r.entries, d)
} }
return r return r
} }
...@@ -73,17 +73,17 @@ func NewCachingFileSystem(fs fuse.FileSystem, ttlNs int64) *CachingFileSystem { ...@@ -73,17 +73,17 @@ func NewCachingFileSystem(fs fuse.FileSystem, ttlNs int64) *CachingFileSystem {
} }
func (me *CachingFileSystem) GetAttr(name string) (*fuse.Attr, fuse.Status) { func (me *CachingFileSystem) GetAttr(name string) (*fuse.Attr, fuse.Status) {
r := me.attributes.Get(name).(attrResponse) r := me.attributes.Get(name).(*attrResponse)
return r.Attr, r.Status return r.Attr, r.Status
} }
func (me *CachingFileSystem) Readlink(name string) (string, fuse.Status) { func (me *CachingFileSystem) Readlink(name string) (string, fuse.Status) {
r := me.attributes.Get(name).(linkResponse) r := me.attributes.Get(name).(*linkResponse)
return r.linkContent, r.Status return r.linkContent, r.Status
} }
func (me *CachingFileSystem) OpenDir(name string) (stream chan fuse.DirEntry, status fuse.Status) { func (me *CachingFileSystem) OpenDir(name string) (stream chan fuse.DirEntry, status fuse.Status) {
r := me.dirs.Get(name).(dirResponse) r := me.dirs.Get(name).(*dirResponse)
if r.Status == fuse.OK { if r.Status == fuse.OK {
stream = make(chan fuse.DirEntry, len(r.entries)) stream = make(chan fuse.DirEntry, len(r.entries))
for _, d := range r.entries { for _, d := range r.entries {
......
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