proto

package
v0.0.0-...-4950cc4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2019 License: ISC Imports: 11 Imported by: 0

Documentation

Overview

Package proto provides the definitions and functions used to implement the 9P protocol. The parsing routines within make very few assumptions or decisions, so that it may be used for a wide variety of higher-level packages.

Index

Constants

View Source
const (
	GetAttrMode  = 0x00000001 // Linux chmod(2) mode bits
	GetAttrNlink = 0x00000002

	// New owner, group of the file as described in Linux chown(2).
	GetAttrUid = 0x00000004
	GetAttrGid = 0x00000008

	GetAttrRdev  = 0x00000010
	GetAttrAtime = 0x00000020 // Time of last file access.
	GetAttrMtime = 0x00000040 // Time of last file modification.
	GetAttrCtime = 0x00000080
	GetAttrIno   = 0x00000100

	// New file size as handled by Linux truncate(2).
	GetAttrSize        = 0x00000200
	GetAttrBlocks      = 0x00000400
	GetAttrBtime       = 0x00000800
	GetAttrGen         = 0x00001000
	GetAttrDataVersion = 0x00002000

	GetAttrBasic = 0x000007ff
	GetAttrAll   = 0x00003fff
)

Represents getattr mask values.

View Source
const (
	SetAttrMode     = 0x00000001
	SetAttrUid      = 0x00000002
	SetAttrGid      = 0x00000004
	SetAttrSize     = 0x00000008
	SetAttrAtime    = 0x00000010
	SetAttrMtime    = 0x00000020
	SetAttrCtime    = 0x00000040
	SetAttrAtimeSet = 0x00000080
	SetAttrMtimeSet = 0x00000100
)

Represents setattr mask values.

View Source
const (
	// FixedReadWriteSize is the length of all fixed-width fields in a
	// Twrite or Tread message. Twrite and Tread messages are defined as
	//
	//     size[4] Twrite tag[2] fid[4] offset[8] count[4] data[count]
	//     size[4] Tread  tag[2] fid[4] offset[8] count[4]
	//
	FixedReadWriteSize = HeaderSize + 4 + 8 + 4 // 23

	// MaxDataSize is the maximum data size of a Twrite or Rread message.
	MaxDataSize = math.MaxInt32 - (FixedReadWriteSize + 1) // ~ 2GB

	// MaxNameSize is the maximum length of a filename/username in bytes.
	MaxNameSize = math.MaxUint8

	// MaxNames is the maximum allowed number of path elements in a Twalk
	// request.
	MaxNames = 16

	// MaxMessageSize is the maximum size of a 9P message (Twrite).
	MaxMessageSize = (FixedReadWriteSize + 1) + MaxDataSize

	// MinMessageSize is the minimum size of a 9P Message (Twalk).
	MinMessageSize = HeaderSize + 4 + 4 + 2 + MaxNames*(2+MaxNameSize)

	// DefaultMaxDataSize is the default maximum data size of a Twrite or
	// Rread message.
	DefaultMaxDataSize = 2 * 1024 * 1024 // ~ 2MB

	// DefaultMaxMessageSize is the default maximum size of a 9P2000.L
	// message.
	DefaultMaxMessageSize = (FixedReadWriteSize + 1) + DefaultMaxDataSize

	// HeaderSize is the number of bytes required for a header.
	HeaderSize = 7
)
View Source
const (
	// NoFid is a reserved fid used in a Tattach request for the afid
	// field, that indicates that the client does not wish to
	// authenticate the session.
	NoFid = math.MaxUint32

	// NoUid indicates a invalid user id.
	NoUid = math.MaxUint32

	// NoGid indicates a invalid group id.
	NoGid = math.MaxUint32

	// NoTag is the tag for Tversion and Rversion messages.
	NoTag = math.MaxUint16
)
View Source
const (
	// ErrMessageTooLarge is returned during the parsing process if a
	// message exceeds the maximum size negotiated during the
	// Tversion/Rversion transaction.
	ErrMessageTooLarge = Error("message too large")

	// ErrMessageTooSmall is returned during the parsing process if a
	// message is too small.
	ErrMessageTooSmall = Error("message too small")
)
View Source
const (
	TypeDirectory  = 0x80
	TypeAppendOnly = 0x40
	TypeExclusive  = 0x20
	TypeMount      = 0x10
	TypeAuth       = 0x08
	TypeTemporary  = 0x04
	TypeSymlink    = 0x02
	TypeLink       = 0x01
	TypeRegular    = 0x00
)

Qid type field represents the type of a file (directory, etc.), represented as a bit vector corresponding to the high 8 bits of the file mode word.

View Source
const Version = "9P2000.L"

Version defines the protocol version string.

Variables

This section is empty.

Functions

func DecodeRgetattr

func DecodeRgetattr(buf *binary.Buffer, valid *uint64, st *unix.Stat_t) error

DecodeRgetattr decodes information about a file system object. Valid is a bitmask indicating which fields are valid in the response.

func EncodeRgetattr

func EncodeRgetattr(buf *binary.Buffer, valid uint64, st *unix.Stat_t) error

EncodeRgetattr encodes information about a file system object. Valid is a bitmask indicating which fields are valid in the response.

func EncodeRstatfs

func EncodeRstatfs(buf *binary.Buffer, st *unix.Statfs_t) error

EncodeRstatfs encodes information about a file system. The byte sequence follow pretty closely the fields returned by the Linux statfs(2) system call.

func NewUnixMode

func NewUnixMode(mode Mode) uint32

NewUnixMode returns a mode_t from a Mode.

func Release

func Release(fcall ...*Fcall)

Release resets all state and adds all fcalls to their pool.

func UnixDirTypeToQidType

func UnixDirTypeToQidType(typ uint8) uint8

UnixDirTypeToQidType converts an unix directory type.

func UnixFileTypeToQidType

func UnixFileTypeToQidType(mode uint32) uint8

UnixFileTypeToQidType converts an unix file type.

Types

type Decoder

type Decoder struct {
	MaxMessageSize uint32
	// contains filtered or unexported fields
}

Decoder manages the receipt of type and data information read from the remote side of a connection.

func NewDecoder

func NewDecoder(r io.Reader, msize uint32) *Decoder

NewDecoder returns a new decoder that decodes from the io.Reader. Msize defines the maximum message size if greater than zero.

func (*Decoder) Decode

func (d *Decoder) Decode(m Message) error

Decode decodes the next 9P message from the input stream and stores it in the data represented by the empty interface m. If m is nil, the value will be discarded. Otherwise, the value underlying m must be a pointer to the correct type for the next 9P message received. If the input is at EOF, Decode returns io.EOF and does not modify e.

func (*Decoder) DecodeHeader

func (d *Decoder) DecodeHeader() (MessageType, uint16, error)

DecodeHeader decodes the next 9P header from the input stream. DecodeHeader and Decode must be called in pairs to read 9P messages from the connection.

func (*Decoder) Reset

func (d *Decoder) Reset(r io.Reader)

Reset discards any buffered data, resets all state, and switches the Decoder to read from r.

type Encoder

type Encoder struct {
	MaxMessageSize uint32
	// contains filtered or unexported fields
}

Encoder manages the transmission of type and data information to the other side of a connection. Encoder is safe for concurrent use by multiple goroutines.

func NewEncoder

func NewEncoder(w io.Writer, msize uint32) *Encoder

NewEncoder returns a new encoder that will transmit on the io.Writer. Msize defines the maximum message size if greater than zero.

func (*Encoder) Encode

func (e *Encoder) Encode(tag uint16, m Message) error

