當前位置: 首頁>>代碼示例>>Golang>>正文


Golang fuse.Attr類代碼示例

本文整理匯總了Golang中github.com/djbarber/ipfs-hack/Godeps/_workspace/src/bazil/org/fuse.Attr的典型用法代碼示例。如果您正苦於以下問題:Golang Attr類的具體用法?Golang Attr怎麽用?Golang Attr使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Attr類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Attr

func (f *inMemoryFile) Attr(ctx context.Context, a *fuse.Attr) error {
	f.mu.Lock()
	defer f.mu.Unlock()

	a.Mode = 0666
	a.Size = uint64(len(f.data))
	return nil
}
開發者ID:djbarber,項目名稱:ipfs-hack,代碼行數:8,代碼來源:serve_test.go

示例2: attr

func (sn *serveNode) attr(ctx context.Context, attr *fuse.Attr) error {
	err := nodeAttr(ctx, sn.node, attr)
	if attr.Inode == 0 {
		attr.Inode = sn.inode
	}
	return err
}
開發者ID:djbarber,項目名稱:ipfs-hack,代碼行數:7,代碼來源:serve.go

示例3: nodeAttr

func nodeAttr(ctx context.Context, n Node, attr *fuse.Attr) error {
	attr.Valid = attrValidTime
	attr.Nlink = 1
	attr.Atime = startTime
	attr.Mtime = startTime
	attr.Ctime = startTime
	attr.Crtime = startTime
	if err := n.Attr(ctx, attr); err != nil {
		return err
	}
	return nil
}
開發者ID:djbarber,項目名稱:ipfs-hack,代碼行數:12,代碼來源:serve.go

示例4: Attr

func (t *tree) Attr(ctx context.Context, a *fuse.Attr) error {
	a.Mode = os.ModeDir | 0555
	return nil
}
開發者ID:djbarber,項目名稱:ipfs-hack,代碼行數:4,代碼來源:tree.go

示例5: Attr

func (f unwritableFile) Attr(ctx context.Context, a *fuse.Attr) error {
	a.Mode = 0000
	return nil
}
開發者ID:djbarber,項目名稱:ipfs-hack,代碼行數:4,代碼來源:options_test.go

示例6: Attr

func (benchFile) Attr(ctx context.Context, a *fuse.Attr) error {
	a.Inode = 2
	a.Mode = 0644
	a.Size = 9999999999999999
	return nil
}
開發者ID:djbarber,項目名稱:ipfs-hack,代碼行數:6,代碼來源:bench_test.go

示例7: Attr

func (f ChildMap) Attr(ctx context.Context, a *fuse.Attr) error {
	a.Mode = os.ModeDir | 0777
	return nil
}
開發者ID:djbarber,項目名稱:ipfs-hack,代碼行數:4,代碼來源:testfs.go

示例8: Attr

func (File) Attr(ctx context.Context, a *fuse.Attr) error {
	a.Inode = 2
	a.Mode = 0444
	a.Size = uint64(len(greeting))
	return nil
}
開發者ID:djbarber,項目名稱:ipfs-hack,代碼行數:6,代碼來源:hello.go

示例9: Attr

// Attr returns the attributes of a given node.
func (s *Node) Attr(ctx context.Context, a *fuse.Attr) error {
	log.Debug("Node attr.")
	if s.cached == nil {
		if err := s.loadData(); err != nil {
			return fmt.Errorf("readonly: loadData() failed: %s", err)
		}
	}
	switch s.cached.GetType() {
	case ftpb.Data_Directory:
		a.Mode = os.ModeDir | 0555
		a.Uid = uint32(os.Getuid())
		a.Gid = uint32(os.Getgid())
	case ftpb.Data_File:
		size := s.cached.GetFilesize()
		a.Mode = 0444
		a.Size = uint64(size)
		a.Blocks = uint64(len(s.Nd.Links))
		a.Uid = uint32(os.Getuid())
		a.Gid = uint32(os.Getgid())
	case ftpb.Data_Raw:
		a.Mode = 0444
		a.Size = uint64(len(s.cached.GetData()))
		a.Blocks = uint64(len(s.Nd.Links))
		a.Uid = uint32(os.Getuid())
		a.Gid = uint32(os.Getgid())
	case ftpb.Data_Symlink:
		a.Mode = 0777 | os.ModeSymlink
		a.Size = uint64(len(s.cached.GetData()))
		a.Uid = uint32(os.Getuid())
		a.Gid = uint32(os.Getgid())

	default:
		return fmt.Errorf("Invalid data type - %s", s.cached.GetType())
	}
	return nil
}
開發者ID:djbarber,項目名稱:ipfs-hack,代碼行數:37,代碼來源:readonly_unix.go


注:本文中的github.com/djbarber/ipfs-hack/Godeps/_workspace/src/bazil/org/fuse.Attr類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。