本文整理匯總了Golang中github.com/hanwen/go-fuse/fuse.Attr.IsDir方法的典型用法代碼示例。如果您正苦於以下問題:Golang Attr.IsDir方法的具體用法?Golang Attr.IsDir怎麽用?Golang Attr.IsDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hanwen/go-fuse/fuse.Attr
的用法示例。
在下文中一共展示了Attr.IsDir方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetAttr
func (n *pathInode) GetAttr(out *fuse.Attr, file nodefs.File, context *fuse.Context) (code fuse.Status) {
var fi *fuse.Attr
if file == nil {
// called on a deleted files.
file = n.Inode().AnyFile()
}
if file != nil {
code = file.GetAttr(out)
}
if file == nil || code == fuse.ENOSYS || code == fuse.EBADF {
fi, code = n.fs.GetAttr(n.GetPath(), context)
}
if fi != nil {
n.setClientInode(fi.Ino)
}
if fi != nil && !fi.IsDir() && fi.Nlink == 0 {
fi.Nlink = 1
}
if fi != nil {
*out = *fi
}
return code
}
示例2: findChild
func (n *pathInode) findChild(fi *fuse.Attr, name string, fullPath string) (out *pathInode) {
if fi.Ino > 0 {
n.pathFs.pathLock.RLock()
r := n.pathFs.clientInodeMap[fi.Ino]
if r != nil {
out = r.node
r.refCount++
if fi.Nlink == 1 {
log.Printf("Found linked inode, but Nlink == 1, ino=%d, fullPath=%q", fi.Ino, fullPath)
}
}
n.pathFs.pathLock.RUnlock()
}
if out == nil {
out = n.createChild(name, fi.IsDir())
out.setClientInode(fi.Ino)
} else {
n.Inode().AddChild(name, out.Inode())
}
return out
}
示例3: findChild
func (n *pathInode) findChild(fi *fuse.Attr, name string, fullPath string) (out *pathInode) {
if fi.Ino > 0 {
unlock := n.RLockTree()
v := n.pathFs.clientInodeMap[fi.Ino]
if len(v) > 0 {
out = v[0].node
if fi.Nlink == 1 {
log.Println("Found linked inode, but Nlink == 1", fullPath)
}
}
unlock()
}
if out == nil {
out = n.createChild(fi.IsDir())
out.clientInode = fi.Ino
n.addChild(name, out)
} else {
// should add 'out' as a child to n ?
}
return out
}