Encode encodes a 9P header and message to the connection.

func (*Encoder) Reset

func (e *Encoder) Reset(w io.Writer)

Reset discards any unflushed buffered data, clears any error, and resets Encoder to write its output to w.

type Error

type Error string

Error represents a 9P protocol error.

func (Error) Error

func (e Error) Error() string

type Fcall

type Fcall struct {
	// The argument to the 9P function and used to determine the message
	// type.
	Tx Message

	Rx Message // The reply from the function.

	Err error
	C   chan *Fcall
}

Fcall represents an active 9P RPC.

func Alloc

func Alloc(t MessageType) (*Fcall, bool)

Alloc returns a new fcall object from the internal pool. Alloc is safe for use by multiple goroutines simultaneously.

func (*Fcall) Reset

func (f *Fcall) Reset()

Reset resets all state.

type Flag

type Flag uint32

Flag is the mode passed to Open and Create operations. These correspond to bits sent over the wire.

const (
	// FlagModeMask is a mask of valid Flag mode bits.
	FlagModeMask Flag = 0x3

	// FlagReadOnly flag is indicating read-only mode.
	FlagReadOnly Flag = 0x0

	// FlagWriteOnly flag is indicating write-only mode.
	FlagWriteOnly Flag = 0x1

	// FlagReadWrite flag is indicating read-write mode.
	FlagReadWrite Flag = 0x2

	// FlagAppend opens the file in append mode. Before each write, the
	// file offset is positioned at the end of the file. The
	// modification of the file offset and the write operation are
	// performed as a single atomic step.
	FlagAppend Flag = 0x400

	// FlagTruncate is indicating to truncate file when opened, if
	// possible.
	FlagTruncate Flag = 0x200

	// FlagSync is indicating to open for synchronous I/O.
	FlagSync Flag = 0x101000
)

func NewFlag

func NewFlag(flags int) Flag

NewFlag returns a Flag from an int compatible with open(2).

func (Flag) Flags

func (f Flag) Flags() int

Flags converts a Flag to an int compatible with open(2).

type Message

type Message interface {
	MessageType() MessageType

	// Len returns the length of the message in bytes.
	Len() int

	// Encode encodes to the given binary.Buffer.
	Encode(*binary.Buffer)

	// Decode decodes from the given binary.Buffer.
	Decode(*binary.Buffer)

	// Reset resets all state.
	Reset()
}

Message represents a 9P message and is used to access fields common to all 9P messages.

type MessageType

type MessageType uint8

MessageType represents a 9P message type identifier.

const (
	MessageTversion MessageType = 100 + iota
	MessageRversion
	MessageTauth
	MessageRauth
	MessageTattach
	MessageRattach
	MessageTerror // illegal
	MessageRerror
	MessageTflush
	MessageRflush
	MessageTwalk
	MessageRwalk
	MessageTopen
	MessageRopen
	MessageTcreate
	MessageRcreate
	MessageTread
	MessageRread
	MessageTwrite
	MessageRwrite
	MessageTclunk
	MessageRclunk
	MessageTremove
	MessageRremove
	MessageTstat
	MessageRstat
	MessageTwstat
	MessageRwstat

	MessageTlauth   MessageType = 102
	MessageRlauth   MessageType = 103
	MessageTlattach MessageType = 104
	MessageRlattach MessageType = 105

	MessageRlerror      MessageType = 7
	MessageTstatfs      MessageType = 8
	MessageRstatfs      MessageType = 9
	MessageTlopen       MessageType = 12
	MessageRlopen       MessageType = 13
	MessageTlcreate     MessageType = 14
	MessageRlcreate     MessageType = 15
	MessageTsymlink     MessageType = 16
	MessageRsymlink     MessageType = 17
	MessageTmknod       MessageType = 18
	MessageRmknod       MessageType = 19
	MessageTrename      MessageType = 20
	MessageRrename      MessageType = 21
	MessageTreadlink    MessageType = 22
	MessageRreadlink    MessageType = 23
	MessageTgetattr     MessageType = 24
	MessageRgetattr     MessageType = 25
	MessageTsetattr     MessageType = 26
	MessageRsetattr     MessageType = 27
	MessageTxattrwalk   MessageType = 30
	MessageRxattrwalk   MessageType = 31
	MessageTxattrcreate MessageType = 32
	MessageRxattrcreate MessageType = 33
	MessageTreaddir     MessageType = 40
	MessageRreaddir     MessageType = 41
	MessageTfsync       MessageType = 50
	MessageRfsync       MessageType = 51
	MessageTlock        MessageType = 52
	MessageRlock        MessageType = 53
	MessageTgetlock     MessageType = 54
	MessageRgetlock     MessageType = 55
	MessageTlink        MessageType = 70
	MessageRlink        MessageType = 71
	MessageTmkdir       MessageType = 72
	MessageRmkdir       MessageType = 73
	MessageTrenameat    MessageType = 74
	MessageRrenameat    MessageType = 75
	MessageTunlinkat    MessageType = 76
	MessageRunlinkat    MessageType = 77
)

Defines message type identifiers.

func (MessageType) String

func (t MessageType) String() string

type Mode

type Mode uint32

Mode are flags corresponding to file modes. These correspond to bits sent over the wire and also to mode_t bits.

const (
	// ModeMask is a mask of all the file mode bits of Mode.
	ModeMask Mode = 0170000

	// ModeRegular is a mode bit for regular files.
	ModeRegular Mode = 0100000

	// ModeDirectory is a mode bit for directories.
	ModeDirectory Mode = 040000

	// ModeSymlink is a mode bit for a symlink.
	ModeSymlink Mode = 0120000

	// ModeBlockDevice is a mode bit for block devices.
	ModeBlockDevice Mode = 060000

	// ModeCharacterDevice is a mode bit for a character device.
	ModeCharacterDevice Mode = 020000

	// ModeSocket is an mode bit for a socket.
	ModeSocket Mode = 0140000

	// ModeNamedPipe is a mode bit for a named pipe.
	ModeNamedPipe Mode = 010000

	// ModeGroupID has several special uses. For a directory, it
	// indicates that BSD semantics is to be used for that directory:
	// files created there inherit their group ID from the directory,
	// not from the effective group ID of the creating process, and
	// directories created there will also get the ModeGroupID bit
	// set.
	ModeGroupID Mode = 0x400
	ModeUserID  Mode = 0x800
	ModeSticky  Mode = 0x200

	ModePerm = 0777 // Unix permission bits
)

Flags corresponding to file modes. These correspond to bits sent over the wire and also correspond to mode_t bits.

func NewMode

func NewMode(mode os.FileMode) Mode

NewMode returns a Mode from an os.FileMode.

func NewModeUnix

func NewModeUnix(mode uint32) Mode

NewModeUnix returns a Mode from a mode_t.

func (Mode) FileMode

func (m Mode) FileMode() os.FileMode

FileMode converts a 9P2000.L file mode to an os.FileMode.

func (Mode) String

func (m Mode) String() string

type Payloader

type Payloader interface {
	Message

	// Payload returns the payload for sending.
	Payload() []byte

	// PutPayload sets the decoded payload.
	PutPayload([]byte)

	// FixedLen returns the length of the message in bytes without the
	// count-delimited payload.
	FixedLen() int
}

Payloader is a special message which may include an inline payload.

type Qid

