本文整理匯總了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,
}
}
示例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)
}
}
示例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
}
示例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
}