本文整理汇总了Golang中github.com/jacobsa/fuse/internal/buffer.OutMessage.GrowNoZero方法的典型用法代码示例。如果您正苦于以下问题:Golang OutMessage.GrowNoZero方法的具体用法?Golang OutMessage.GrowNoZero怎么用?Golang OutMessage.GrowNoZero使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jacobsa/fuse/internal/buffer.OutMessage
的用法示例。
在下文中一共展示了OutMessage.GrowNoZero方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: convertInMessage
//.........这里部分代码省略.........
return
}
o = &fuseops.RmDirOp{
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
Name: string(buf[:n-1]),
}
case fusekernel.OpOpen:
o = &fuseops.OpenFileOp{
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
}
case fusekernel.OpOpendir:
o = &fuseops.OpenDirOp{
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
}
case fusekernel.OpRead:
in := (*fusekernel.ReadIn)(inMsg.Consume(fusekernel.ReadInSize(protocol)))
if in == nil {
err = errors.New("Corrupt OpRead")
return
}
to := &fuseops.ReadFileOp{
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
Handle: fuseops.HandleID(in.Fh),
Offset: int64(in.Offset),
}
o = to
readSize := int(in.Size)
p := outMsg.GrowNoZero(uintptr(readSize))
if p == nil {
err = fmt.Errorf("Can't grow for %d-byte read", readSize)
return
}
sh := (*reflect.SliceHeader)(unsafe.Pointer(&to.Dst))
sh.Data = uintptr(p)
sh.Len = readSize
sh.Cap = readSize
case fusekernel.OpReaddir:
in := (*fusekernel.ReadIn)(inMsg.Consume(fusekernel.ReadInSize(protocol)))
if in == nil {
err = errors.New("Corrupt OpReaddir")
return
}
to := &fuseops.ReadDirOp{
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
Handle: fuseops.HandleID(in.Fh),
Offset: fuseops.DirOffset(in.Offset),
}
o = to
readSize := int(in.Size)
p := outMsg.GrowNoZero(uintptr(readSize))
if p == nil {
err = fmt.Errorf("Can't grow for %d-byte read", readSize)
return
}
sh := (*reflect.SliceHeader)(unsafe.Pointer(&to.Dst))