type Qid struct {
	Type uint8 // type of a file (directory, etc)

	// Version is a version:number for a file. It is incremented every
	// time a file is modified. By convention, synthetic files usually
	// have a version number of 0. Traditional files have a version
	// numb:r that is a hash of their modification time.
	Version uint32

	// Path is an integer unique among all files in the hierarchy. If
	// a file is deleted and recreated with the same name in the same
	// directory, the old and new path components of the qids should
	// be different.
	Path uint64
}

Qid represents the server's unique identification for the file being accessed. Two files on the same server hierarchy are the same if and only if their qids are the same.

func StatToQid

func StatToQid(st *unix.Stat_t) Qid

StatToQid converts an unix.Stat_t.

func (*Qid) Decode

func (q *Qid) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Qid) Encode

func (q Qid) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Qid) IsDir

func (q Qid) IsDir() bool

IsDir reports whether q describes a directory.

func (Qid) Len

func (q Qid) Len() int

Len returns the length of the message in bytes.

func (Qid) Marshal

func (q Qid) Marshal(data []byte) ([]byte, int, error)

Marshal implements binary.Marshaler.

func (*Qid) Reset

func (q *Qid) Reset()

Reset resets all state.

func (Qid) String

func (q Qid) String() string

func (*Qid) Unmarshal

func (q *Qid) Unmarshal(data []byte) ([]byte, error)

Unmarshal implements binary.Unmarshaler.

type Rclunk

type Rclunk struct{}

Rclunk message contains a servers response to a Tclunk request.

func (*Rclunk) Decode

func (m *Rclunk) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rclunk) Encode

func (m Rclunk) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rclunk) Len

func (m Rclunk) Len() int

Len returns the length of the message in bytes.

func (Rclunk) MessageType

func (m Rclunk) MessageType() MessageType

MessageType returns the message type.

func (*Rclunk) Reset

func (m *Rclunk) Reset()

Reset resets all state.

func (Rclunk) String

func (m Rclunk) String() string

String implements fmt.Stringer.

type Rflush

type Rflush struct{}

Rflush echoes the tag (not oldtag) of the Tflush message.

func (*Rflush) Decode

func (m *Rflush) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rflush) Encode

func (m Rflush) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rflush) Len

func (m Rflush) Len() int

Len returns the length of the message in bytes.

func (Rflush) MessageType

func (m Rflush) MessageType() MessageType

MessageType returns the message type.

func (*Rflush) Reset

func (m *Rflush) Reset()

Reset resets all state.

func (Rflush) String

func (m Rflush) String() string

String implements fmt.Stringer.

type Rfsync

type Rfsync struct{}

Rfsync message contains a server's reply to a Tfsync message.

func (*Rfsync) Decode

func (m *Rfsync) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rfsync) Encode

func (m Rfsync) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rfsync) Len

func (m Rfsync) Len() int

Len returns the length of the message in bytes.

func (Rfsync) MessageType

func (m Rfsync) MessageType() MessageType

MessageType returns the message type.

func (*Rfsync) Reset

func (m *Rfsync) Reset()

Reset resets all state.

func (Rfsync) String

func (m Rfsync) String() string

String implements fmt.Stringer.

type Rgetattr

type Rgetattr struct {
	// Valid is a bitmask indicating which fields are valid in the
	// response.
	Valid uint64

	*unix.Stat_t
}

Rgetattr describes a file system object. The fields follow pretty closely the fields returned by the Linux stat(2) system call.

func (*Rgetattr) Decode

func (m *Rgetattr) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rgetattr) Encode

func (m Rgetattr) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rgetattr) IsDir

func (m Rgetattr) IsDir() bool

IsDir reports whether m describes a directory. That is, it tests for the ModeDir bit being set in m.

func (Rgetattr) Len

func (m Rgetattr) Len() int

Len returns the length of the message in bytes.

func (Rgetattr) MessageType

func (m Rgetattr) MessageType() MessageType

MessageType returns the message type.

func (*Rgetattr) Reset

func (m *Rgetattr) Reset()

Reset resets all state.

func (Rgetattr) String

func (m Rgetattr) String() string

type Rgetlock

type Rgetlock struct {
	Type     uint8
	Start    uint64
	Length   uint64
	ProcID   uint32
	ClientID string
}

Rgetlock message contains a server's reply to a Tgetlock message.

func (*Rgetlock) Decode

func (m *Rgetlock) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rgetlock) Encode

func (m Rgetlock) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rgetlock) Len

func (m Rgetlock) Len() int

Len returns the length of the message in bytes.

func (Rgetlock) MessageType

func (m Rgetlock) MessageType() MessageType

MessageType returns the message type.

func (*Rgetlock) Reset

func (m *Rgetlock) Reset()

Reset resets all state.

func (Rgetlock) String

func (m Rgetlock) String() string

String implements fmt.Stringer.

type Rlattach

type Rlattach struct {
	Qid
}

Rlattach message contains a server's reply to a Tlattach request. As a result of the attach transaction, the client will have a connection to the root directory of the desired file tree, represented by the returned qid.

func (*Rlattach) Decode

func (m *Rlattach) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rlattach) Encode

func (m Rlattach) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rlattach) Len

func (m Rlattach) Len() int

Len returns the length of the message in bytes.

func (Rlattach) MessageType

func (m Rlattach) MessageType() MessageType

MessageType returns the message type.

func (*Rlattach) Reset

func (m *Rlattach) Reset()

Reset resets all state.

func (Rlattach) String

func (m Rlattach) String() string

String implements fmt.Stringer.

type Rlauth

type Rlauth struct {
	Qid
}

Rlauth reply is sent in response to a Tlauth request. If a server does not require authentication, it can reply to a Tlauth message with an Rerror message.

func (*Rlauth) Decode

func (m *Rlauth) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rlauth) Encode

func (m Rlauth) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rlauth) Len

func (m Rlauth) Len() int

Len returns the length of the message in bytes.

func (Rlauth) MessageType

func (m Rlauth) MessageType() MessageType

MessageType returns the message type.

func (*Rlauth) Reset

func (m *Rlauth) Reset()

Reset resets all state.

func (Rlauth) String

func (m Rlauth) String() string

String implements fmt.Stringer.

type Rlcreate

type Rlcreate struct {
	Qid
	Iounit uint32
}

Rlcreate message contains a server's reply to a Tlcreate request. The qid for the new file is returned in the reply.

func (*Rlcreate) Decode

func (m *Rlcreate) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rlcreate) Encode

func (m Rlcreate) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rlcreate) Len

func (m Rlcreate) Len() int

Len returns the length of the message in bytes.

func (Rlcreate) MessageType

func (m Rlcreate) MessageType() MessageType

MessageType returns the message type.

func (*Rlcreate) Reset

func (m *Rlcreate) Reset()

Reset resets all state.

func (Rlcreate) String

func (m Rlcreate) String() string

String implements fmt.Stringer.

type Rlerror

type Rlerror struct {
	Errno uint32
}

Rlerror message (there is no Tlerror) is used to return an errno number describing the failure of a transaction.

func (*Rlerror) Decode

func (m *Rlerror) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rlerror) Encode

func (m Rlerror) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rlerror) Len

func (m Rlerror) Len() int

Len returns the length of the message in bytes.

func (Rlerror) MessageType

func (m Rlerror) MessageType() MessageType

MessageType returns the message type.

func (*Rlerror) Reset

func (m *Rlerror) Reset()

Reset resets all state.

func (Rlerror) String

func (m Rlerror) String() string

String implements fmt.Stringer.

type Rlink struct{}

Rlink message contains a server's reply to a Tlink message.

func (*Rlink) Decode

func (m *Rlink) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rlink) Encode

func (m Rlink) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rlink) Len

