本文整理匯總了Golang中github.com/hanwen/go-fuse/fuse.EntryOut.AttrValid方法的典型用法代碼示例。如果您正苦於以下問題:Golang EntryOut.AttrValid方法的具體用法?Golang EntryOut.AttrValid怎麽用?Golang EntryOut.AttrValid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hanwen/go-fuse/fuse.EntryOut
的用法示例。
在下文中一共展示了EntryOut.AttrValid方法的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
}