1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 05:52:20 +08:00

godeps: update bazil.org/fuse

fuse: Attr() now has a Context parameter and error return value

~GOPATH/src/bazil.org/fuse:master$ git shortlog 48c34fb7780b88aca1696bf865508f6703aa47f1..e4fcc9a2c7567d1c42861deebeb483315d222262
Tommi Virtanen (8):
      Remove dead code
      Make saveLookup take Context, return error
      Make serveNode.attr take Context, return error
      Make nodeAttr take Context, return error
      API change: Move attribute validity time inside Attr
      Set attribute validity default time in one place
      API change: Attr method takes Context, returns error
      Set LookupResponse validity times up front, instead of after the handler
This commit is contained in:
Henry
2015-05-28 22:09:26 +02:00
parent 97d75891b0
commit e9074beb6d
16 changed files with 407 additions and 139 deletions

View File

@ -6,6 +6,7 @@ package ipns
import (
"errors"
"fmt"
"os"
"strings"
@ -106,9 +107,10 @@ func CreateRoot(ipfs *core.IpfsNode, keys []ci.PrivKey, ipfspath, ipnspath strin
}
// Attr returns file attributes.
func (*Root) Attr() fuse.Attr {
func (*Root) Attr(ctx context.Context, a *fuse.Attr) error {
log.Debug("Root Attr")
return fuse.Attr{Mode: os.ModeDir | 0111} // -rw+x
*a = fuse.Attr{Mode: os.ModeDir | 0111} // -rw+x
return nil
}
// Lookup performs a lookup under this node.
@ -215,29 +217,31 @@ type File struct {
}
// Attr returns the attributes of a given node.
func (d *Directory) Attr() fuse.Attr {
func (d *Directory) Attr(ctx context.Context, a *fuse.Attr) error {
log.Debug("Directory Attr")
return fuse.Attr{
*a = fuse.Attr{
Mode: os.ModeDir | 0555,
Uid: uint32(os.Getuid()),
Gid: uint32(os.Getgid()),
}
return nil
}
// Attr returns the attributes of a given node.
func (fi *File) Attr() fuse.Attr {
func (fi *File) Attr(ctx context.Context, a *fuse.Attr) error {
log.Debug("File Attr")
size, err := fi.fi.Size()
if err != nil {
// In this case, the dag node in question may not be unixfs
log.Critical("Failed to get file size: %s", err)
return fmt.Errorf("fuse/ipns: failed to get file.Size(): %s", err)
}
return fuse.Attr{
*a = fuse.Attr{
Mode: os.FileMode(0666),
Size: uint64(size),
Uid: uint32(os.Getuid()),
Gid: uint32(os.Getgid()),
}
return nil
}
// Lookup performs a lookup under this node.

View File

@ -14,11 +14,12 @@ type Link struct {
Target string
}
func (l *Link) Attr() fuse.Attr {
func (l *Link) Attr(ctx context.Context, a *fuse.Attr) error {
log.Debug("Link attr.")
return fuse.Attr{
*a = fuse.Attr{
Mode: os.ModeSymlink | 0555,
}
return nil
}
func (l *Link) Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string, error) {