func (m Rlink) Len() int

Len returns the length of the message in bytes.

func (Rlink) MessageType

func (m Rlink) MessageType() MessageType

MessageType returns the message type.

func (*Rlink) Reset

func (m *Rlink) Reset()

Reset resets all state.

func (Rlink) String

func (m Rlink) String() string

String implements fmt.Stringer.

type Rlock

type Rlock struct {
	Status uint8
}

Rlock message contains a server's reply to a Tlock message.

func (*Rlock) Decode

func (m *Rlock) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rlock) Encode

func (m Rlock) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rlock) Len

func (m Rlock) Len() int

Len returns the length of the message in bytes.

func (Rlock) MessageType

func (m Rlock) MessageType() MessageType

MessageType returns the message type.

func (*Rlock) Reset

func (m *Rlock) Reset()

Reset resets all state.

func (Rlock) String

func (m Rlock) String() string

String implements fmt.Stringer.

type Rlopen

type Rlopen struct {
	Qid
	Iounit uint32
}

Rlopen message contains a server's reply to a Tlopen request.

func (*Rlopen) Decode

func (m *Rlopen) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rlopen) Encode

func (m Rlopen) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rlopen) Len

func (m Rlopen) Len() int

Len returns the length of the message in bytes.

func (Rlopen) MessageType

func (m Rlopen) MessageType() MessageType

MessageType returns the message type.

func (*Rlopen) Reset

func (m *Rlopen) Reset()

Reset resets all state.

func (Rlopen) String

func (m Rlopen) String() string

String implements fmt.Stringer.

type Rmkdir

type Rmkdir struct {
	Qid
}

Rmkdir message contains a server's reply to a Tmkdir message.

func (*Rmkdir) Decode

func (m *Rmkdir) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rmkdir) Encode

func (m Rmkdir) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rmkdir) Len

func (m Rmkdir) Len() int

Len returns the length of the message in bytes.

func (Rmkdir) MessageType

func (m Rmkdir) MessageType() MessageType

MessageType returns the message type.

func (*Rmkdir) Reset

func (m *Rmkdir) Reset()

Reset resets all state.

func (Rmkdir) String

func (m Rmkdir) String() string

String implements fmt.Stringer.

type Rmknod

type Rmknod struct {
	Qid
}

Rmknod message contains a server's reply to a Tmknod request. The qid for the new device node is returned in the reply.

func (*Rmknod) Decode

func (m *Rmknod) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rmknod) Encode

func (m Rmknod) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rmknod) Len

func (m Rmknod) Len() int

Len returns the length of the message in bytes.

func (Rmknod) MessageType

func (m Rmknod) MessageType() MessageType

MessageType returns the message type.

func (*Rmknod) Reset

func (m *Rmknod) Reset()

Reset resets all state.

func (Rmknod) String

func (m Rmknod) String() string

String implements fmt.Stringer.

type Rread

type Rread struct {
	Data []byte
}

Rread message returns the bytes requested by a Tread message.

func (*Rread) Decode

func (m *Rread) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rread) Encode

func (m Rread) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rread) FixedLen

func (m Rread) FixedLen() int

FixedLen returns the fixed message size in bytes.

func (Rread) Len

func (m Rread) Len() int

Len returns the length of the message in bytes.

func (Rread) MessageType

func (m Rread) MessageType() MessageType

MessageType returns the message type.

func (Rread) Payload

func (m Rread) Payload() []byte

Payload returns the payload for sending.

func (*Rread) PutPayload

func (m *Rread) PutPayload(b []byte)

PutPayload sets the decoded payload.

func (*Rread) Reset

func (m *Rread) Reset()

Reset resets all state.

func (Rread) String

func (m Rread) String() string

String implements fmt.Stringer.

type Rreaddir

type Rreaddir struct {
	Data []byte
}

Rreaddir message contains a server's reply to a Treaddir message.

func (*Rreaddir) Decode

func (m *Rreaddir) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rreaddir) Encode

func (m Rreaddir) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rreaddir) FixedLen

func (m Rreaddir) FixedLen() int

FixedLen returns the fixed message size in bytes.

func (Rreaddir) Len

func (m Rreaddir) Len() int

Len returns the length of the message in bytes.

func (Rreaddir) MessageType

func (m Rreaddir) MessageType() MessageType

MessageType returns the message type.

func (Rreaddir) Payload

func (m Rreaddir) Payload() []byte

Payload returns the payload for sending.

func (*Rreaddir) PutPayload

func (m *Rreaddir) PutPayload(b []byte)

PutPayload sets the decoded payload.

func (*Rreaddir) Reset

func (m *Rreaddir) Reset()

Reset resets all state.

func (Rreaddir) String

func (m Rreaddir) String() string

String implements fmt.Stringer.

type Rreadlink struct {
	Target string
}

Rreadlink message contains a server's reply to a Treadlink request.

func (*Rreadlink) Decode

func (m *Rreadlink) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rreadlink) Encode

func (m Rreadlink) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rreadlink) Len

func (m Rreadlink) Len() int

Len returns the length of the message in bytes.

func (Rreadlink) MessageType

func (m Rreadlink) MessageType() MessageType

MessageType returns the message type.

func (*Rreadlink) Reset

func (m *Rreadlink) Reset()

Reset resets all state.

func (Rreadlink) String

func (m Rreadlink) String() string

String implements fmt.Stringer.

type Rremove

type Rremove struct{}

Rremove message contains a servers response to a Tremove request. An Rremove message is only sent if the server determined that the requesting user had the proper permissions required for the Tremove to succeed, otherwise Rerror is returned.

func (*Rremove) Decode

func (m *Rremove) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rremove) Encode

func (m Rremove) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rremove) Len

func (m Rremove) Len() int

Len returns the length of the message in bytes.

func (Rremove) MessageType

func (m Rremove) MessageType() MessageType

MessageType returns the message type.

func (*Rremove) Reset

func (m *Rremove) Reset()

Reset resets all state.

func (Rremove) String

func (m Rremove) String() string

String implements fmt.Stringer.

type Rrename

type Rrename struct{}

Rrename message contains a server's reply to a Trename request.

func (*Rrename) Decode

func (m *Rrename) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rrename) Encode

func (m Rrename) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rrename) Len

func (m Rrename) Len() int

Len returns the length of the message in bytes.

func (Rrename) MessageType

func (m Rrename) MessageType() MessageType

MessageType returns the message type.

func (*Rrename) Reset

func (m *Rrename) Reset()

Reset resets all state.

func (Rrename) String

func (m Rrename) String() string

String implements fmt.Stringer.

type Rrenameat

type Rrenameat struct{}

Rrenameat message contains a server's reply to a Trenameat message.

func (*Rrenameat) Decode

func (m *Rrenameat) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rrenameat) Encode

func (m Rrenameat) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rrenameat) Len

func (m Rrenameat) Len() int

Len returns the length of the message in bytes.

func (Rrenameat) MessageType

func (m Rrenameat) MessageType() MessageType

MessageType returns the message type.

func (*Rrenameat) Reset

func (m *Rrenameat) Reset()

Reset resets all state.

func (Rrenameat) String

func (m Rrenameat) String() string

String implements fmt.Stringer.

type Rsetattr

type Rsetattr struct{}

Rsetattr message contains a server's reply to a Tsetattr request.

func (*Rsetattr) Decode

func (m *Rsetattr) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rsetattr) Encode

func (m Rsetattr) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rsetattr) Len

func (m Rsetattr) Len() int

Len returns the length of the message in bytes.

func (Rsetattr) MessageType

