当前位置: 首页>>代码示例>>Golang>>正文


Golang FileSystem.GetAttr方法代码示例

本文整理汇总了Golang中github.com/hanwen/go-fuse/fuse/pathfs.FileSystem.GetAttr方法的典型用法代码示例。如果您正苦于以下问题:Golang FileSystem.GetAttr方法的具体用法?Golang FileSystem.GetAttr怎么用?Golang FileSystem.GetAttr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/hanwen/go-fuse/fuse/pathfs.FileSystem的用法示例。


在下文中一共展示了FileSystem.GetAttr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: getAttr

func getAttr(fs pathfs.FileSystem, name string) *attrResponse {
	a, code := fs.GetAttr(name, nil)
	return &attrResponse{
		Attr:   a,
		Status: code,
	}
}
开发者ID:rfjakob,项目名称:go-fuse,代码行数:7,代码来源:cachingfs.go

示例2: assertAttr

func assertAttr(s *fuseTestSuite, fs pathfs.FileSystem, path string, mode uint32, size uint64) {
	attr, code := fs.GetAttr(path, nil)
	assert.Equal(s.T(), fuse.OK, code)
	if code == fuse.OK {
		assert.Equal(s.T(), mode, attr.Mode)
		assert.Equal(s.T(), size, attr.Size)
	}
}
开发者ID:Richardphp,项目名称:noms,代码行数:8,代码来源:basics_test.go

示例3: findDir

func findDir(fs pathfs.FileSystem, path string, delimiter string) []string {
	ents, _ := fs.OpenDir(path, nil)
	ret := make([]string, 0)
	for _, ent := range ents {
		child := path + delimiter + ent.Name
		attr, _ := fs.GetAttr(child, nil)
		if attr.Mode&fuse.S_IFDIR != 0 {
			ret = append(ret, child+"/")
			ret = append(ret, findDir(fs, child, "/")...)
		} else {
			ret = append(ret, child)
		}
	}

	return ret
}
开发者ID:Richardphp,项目名称:noms,代码行数:16,代码来源:dir_test.go

示例4: NewMemUnionFs

// NewMemUnionFs instantiates a new union file system.  Calling this
// will access the root of the supplied R/O filesystem.
func NewMemUnionFs(backingStore string, roFs pathfs.FileSystem) (*MemUnionFs, error) {
	me := &MemUnionFs{
		deleted:      make(map[string]bool),
		backingStore: backingStore,
		readonly:     roFs,
	}

	me.root = me.newNode(true)
	fi, code := roFs.GetAttr("", nil)
	if !code.Ok() {
		return nil, fmt.Errorf("GetAttr(\"\") for R/O returned %v", code)
	}

	me.root.info = *fi
	me.cond = sync.NewCond(&me.mutex)

	return me, nil
}
开发者ID:hanwen,项目名称:termite,代码行数:20,代码来源:memunionfs.go


注:本文中的github.com/hanwen/go-fuse/fuse/pathfs.FileSystem.GetAttr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。