github.com/keltia/go-ipfs@v0.3.8-0.20150909044612-210793031c63/fuse/ipns/link_unix.go (about)

     1  // +build !nofuse
     2  
     3  package ipns
     4  
     5  import (
     6  	"os"
     7  
     8  	"github.com/ipfs/go-ipfs/Godeps/_workspace/src/bazil.org/fuse"
     9  	"github.com/ipfs/go-ipfs/Godeps/_workspace/src/bazil.org/fuse/fs"
    10  	"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
    11  )
    12  
    13  type Link struct {
    14  	Target string
    15  }
    16  
    17  func (l *Link) Attr(ctx context.Context, a *fuse.Attr) error {
    18  	log.Debug("Link attr.")
    19  	*a = fuse.Attr{
    20  		Mode: os.ModeSymlink | 0555,
    21  	}
    22  	return nil
    23  }
    24  
    25  func (l *Link) Readlink(ctx context.Context, req *fuse.ReadlinkRequest) (string, error) {
    26  	log.Debugf("ReadLink: %s", l.Target)
    27  	return l.Target, nil
    28  }
    29  
    30  var _ fs.NodeReadlinker = (*Link)(nil)