func (m Rsetattr) MessageType() MessageType

MessageType returns the message type.

func (*Rsetattr) Reset

func (m *Rsetattr) Reset()

Reset resets all state.

func (Rsetattr) String

func (m Rsetattr) String() string

String implements fmt.Stringer.

type Rstatfs

type Rstatfs struct {
	Type            uint32
	BlockSize       uint32
	Blocks          uint64
	BlocksFree      uint64
	BlocksAvailable uint64
	Files           uint64
	FilesFree       uint64
	FsID            uint64
	NameLength      uint32
}

Rstatfs response corresponds to the fields returned by the statfs(2) system call.

func (*Rstatfs) Decode

func (m *Rstatfs) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rstatfs) Encode

func (m Rstatfs) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rstatfs) Len

func (m Rstatfs) Len() int

Len returns the length of the message in bytes.

func (Rstatfs) MessageType

func (m Rstatfs) MessageType() MessageType

MessageType returns the message type.

func (*Rstatfs) Reset

func (m *Rstatfs) Reset()

Reset resets all state.

func (Rstatfs) String

func (m Rstatfs) String() string

String implements fmt.Stringer.

type Rsymlink struct {
	Qid
}

Rsymlink message contains a server's reply to a Tsymlink request. The qid for the new symbolic link is returned in the reply.

func (*Rsymlink) Decode

func (m *Rsymlink) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rsymlink) Encode

func (m Rsymlink) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rsymlink) Len

func (m Rsymlink) Len() int

Len returns the length of the message in bytes.

func (Rsymlink) MessageType

func (m Rsymlink) MessageType() MessageType

MessageType returns the message type.

func (*Rsymlink) Reset

func (m *Rsymlink) Reset()

Reset resets all state.

func (Rsymlink) String

func (m Rsymlink) String() string

String implements fmt.Stringer.

type Runlinkat

type Runlinkat struct{}

Runlinkat message contains a server's reply to a Tunlinkat message.

func (*Runlinkat) Decode

func (m *Runlinkat) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Runlinkat) Encode

func (m Runlinkat) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Runlinkat) Len

func (m Runlinkat) Len() int

Len returns the length of the message in bytes.

func (Runlinkat) MessageType

func (m Runlinkat) MessageType() MessageType

MessageType returns the message type.

func (*Runlinkat) Reset

func (m *Runlinkat) Reset()

Reset resets all state.

func (Runlinkat) String

func (m Runlinkat) String() string

String implements fmt.Stringer.

type Rversion

type Rversion struct {
	// MessageSize returns the maximum size (in bytes) of any 9P message
	// that it will send or accept, and must be equal to or less than
	// the maximum suggested in the preceding Tversion message. After the
	// Rversion message is received, both sides of the connection must
	// honor this limit.
	MessageSize uint32

	// Version identifies the level of the protocol that the server
	// supports. If a server does not understand the protocol version
	// sent in a Tversion message, Version will return the string
	// "unknown". A server may choose to specify a version that is less
	// than or equal to that supported by the client.
	Version string
}

Rversion reply is sent in response to a Tversion request. It contains the version of the protocol that the server has chosen, and the maximum size of all successive messages.

func (*Rversion) Decode

func (m *Rversion) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rversion) Encode

func (m Rversion) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rversion) Len

func (m Rversion) Len() int

Len returns the length of the message in bytes.

func (Rversion) MessageType

func (m Rversion) MessageType() MessageType

MessageType returns the message type.

func (*Rversion) Reset

func (m *Rversion) Reset()

Reset resets all state.

func (Rversion) String

func (m Rversion) String() string

String implements fmt.Stringer.

type Rwalk

type Rwalk []Qid

Rwalk message contains a server's reply to a successful Twalk request. If the first path in the corresponding Twalk request cannot be walked, an Rerror message is returned instead.

func AllocRwalk

func AllocRwalk() *Rwalk

AllocRwalk selects an arbitrary item from the Rwalk Pool removes it, and returns it to the caller.

func (*Rwalk) Decode

func (m *Rwalk) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer. To simplify the implementation, a maximum of sixteen name elements may be packed in a single message.

func (*Rwalk) Encode

func (m *Rwalk) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer. To simplify the implementation, a maximum of sixteen qid elements may be packed in a single message.

func (Rwalk) Len

func (m Rwalk) Len() int

Len returns the length of the message in bytes.

func (Rwalk) MessageType

func (m Rwalk) MessageType() MessageType

MessageType returns the message type.

func (*Rwalk) Release

func (m *Rwalk) Release()

Release resets all state and adds m to the Rwalk pool.

func (*Rwalk) Reset

func (m *Rwalk) Reset()

Reset resets all state.

func (Rwalk) String

func (m Rwalk) String() string

String implements fmt.Stringer.

type Rwrite

type Rwrite struct {
	Count uint32
}

Rwrite message returns the bytes requested by a Twrite message.

func (*Rwrite) Decode

func (m *Rwrite) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rwrite) Encode

func (m Rwrite) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rwrite) Len

func (m Rwrite) Len() int

Len returns the length of the message in bytes.

func (Rwrite) MessageType

func (m Rwrite) MessageType() MessageType

MessageType returns the message type.

func (*Rwrite) Reset

func (m *Rwrite) Reset()

Reset resets all state.

func (Rwrite) String

func (m Rwrite) String() string

String implements fmt.Stringer.

type Rxattrcreate

type Rxattrcreate struct{}

Rxattrcreate message contains a server's reply to a Txattrcreate request.

func (*Rxattrcreate) Decode

func (m *Rxattrcreate) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rxattrcreate) Encode

func (m Rxattrcreate) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rxattrcreate) Len

func (m Rxattrcreate) Len() int

Len returns the length of the message in bytes.

func (Rxattrcreate) MessageType

func (m Rxattrcreate) MessageType() MessageType

MessageType returns the message type.

func (*Rxattrcreate) Reset

func (m *Rxattrcreate) Reset()

Reset resets all state.

func (Rxattrcreate) String

func (m Rxattrcreate) String() string

String implements fmt.Stringer.

type Rxattrwalk

type Rxattrwalk struct {
	Size uint64
}

Rxattrwalk message contains a server's reply to a Txattrwalk request.

func (*Rxattrwalk) Decode

func (m *Rxattrwalk) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Rxattrwalk) Encode

func (m Rxattrwalk) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Rxattrwalk) Len

func (m Rxattrwalk) Len() int

Len returns the length of the message in bytes.

func (Rxattrwalk) MessageType

func (m Rxattrwalk) MessageType() MessageType

MessageType returns the message type.

func (*Rxattrwalk) Reset

func (m *Rxattrwalk) Reset()

Reset resets all state.

func (Rxattrwalk) String

func (m Rxattrwalk) String() string

String implements fmt.Stringer.

type Tclunk

type Tclunk struct {
	Fid uint32
}

Tclunk request informs the file server that the current file represented by fid is no longer needed by the client. The actual file is not removed on the server unless the fid had been opened with ORCLOSE.

func (*Tclunk) Decode

func (m *Tclunk) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tclunk) Encode

func (m Tclunk) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tclunk) Len

func (m Tclunk) Len() int

Len returns the length of the message in bytes.

func (Tclunk) MessageType

func (m Tclunk) MessageType() MessageType

MessageType returns the message type.

func (*Tclunk) Reset

func (m *Tclunk) Reset()

Reset resets all state.

func (Tclunk) String

func (m Tclunk) String() string

String implements fmt.Stringer.

type Tflush

type Tflush struct {
	OldTag uint16
}

