fs/torrentfs.go | 11 ++++++----- fs/torrentfs_test.go | 5 +++-- diff --git a/fs/torrentfs.go b/fs/torrentfs.go index 5fcd8eea1ab79024c37a76d6f094c0c2896d257f..261dbc3870998f5a8bb44ee0b71dbc816b3c74c2 100644 --- a/fs/torrentfs.go +++ b/fs/torrentfs.go @@ -70,10 +70,10 @@ size uint64 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 @@ } 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 @@ } 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 5f77d206aeb4fa1bd95eb626124698ad11576b53..20bea21b74ba1db892305f95fe5377f4803ef340 100644 --- a/fs/torrentfs_test.go +++ b/fs/torrentfs_test.go @@ -17,7 +17,8 @@ "time" "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 @@ defer fs.Destroy() 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),