Documentation ¶
Index ¶
- func SplitBuffer(b []byte) []string
- func SplitSparseBuffer(b []byte) []string
- type CharPtr
- type CharPtrPtr
- type CommandInput
- type CommandOutput
- func (co *CommandOutput) Free()
- func (co *CommandOutput) GoValues() (buf []byte, status string)
- func (co *CommandOutput) OutBuf() CharPtrPtr
- func (co *CommandOutput) OutBufLen() SizeTPtr
- func (co *CommandOutput) Outs() CharPtrPtr
- func (co *CommandOutput) OutsLen() SizeTPtr
- func (co *CommandOutput) SetFreeFunc(f FreeFunc) *CommandOutput
- type FreeFunc
- type Iovec
- type SizeT
- type SizeTPtr
- type StructIovecPtr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SplitBuffer ¶
SplitBuffer splits a byte-slice buffer, typically returned from C code, into a slice of strings. The contents of the buffer are assumed to be null-byte separated. If the buffer contains a sequence of null-bytes it will assume that the "space" between the bytes are meant to be empty strings.
func SplitSparseBuffer ¶
SplitSparseBuffer splits a byte-slice buffer, typically returned from C code, into a slice of strings. The contents of the buffer are assumed to be null-byte separated. This function assumes that buffer to be "sparse" such that only non-null-byte strings will be returned, and no "empty" strings exist if null-bytes are found adjacent to each other.
Types ¶
type CharPtrPtr ¶
CharPtrPtr is an unsafe pointer wrapping C's `char**`.
type CommandInput ¶
type CommandInput struct {
// contains filtered or unexported fields
}
CommandInput can be used to manage the input to ceph's *_command functions.
func NewCommandInput ¶
func NewCommandInput(cmd [][]byte, inputBuffer []byte) *CommandInput
NewCommandInput creates C-level pointers from go byte buffers suitable for passing off to ceph's *_command functions.
func (*CommandInput) Cmd ¶
func (ci *CommandInput) Cmd() CharPtrPtr
Cmd returns an unsafe wrapper around an array of C-strings.
func (*CommandInput) CmdLen ¶
func (ci *CommandInput) CmdLen() SizeT
CmdLen returns the length of the array of C-strings returned by Cmd.
func (*CommandInput) Free ¶
func (ci *CommandInput) Free()
Free any C memory managed by this CommandInput.
func (*CommandInput) InBuf ¶
func (ci *CommandInput) InBuf() CharPtr
InBuf returns an unsafe wrapper to a C char*.
func (*CommandInput) InBufLen ¶
func (ci *CommandInput) InBufLen() SizeT
InBufLen returns the length of the buffer returned by InBuf.
type CommandOutput ¶
type CommandOutput struct {
// contains filtered or unexported fields
}
CommandOutput can be used to manage the outputs of ceph's *_command functions.
func NewCommandOutput ¶
func NewCommandOutput() *CommandOutput
NewCommandOutput returns an empty CommandOutput. The pointers that a CommandOutput provides can be used to get the results of ceph's *_command functions.
func (*CommandOutput) Free ¶
func (co *CommandOutput) Free()
Free any C memory tracked by this object.
func (*CommandOutput) GoValues ¶
func (co *CommandOutput) GoValues() (buf []byte, status string)
GoValues returns native go values converted from the internal C-language values tracked by this object.
func (*CommandOutput) OutBuf ¶
func (co *CommandOutput) OutBuf() CharPtrPtr
OutBuf returns an unsafe wrapper around a pointer to a `char*`.
func (*CommandOutput) OutBufLen ¶
func (co *CommandOutput) OutBufLen() SizeTPtr
OutBufLen returns an unsafe wrapper around a pointer to a size_t.
func (*CommandOutput) Outs ¶
func (co *CommandOutput) Outs() CharPtrPtr
Outs returns an unsafe wrapper around a pointer to a `char*`.
func (*CommandOutput) OutsLen ¶
func (co *CommandOutput) OutsLen() SizeTPtr
OutsLen returns an unsafe wrapper around a pointer to a size_t.
func (*CommandOutput) SetFreeFunc ¶
func (co *CommandOutput) SetFreeFunc(f FreeFunc) *CommandOutput
SetFreeFunc sets the function used to free memory held by CommandOutput. Not all uses of CommandOutput expect to use the basic C.free function and either require or prefer the use of a custom deallocation function. Use SetFreeFunc to change the free function and return the modified CommandOutput object.
type Iovec ¶
type Iovec struct {
// contains filtered or unexported fields
}
Iovec helps manage struct iovec arrays needed by some C functions.
func ByteSlicesToIovec ¶
ByteSlicesToIovec takes a slice of byte slices and returns a new iovec that maps the slice data to struct iovec entries.
func (*Iovec) Pointer ¶
func (v *Iovec) Pointer() StructIovecPtr
Pointer returns a StructIovecPtr that represents the C memory of the underlying array.
type StructIovecPtr ¶
StructIovecPtr is an unsafe pointer wrapping C's `*struct iovec`.