Tflush request is sent to the server to purge the pending response.

func (*Tflush) Decode

func (m *Tflush) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tflush) Encode

func (m Tflush) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tflush) Len

func (m Tflush) Len() int

Len returns the length of the message in bytes.

func (Tflush) MessageType

func (m Tflush) MessageType() MessageType

MessageType returns the message type.

func (*Tflush) Reset

func (m *Tflush) Reset()

Reset resets all state.

func (Tflush) String

func (m Tflush) String() string

String implements fmt.Stringer.

type Tfsync

type Tfsync struct {
	Fid uint32
}

Tfsync flushes any cached data to disk.

func (*Tfsync) Decode

func (m *Tfsync) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tfsync) Encode

func (m Tfsync) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tfsync) Len

func (m Tfsync) Len() int

Len returns the length of the message in bytes.

func (Tfsync) MessageType

func (m Tfsync) MessageType() MessageType

MessageType returns the message type.

func (*Tfsync) Reset

func (m *Tfsync) Reset()

Reset resets all state.

func (Tfsync) String

func (m Tfsync) String() string

String implements fmt.Stringer.

type Tgetattr

type Tgetattr struct {
	Fid uint32

	// RequestMask is a bitmask indicating which fields are requested.
	RequestMask uint64
}

Tgetattr gets attributes of a file system object referenced by fid.

func (*Tgetattr) Decode

func (m *Tgetattr) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tgetattr) Encode

func (m Tgetattr) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tgetattr) Len

func (m Tgetattr) Len() int

Len returns the length of the message in bytes.

func (Tgetattr) MessageType

func (m Tgetattr) MessageType() MessageType

MessageType returns the message type.

func (*Tgetattr) Reset

func (m *Tgetattr) Reset()

Reset resets all state.

func (Tgetattr) String

func (m Tgetattr) String() string

String implements fmt.Stringer.

type Tgetlock

type Tgetlock struct {
	Fid      uint32
	Type     uint8
	Start    uint64
	Length   uint64
	ProcID   uint32
	ClientID string
}

Tgetlock tests for the existence of a POSIX record lock and has semantics similar to Linux fcntl(F_GETLK).

func (*Tgetlock) Decode

func (m *Tgetlock) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tgetlock) Encode

func (m Tgetlock) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tgetlock) Len

func (m Tgetlock) Len() int

Len returns the length of the message in bytes.

func (Tgetlock) MessageType

func (m Tgetlock) MessageType() MessageType

MessageType returns the message type.

func (*Tgetlock) Reset

func (m *Tgetlock) Reset()

Reset resets all state.

func (Tgetlock) String

func (m Tgetlock) String() string

String implements fmt.Stringer.

type Tlattach

type Tlattach struct {
	// Fid establishes a fid to be used as the root of the file tree,
	// should the client's Tlattach request be accepted.
	Fid uint32

	// AuthFid serves to authenticate a user, and must have been
	// established in a previous Tlauth request.
	AuthFid uint32

	// UserName is the user name of the attaching user.
	UserName string

	// Path is the name of the file tree that the client wants to
	// access. It may be empty.
	Path string

	// Uid is the user numerical identifiery of the attaching user.
	Uid uint32
}

Tlattach message serves as a fresh introduction from a user on the client machine to the server.

func (*Tlattach) Decode

func (m *Tlattach) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tlattach) Encode

func (m Tlattach) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tlattach) Len

func (m Tlattach) Len() int

Len returns the length of the message in bytes.

func (Tlattach) MessageType

func (m Tlattach) MessageType() MessageType

MessageType returns the message type.

func (*Tlattach) Reset

func (m *Tlattach) Reset()

Reset resets all state.

func (Tlattach) String

func (m Tlattach) String() string

String implements fmt.Stringer.

type Tlauth

type Tlauth struct {
	// AuthFid serves to authenticate a user, and must have been
	// established in a previous Tlauth request.
	AuthFid uint32

	// UserName is the user name of the attaching user.
	UserName string

	// Path is the name of the file tree that the client wants to
	// access. It may be empty.
	Path string

	// Uid is the user numerical identifiery of the attaching user.
	Uid uint32
}

Tlauth message is used to authenticate users on a connection. If the server does require authentication, it returns aqid defining a file of type QTAUTH that may be read and written to execute an authentication protocol. That protocol's definition is not part of 9P itself.

Once the protocol is complete, the same afid is presented in the attach message for the user, granting entry. The same validated afid may be used for multiple attach messages with the same uname and aname.

func (*Tlauth) Decode

func (m *Tlauth) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tlauth) Encode

func (m Tlauth) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tlauth) Len

func (m Tlauth) Len() int

Len returns the length of the message in bytes.

func (Tlauth) MessageType

func (m Tlauth) MessageType() MessageType

MessageType returns the message type.

func (*Tlauth) Reset

func (m *Tlauth) Reset()

Reset resets all state.

func (Tlauth) String

func (m Tlauth) String() string

String implements fmt.Stringer.

type Tlcreate

type Tlcreate struct {
	Fid   uint32
	Name  string
	Flags Flag
	Perm  Mode
	Gid   uint32
}

Tlcreate creates a regular file name in directory fid and prepares it for I/O. Fid initially represents the parent directory of the new file. After the call it represents the new file. Mode contains Linux creat(2) mode bits. Flags contains Linux open(2) flags bits, e.g. O_RDONLY, O_RDWR, O_WRONLY.

func (*Tlcreate) Decode

func (m *Tlcreate) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tlcreate) Encode

func (m Tlcreate) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tlcreate) Len

func (m Tlcreate) Len() int

Len returns the length of the message in bytes.

func (Tlcreate) MessageType

func (m Tlcreate) MessageType() MessageType

MessageType returns the message type.

func (*Tlcreate) Reset

func (m *Tlcreate) Reset()

Reset resets all state.

func (Tlcreate) String

func (m Tlcreate) String() string

String implements fmt.Stringer.

type Tlink struct {
	DirectoryFid uint32
	Target       uint32
	Name         string
}

Tlink creates a hard link name in directory dfid. The link target is referenced by fid.

func (*Tlink) Decode

func (m *Tlink) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tlink) Encode

func (m Tlink) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tlink) Len

func (m Tlink) Len() int

Len returns the length of the message in bytes.

func (Tlink) MessageType

func (m Tlink) MessageType() MessageType

MessageType returns the message type.

func (*Tlink) Reset

func (m *Tlink) Reset()

Reset resets all state.

func (Tlink) String

func (m Tlink) String() string

String implements fmt.Stringer.

type Tlock

type Tlock struct {
	Fid      uint32
	Type     uint8
	Flags    uint32
	Start    uint64
	Length   uint64
	ProcID   uint32
	ClientID string
}

Tlock acquires or releases a POSIX record lock and has semantics similar to Linux fcntl(F_SETLK).

func (*Tlock) Decode

func (m *Tlock) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tlock) Encode

func (m Tlock) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tlock) Len

func (m Tlock) Len() int

Len returns the length of the message in bytes.

func (Tlock) MessageType

func (m Tlock) MessageType() MessageType

MessageType returns the message type.

func (*Tlock) Reset

func (m *Tlock) Reset()

Reset resets all state.

func (Tlock) String

func (m Tlock) String() string

String implements fmt.Stringer.

type Tlopen

type Tlopen struct {
	Fid   uint32
	Flags Flag
}

Tlopen prepares fid for file I/O. Flags contains Linux open(2) flags bits, e.g. O_RDONLY, O_RDWR, O_WRONLY.

