本文整理汇总了Golang中github.com/hanwen/go-fuse/fuse.EntryOut.EntryValid方法的典型用法代码示例。如果您正苦于以下问题:Golang EntryOut.EntryValid方法的具体用法?Golang EntryOut.EntryValid怎么用?Golang EntryOut.EntryValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/hanwen/go-fuse/fuse.EntryOut
的用法示例。
在下文中一共展示了EntryOut.EntryValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Lookup
func (constor *Constor) Lookup(header *fuse.InHeader, name string, out *fuse.EntryOut) fuse.Status {
var stat syscall.Stat_t
if len(name) > 255 {
constor.error("name too long : %s", name)
return fuse.Status(syscall.ENAMETOOLONG)
}
li := -1
parent := constor.inodemap.findInodePtr(header.NodeId)
if parent == nil {
constor.error("Unable to find parent inode : %d", header.NodeId)
return fuse.ENOENT
}
constor.log("%s(%s)", parent.id, name)
id, err := constor.getid(-1, parent.id, name)
if err != nil {
// logging this error will produce too many logs as there will be too many
// lookps on non-existant files
return fuse.ToStatus(err)
}
inode := constor.inodemap.findInodeId(id)
if inode != nil {
li = inode.layer
} else {
li = constor.getLayer(id)
}
if li == -1 {
constor.error("Unable to find inode for %s(%s) id %s", parent.id, name, id)
return fuse.ENOENT
}
err = constor.Lstat(li, id, &stat)
if err != nil {
constor.error("Unable to Lstat inode for %s(%s) id %s", parent.id, name, id)
return fuse.ToStatus(err)
}
if inode == nil {
inode = NewInode(constor, id)
inode.layer = li
constor.inodemap.hashInode(inode)
} else {
inode.lookup()
}
attr := (*fuse.Attr)(&out.Attr)
attr.FromStat(&stat)
out.NodeId = uint64(uintptr(unsafe.Pointer(inode)))
out.Ino = attr.Ino
out.EntryValid = 1000
out.AttrValid = 1000
constor.log("%s", id)
return fuse.OK
}