Documentation ¶
Index ¶
- Constants
- type InMessage
- type OutMessage
- func (m *OutMessage) Append(src []byte)
- func (m *OutMessage) AppendString(src string)
- func (m *OutMessage) Bytes() []byte
- func (m *OutMessage) Grow(n int) (p unsafe.Pointer)
- func (m *OutMessage) GrowNoZero(n int) (p unsafe.Pointer)
- func (m *OutMessage) Len() int
- func (m *OutMessage) OutHeader() *fusekernel.OutHeader
- func (m *OutMessage) Reset()
- func (m *OutMessage) ShrinkTo(n int)
Constants ¶
const MaxReadSize = 1 << 17
The maximum read size that we expect to ever see from the kernel, used for calculating the size of out messages.
For 4 KiB pages, this is 128 KiB (cf. https://goo.gl/HOiEYo)
const MaxWriteSize = 1 << 17
The maximum fuse write request size that InMessage can acommodate.
Experimentally, Linux appears to refuse to honor a MaxWrite setting in an INIT response of more than 128 KiB.
const OutMessageHeaderSize = int(unsafe.Sizeof(fusekernel.OutHeader{}))
OutMessageHeaderSize is the size of the leading header in every properly-constructed OutMessage. Reset brings the message back to this size.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMessage ¶
type InMessage struct {
// contains filtered or unexported fields
}
An incoming message from the kernel, including leading fusekernel.InHeader struct. Provides storage for messages and convenient access to their contents.
func (*InMessage) Consume ¶
Consume the next n bytes from the message, returning a nil pointer if there are fewer than n bytes available.
func (*InMessage) ConsumeBytes ¶
Equivalent to Consume, except returns a slice of bytes. The result will be nil if Consume would fail.
func (*InMessage) Header ¶
func (m *InMessage) Header() (h *fusekernel.InHeader)
Return a reference to the header read in the most recent call to Init.
type OutMessage ¶
type OutMessage struct {
// contains filtered or unexported fields
}
OutMessage provides a mechanism for constructing a single contiguous fuse message from multiple segments, where the first segment is always a fusekernel.OutHeader message.
Must be initialized with Reset.
func (*OutMessage) Append ¶
func (m *OutMessage) Append(src []byte)
Append is equivalent to growing by len(src), then copying src over the new segment. Int panics if there is not enough room available.
func (*OutMessage) AppendString ¶
func (m *OutMessage) AppendString(src string)
AppendString is like Append, but accepts string input.
func (*OutMessage) Bytes ¶
func (m *OutMessage) Bytes() []byte
Bytes returns a reference to the current contents of the buffer, including the leading header.
func (*OutMessage) Grow ¶
func (m *OutMessage) Grow(n int) (p unsafe.Pointer)
Grow grows m's buffer by the given number of bytes, returning a pointer to the start of the new segment, which is guaranteed to be zeroed. If there is insufficient space, it returns nil.
func (*OutMessage) GrowNoZero ¶
func (m *OutMessage) GrowNoZero(n int) (p unsafe.Pointer)
GrowNoZero is equivalent to Grow, except the new segment is not zeroed. Use with caution!
func (*OutMessage) Len ¶
func (m *OutMessage) Len() int
Len returns the current size of the message, including the leading header.
func (*OutMessage) OutHeader ¶
func (m *OutMessage) OutHeader() *fusekernel.OutHeader
OutHeader returns a pointer to the header at the start of the message.
func (*OutMessage) Reset ¶
func (m *OutMessage) Reset()
func (*OutMessage) ShrinkTo ¶
func (m *OutMessage) ShrinkTo(n int)
ShrinkTo shrinks m to the given size. It panics if the size is greater than Len() or less than OutMessageHeaderSize.