func (*Tlopen) Decode

func (m *Tlopen) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tlopen) Encode

func (m Tlopen) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tlopen) Len

func (m Tlopen) Len() int

Len returns the length of the message in bytes.

func (Tlopen) MessageType

func (m Tlopen) MessageType() MessageType

MessageType returns the message type.

func (*Tlopen) Reset

func (m *Tlopen) Reset()

Reset resets all state.

func (Tlopen) String

func (m Tlopen) String() string

String implements fmt.Stringer.

type Tmkdir

type Tmkdir struct {
	DirectoryFid uint32
	Name         string
	Perm         Mode
	Gid          uint32
}

Tmkdir creates a new directory name in parent directory fid. Mode contains Linux mkdir(2) mode bits. Gid is the effective group ID of the caller.

func (*Tmkdir) Decode

func (m *Tmkdir) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tmkdir) Encode

func (m Tmkdir) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tmkdir) Len

func (m Tmkdir) Len() int

Len returns the length of the message in bytes.

func (Tmkdir) MessageType

func (m Tmkdir) MessageType() MessageType

MessageType returns the message type.

func (*Tmkdir) Reset

func (m *Tmkdir) Reset()

Reset resets all state.

func (Tmkdir) String

func (m Tmkdir) String() string

String implements fmt.Stringer.

type Tmknod

type Tmknod struct {
	DirectoryFid uint32
	Name         string
	Perm         Mode
	Major        uint32
	Minor        uint32
	Gid          uint32
}

Tmknod creates a device node name in directory fid with major and minor numbers. Mode contains Linux mknod(2) mode bits.

func (*Tmknod) Decode

func (m *Tmknod) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tmknod) Encode

func (m Tmknod) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tmknod) Len

func (m Tmknod) Len() int

Len returns the length of the message in bytes.

func (Tmknod) MessageType

func (m Tmknod) MessageType() MessageType

MessageType returns the message type.

func (*Tmknod) Reset

func (m *Tmknod) Reset()

Reset resets all state.

func (Tmknod) String

func (m Tmknod) String() string

String implements fmt.Stringer.

type Tread

type Tread struct {
	Fid    uint32
	Offset uint64
	Count  uint32
}

Tread request asks for count bytes of data from the file, which must be opened for reading, starting offset bytes after the beginning of the file.

func (*Tread) Decode

func (m *Tread) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tread) Encode

func (m Tread) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tread) Len

func (m Tread) Len() int

Len returns the length of the message in bytes.

func (Tread) MessageType

func (m Tread) MessageType() MessageType

MessageType returns the message type.

func (*Tread) Reset

func (m *Tread) Reset()

Reset resets all state.

func (Tread) String

func (m Tread) String() string

String implements fmt.Stringer.

type Treaddir

type Treaddir struct {
	Fid    uint32
	Offset uint64
	Count  uint32
}

Treaddir requests that the server return directory entries from the directory represented by fid, previously opened with Tlopen. Offset is zero on the first call.

Directory entries are represented as variable-length records:

qid[13] offset[8] type[1] name[s]

At most count bytes will be returned in data. If count is not zero in the response, more data is available. On subsequent calls, offset is the offset returned in the last directory entry of the previous call.

func (*Treaddir) Decode

func (m *Treaddir) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Treaddir) Encode

func (m Treaddir) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Treaddir) Len

func (m Treaddir) Len() int

Len returns the length of the message in bytes.

func (Treaddir) MessageType

func (m Treaddir) MessageType() MessageType

MessageType returns the message type.

func (*Treaddir) Reset

func (m *Treaddir) Reset()

Reset resets all state.

func (Treaddir) String

func (m Treaddir) String() string

String implements fmt.Stringer.

type Treadlink struct {
	Fid uint32
}

Treadlink returns the contents of the symbolic link referenced by fid.

func (*Treadlink) Decode

func (m *Treadlink) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Treadlink) Encode

func (m Treadlink) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Treadlink) Len

func (m Treadlink) Len() int

Len returns the length of the message in bytes.

func (Treadlink) MessageType

func (m Treadlink) MessageType() MessageType

MessageType returns the message type.

func (*Treadlink) Reset

func (m *Treadlink) Reset()

Reset resets all state.

func (Treadlink) String

func (m Treadlink) String() string

String implements fmt.Stringer.

type Tremove

type Tremove struct {
	Fid uint32
}

Tremove request asks the file server both to remove a file and to clunk it, even if the remove fails. This request will fail if the client does not have write permission in the parent directory.

func (*Tremove) Decode

func (m *Tremove) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tremove) Encode

func (m Tremove) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tremove) Len

func (m Tremove) Len() int

Len returns the length of the message in bytes.

func (Tremove) MessageType

func (m Tremove) MessageType() MessageType

MessageType returns the message type.

func (*Tremove) Reset

func (m *Tremove) Reset()

Reset resets all state.

func (Tremove) String

func (m Tremove) String() string

String implements fmt.Stringer.

type Trename

type Trename struct {
	Fid          uint32
	DirectoryFid uint32
	Name         string
}

Trename renames a file system object referenced by fid, to name in the directory referenced by directory fid.

func (*Trename) Decode

func (m *Trename) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Trename) Encode

func (m Trename) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Trename) Len

func (m Trename) Len() int

Len returns the length of the message in bytes.

func (Trename) MessageType

func (m Trename) MessageType() MessageType

MessageType returns the message type.

func (*Trename) Reset

func (m *Trename) Reset()

Reset resets all state.

func (Trename) String

func (m Trename) String() string

String implements fmt.Stringer.

type Trenameat

type Trenameat struct {
	OldDirectoryFid uint32
	OldName         string
	NewDirectoryFid uint32
	NewName         string
}

Trenameat changes the name of a file from oldname to newname, possible moving it from old directory represented by fid to new directory represented by new fid.

If the server returns unix.ENOTSUPP, the client should fall back to the rename operation.

func (*Trenameat) Decode

func (m *Trenameat) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Trenameat) Encode

func (m Trenameat) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Trenameat) Len

func (m Trenameat) Len() int

Len returns the length of the message in bytes.

func (Trenameat) MessageType

func (m Trenameat) MessageType() MessageType

MessageType returns the message type.

func (*Trenameat) Reset

func (m *Trenameat) Reset()

Reset resets all state.

func (Trenameat) String

func (m Trenameat) String() string

String implements fmt.Stringer.

type Tsetattr

type Tsetattr struct {
	Fid uint32

	// Valid is a bitmask selecting which fields to set.
	Valid uint32

	Mode Mode   // inode protection mode
	Uid  uint32 // user-id of owner
	Gid  uint32 // group-id of owner
	Size uint64 // file size as handled by Linux truncate(2)

	Atime unix.Timespec // time of last access
	Mtime unix.Timespec // time of last data modification
}

Tsetattr sets attributes of a file system object referenced by fid.

func (*Tsetattr) Decode

func (m *Tsetattr) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tsetattr) Encode

func (m Tsetattr) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tsetattr) Len

func (m Tsetattr) Len() int

Len returns the length of the message in bytes.

func (Tsetattr) MessageType

func (m Tsetattr) MessageType() MessageType

MessageType returns the message type.

func (*Tsetattr) Reset

func (m *Tsetattr) Reset()

Reset resets all state.

func (Tsetattr) String

func (m Tsetattr) String() string

String implements fmt.Stringer.

type Tstatfs

type Tstatfs struct {
	Fid uint32
}

Tstatfs is used to request file system information of the file system containing fid.

func (*Tstatfs) Decode

