diff --git a/fs/torrentfs.go b/fs/torrentfs.go index 5fcd8eea..261dbc38 100644 --- a/fs/torrentfs.go +++ b/fs/torrentfs.go @@ -70,10 +70,10 @@ type fileNode struct { TorrentOffset int64 } -func (fn fileNode) Attr(attr *fuse.Attr) { +func (fn fileNode) Attr(ctx context.Context, attr *fuse.Attr) error { attr.Size = fn.size attr.Mode = defaultMode - return + return nil } func (n *node) fsPath() string { @@ -230,9 +230,9 @@ func (dn dirNode) Lookup(ctx context.Context, name string) (_node fusefs.Node, e return } -func (dn dirNode) Attr(attr *fuse.Attr) { +func (dn dirNode) Attr(ctx context.Context, attr *fuse.Attr) error { attr.Mode = os.ModeDir | defaultMode - return + return nil } func (me rootNode) Lookup(ctx context.Context, name string) (_node fusefs.Node, err error) { @@ -279,8 +279,9 @@ func (me rootNode) ReadDirAll(ctx context.Context) (dirents []fuse.Dirent, err e return } -func (rootNode) Attr(attr *fuse.Attr) { +func (rootNode) Attr(ctx context.Context, attr *fuse.Attr) error { attr.Mode = os.ModeDir + return nil } // TODO(anacrolix): Why should rootNode implement this? diff --git a/fs/torrentfs_test.go b/fs/torrentfs_test.go index 5f77d206..20bea21b 100644 --- a/fs/torrentfs_test.go +++ b/fs/torrentfs_test.go @@ -17,7 +17,8 @@ import ( "bazil.org/fuse" fusefs "bazil.org/fuse/fs" - "golang.org/x/net/context" + "github.com/gorilla/context" + netContext "golang.org/x/net/context" "github.com/anacrolix/torrent" "github.com/anacrolix/torrent/data" @@ -234,7 +235,7 @@ func TestDownloadOnDemand(t *testing.T) { root, _ := fs.Root() node, _ := root.(fusefs.NodeStringLookuper).Lookup(context.Background(), "greeting") var attr fuse.Attr - node.Attr(&attr) + node.Attr(netContext.Background(), &attr) size := attr.Size resp := &fuse.ReadResponse{ Data: make([]byte, size),