本文整理汇总了Golang中github.com/jacobsa/fuse/internal/buffer.OutMessage.Len方法的典型用法代码示例。如果您正苦于以下问题:Golang OutMessage.Len方法的具体用法?Golang OutMessage.Len怎么用?Golang OutMessage.Len使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jacobsa/fuse/internal/buffer.OutMessage
的用法示例。
在下文中一共展示了OutMessage.Len方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: kernelResponse
// Fill in the response that should be sent to the kernel, or set noResponse if
// the op requires no response.
func (c *Connection) kernelResponse(
m *buffer.OutMessage,
fuseID uint64,
op interface{},
opErr error) (noResponse bool) {
h := m.OutHeader()
h.Unique = fuseID
// Special case: handle the ops for which the kernel expects no response.
// interruptOp .
switch op.(type) {
case *fuseops.ForgetInodeOp:
noResponse = true
return
case *interruptOp:
noResponse = true
return
}
// If the user returned the error, fill in the error field of the outgoing
// message header.
if opErr != nil {
m.OutHeader().Error = -int32(syscall.EIO)
if errno, ok := opErr.(syscall.Errno); ok {
m.OutHeader().Error = -int32(errno)
}
// Special case: for some types, convertInMessage grew the message in order
// to obtain a destination buffer. Make sure that we shrink back to just
// the header, because on OS X the kernel otherwise returns EINVAL when we
// attempt to write an error response with a length that extends beyond the
// header.
m.ShrinkTo(buffer.OutMessageInitialSize)
}
// Otherwise, fill in the rest of the response.
if opErr == nil {
c.kernelResponseForOp(m, op)
}
h.Len = uint32(m.Len())
return
}