func (m *Tstatfs) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tstatfs) Encode

func (m Tstatfs) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tstatfs) Len

func (m Tstatfs) Len() int

Len returns the length of the message in bytes.

func (Tstatfs) MessageType

func (m Tstatfs) MessageType() MessageType

MessageType returns the message type.

func (*Tstatfs) Reset

func (m *Tstatfs) Reset()

Reset resets all state.

func (Tstatfs) String

func (m Tstatfs) String() string

String implements fmt.Stringer.

type Tsymlink struct {
	DirectoryFid uint32
	Name         string
	Target       string
	Gid          uint32
}

Tsymlink creates a symbolic link name in directory fid. The link will point to target.

func (*Tsymlink) Decode

func (m *Tsymlink) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tsymlink) Encode

func (m Tsymlink) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tsymlink) Len

func (m Tsymlink) Len() int

Len returns the length of the message in bytes.

func (Tsymlink) MessageType

func (m Tsymlink) MessageType() MessageType

MessageType returns the message type.

func (*Tsymlink) Reset

func (m *Tsymlink) Reset()

Reset resets all state.

func (Tsymlink) String

func (m Tsymlink) String() string

String implements fmt.Stringer.

type Tunlinkat

type Tunlinkat struct {
	DirectoryFid uint32
	Name         string
	Flags        Flag
}

Tunlinkat unlinks name from directory represented by directory fid. If the file is represented by a fid, that fid is not clunked.

If the server returns unix.ENOTSUPP, the client should fall back to the remove operation.

func (*Tunlinkat) Decode

func (m *Tunlinkat) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tunlinkat) Encode

func (m Tunlinkat) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tunlinkat) Len

func (m Tunlinkat) Len() int

Len returns the length of the message in bytes.

func (Tunlinkat) MessageType

func (m Tunlinkat) MessageType() MessageType

MessageType returns the message type.

func (*Tunlinkat) Reset

func (m *Tunlinkat) Reset()

Reset resets all state.

func (Tunlinkat) String

func (m Tunlinkat) String() string

String implements fmt.Stringer.

type Tversion

type Tversion struct {
	// MessageSize returns the maximum length, in bytes, that the client
	// will ever generate or expect to receive in a single 9P message.
	// This count includes all 9P protocol data, starting from the size
	// field and extending through the message, but excludes enveloping
	// transport protocols.
	MessageSize uint32

	// Version identifies the level of the protocol that the client
	// supports. The string must always begin with the two characters
	// "9P".
	Version string
}

Tversion request negotiates the protocol version and message size to be used on the connection and initializes the connection for I/O. Tversion must be the first message sent on the 9P connection, and the client cannot issue any further requests until it has received the Rversion reply.

func (*Tversion) Decode

func (m *Tversion) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Tversion) Encode

func (m Tversion) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Tversion) Len

func (m Tversion) Len() int

Len returns the length of the message in bytes.

func (Tversion) MessageType

func (m Tversion) MessageType() MessageType

MessageType returns the message type.

func (*Tversion) Reset

func (m *Tversion) Reset()

Reset resets all state.

func (Tversion) String

func (m Tversion) String() string

String implements fmt.Stringer.

type Twalk

type Twalk struct {
	// Fid must have been established by a previous transaction, such as
	// an Tattach.
	Fid uint32

	// NewFid contains the proposed fid that the client wishes to
	// associate with the result of traversing the directory hierarchy.
	NewFid uint32

	// Names contains an ordered list of path name elements that the
	// client wishes to descend into in succession.
	//
	// To simplify the implementation, a maximum of sixteen name elements
	// may be packed in a single message
	Names []string
}

Twalk message is used to descend a directory hierarchy.

func (*Twalk) Decode

func (m *Twalk) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer. To simplify the implementation, a maximum of sixteen name elements may be packed in a single message.

func (Twalk) Encode

func (m Twalk) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer. To simplify the implementation, a maximum of sixteen name elements may be packed in a single message.

func (Twalk) Len

func (m Twalk) Len() int

Len returns the length of the message in bytes.

func (Twalk) MessageType

func (m Twalk) MessageType() MessageType

MessageType returns the message type.

func (*Twalk) Reset

func (m *Twalk) Reset()

Reset resets all state.

func (Twalk) String

func (m Twalk) String() string

String implements fmt.Stringer.

type Twrite

type Twrite struct {
	Fid    uint32
	Offset uint64
	Data   []byte
}

Twrite message is sent by a client to write data to a file.

func (*Twrite) Decode

func (m *Twrite) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Twrite) Encode

func (m Twrite) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Twrite) FixedLen

func (m Twrite) FixedLen() int

FixedLen returns the fixed message size in bytes.

func (Twrite) Len

func (m Twrite) Len() int

Len returns the length of the message in bytes.

func (Twrite) MessageType

func (m Twrite) MessageType() MessageType

MessageType returns the message type.

func (Twrite) Payload

func (m Twrite) Payload() []byte

Payload returns the payload for sending.

func (*Twrite) PutPayload

func (m *Twrite) PutPayload(b []byte)

PutPayload sets the decoded payload.

func (*Twrite) Reset

func (m *Twrite) Reset()

Reset resets all state.

func (Twrite) String

func (m Twrite) String() string

String implements fmt.Stringer.

type Txattrcreate

type Txattrcreate struct {
	Fid      uint32
	Name     string
	AttrSize uint64
	Flag     uint32
}

Txattrcreate gets a fid pointing to the xattr name. This fid can later be used to set the xattr value. Flag is derived from set Linux setxattr(2). The manpage says

The flags parameter can be used to refine the semantics of the
operation. XATTR_CREATE specifies a pure create, which fails if
the named attribute exists already. XATTR_REPLACE specifies a
pure replace operation, which fails if the named attribute does
not already exist. By default (no flags), the extended attribute
will be created if need be, or will simply replace the value if
the attribute exists.

The actual setxattr operation happens when the fid is clunked. At that point the written byte count and the attrsize specified in Txattrcreate should be same otherwise an error will be returned.

func (*Txattrcreate) Decode

func (m *Txattrcreate) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Txattrcreate) Encode

func (m Txattrcreate) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Txattrcreate) Len

func (m Txattrcreate) Len() int

Len returns the length of the message in bytes.

func (Txattrcreate) MessageType

func (m Txattrcreate) MessageType() MessageType

MessageType returns the message type.

func (*Txattrcreate) Reset

func (m *Txattrcreate) Reset()

Reset resets all state.

func (Txattrcreate) String

func (m Txattrcreate) String() string

String implements fmt.Stringer.

type Txattrwalk

type Txattrwalk struct {
	Fid    uint32
	NewFid uint32
	Name   string
}

Txattrwalk gets a new fid pointing to xattr name. This fid can later be used to read the xattr value. If name is NULL new fid can be used to get the list of extended attributes associated with the file system object.

func (*Txattrwalk) Decode

func (m *Txattrwalk) Decode(buf *binary.Buffer)

Decode decodes from the given binary.Buffer.

func (Txattrwalk) Encode

func (m Txattrwalk) Encode(buf *binary.Buffer)

Encode encodes to the given binary.Buffer.

func (Txattrwalk) Len

func (m Txattrwalk) Len() int

Len returns the length of the message in bytes.

func (Txattrwalk) MessageType

func (m Txattrwalk) MessageType() MessageType

MessageType returns the message type.

func (*Txattrwalk) Reset

func (m *Txattrwalk) Reset()

Reset resets all state.

func (Txattrwalk) String

func (m Txattrwalk) String() string

String implements fmt.Stringer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL