本文整理匯總了Golang中github.com/hanwen/go-fuse/fuse.AttrOut類的典型用法代碼示例。如果您正苦於以下問題:Golang AttrOut類的具體用法?Golang AttrOut怎麽用?Golang AttrOut使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了AttrOut類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetAttr
func (c *rawBridge) GetAttr(input *fuse.GetAttrIn, out *fuse.AttrOut) (code fuse.Status) {
node := c.toInode(input.NodeId)
var f File
if input.Flags()&fuse.FUSE_GETATTR_FH != 0 {
if opened := node.mount.getOpenedFile(input.Fh()); opened != nil {
f = opened.WithFlags.File
}
}
dest := (*fuse.Attr)(&out.Attr)
code = node.fsInode.GetAttr(dest, f, &input.Context)
if !code.Ok() {
return code
}
if out.Nlink == 0 {
// With Nlink == 0, newer kernels will refuse link
// operations.
out.Nlink = 1
}
node.mount.fillAttr(out, input.NodeId)
return fuse.OK
}
示例2: fillAttr
func (m *fileSystemMount) fillAttr(out *fuse.AttrOut, nodeId uint64) {
splitDuration(m.options.AttrTimeout, &out.AttrValid, &out.AttrValidNsec)
m.setOwner(&out.Attr)
if out.Ino == 0 {
out.Ino = nodeId
}
}
示例3: GetAttr
func (constor *Constor) GetAttr(input *fuse.GetAttrIn, out *fuse.AttrOut) (code fuse.Status) {
stat := syscall.Stat_t{}
inode := constor.inodemap.findInodePtr(input.NodeId)
if inode == nil {
constor.error("%d not in inodemap", input.NodeId)
return fuse.ENOENT
}
if inode.id == ROOTID && inode.layer == -1 {
inode.layer = constor.getLayer(inode.id)
if inode.layer == -1 {
constor.error("Unable to find root inode")
return fuse.ENOENT
}
}
F := constor.fdlookup(inode.id, input.Pid)
var err error
// FIXME check to see if F.layer needs to be changed
if F == nil {
if inode.layer == -1 {
constor.error("layer is -1 for %s", inode.id)
return fuse.ENOENT
}
constor.log("Lstat on %s", inode.id)
err = constor.Lstat(inode.layer, inode.id, &stat)
} else {
constor.log("Fstat on %s", inode.id)
err = syscall.Fstat(F.fd, &stat)
stat.Ino = idtoino(F.id)
// FIXME take care of hard links too
}
if err != nil {
constor.error("%s: %s", inode.id, err)
return fuse.ToStatus(err)
}
attr := (*fuse.Attr)(&out.Attr)
attr.FromStat(&stat)
out.AttrValid = 1000
constor.log("%s", inode.id)
return fuse.OK
}