p9

package
v0.0.0-...-f57ed73 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package p9 implements the 9P2000.L protocol used for VirtIO 9P filesystem sharing.

9P2000.L is the Linux variant of the 9P protocol, which uses file identifiers (fids) rather than file descriptors and supports Unix-like file operations.

Index

Constants

View Source
const (
	// Tversion/Rversion - protocol version negotiation
	Tversion = 100
	Rversion = 101

	// Tauth/Rauth - authentication (not commonly used)
	Tauth = 102
	Rauth = 103

	// Tattach/Rattach - attach to filesystem
	Tattach = 104
	Rattach = 105

	// Rerror - error response (9P2000 classic, uses error string)
	Rerror = 107

	// Rlerror - error response (9P2000.L, uses errno directly)
	// Reference: tinyemu-2019-12-21/virtio.c:1992-2000
	Rlerror = 7

	// Tflush/Rflush - flush pending request
	Tflush = 108
	Rflush = 109

	// Twalk/Rwalk - walk filesystem tree
	Twalk = 110
	Rwalk = 111

	// Tread/Rread - read data
	Tread = 116
	Rread = 117

	// Twrite/Rwrite - write data
	Twrite = 118
	Rwrite = 119

	// Tclunk/Rclunk - close fid
	Tclunk = 120
	Rclunk = 121

	// Tremove/Rremove - remove file (deprecated in 9P2000.L)
	Tremove = 122
	Rremove = 123

	// Tstat/Rstat - get attributes (9P2000 style)
	Tstat = 124
	Rstat = 125

	// Twstat/Rwstat - set attributes (9P2000 style)
	Twstat = 126
	Rwstat = 127

	// 9P2000.L extensions
	// Tstatfs/Rstatfs - filesystem statistics
	Tstatfs = 8
	Rstatfs = 9

	// Tlopen/Rlopen - open a file
	Tlopen = 12
	Rlopen = 13

	// Tlcreate/Rlcreate - create a file
	Tlcreate = 14
	Rlcreate = 15

	// Tsymlink/Rsymlink - create symbolic link
	Tsymlink = 16
	Rsymlink = 17

	// Tmknod/Rmknod - create device node
	Tmknod = 18
	Rmknod = 19

	// Trename/Rrename - rename file
	Trename = 20
	Rrename = 21

	// Treadlink/Rreadlink - read symbolic link
	Treadlink = 22
	Rreadlink = 23

	// Tgetattr/Rgetattr - get file attributes
	Tgetattr = 24
	Rgetattr = 25

	// Tsetattr/Rsetattr - set file attributes
	Tsetattr = 26
	Rsetattr = 27

	// Txattrwalk/Rxattrwalk - extended attributes
	Txattrwalk = 30
	Rxattrwalk = 31

	// Txattrcreate/Rxattrcreate - create extended attribute
	Txattrcreate = 32
	Rxattrcreate = 33

	// Treaddir/Rreaddir - read directory entries
	Treaddir = 40
	Rreaddir = 41

	// Tfsync/Rfsync - synchronize file
	Tfsync = 50
	Rfsync = 51

	// Tlock/Rlock - file locking
	Tlock = 52
	Rlock = 53

	// Tgetlock/Rgetlock - get lock status
	Tgetlock = 54
	Rgetlock = 55

	// Tlink/Rlink - create hard link
	Tlink = 70
	Rlink = 71

	// Tmkdir/Rmkdir - create directory
	Tmkdir = 72
	Rmkdir = 73

	// Trenameat/Rrenameat - rename file (relative)
	Trenameat = 74
	Rrenameat = 75

	// Tunlinkat/Runlinkat - remove file or directory
	Tunlinkat = 76
	Runlinkat = 77
)

Protocol message types (T = request, R = response)

View Source
const (
	QtDir     = 0x80 // Directory
	QtAppend  = 0x40 // Append-only file
	QtExcl    = 0x20 // Exclusive use file
	QtMount   = 0x10 // Mounted channel
	QtAuth    = 0x08 // Authentication file
	QtTmp     = 0x04 // Temporary file
	QtSymlink = 0x02 // Symbolic link
	QtLink    = 0x01 // Hard link
	QtFile    = 0x00 // Regular file
)

QID type bits

View Source
const (
	ModeIRWXUGO = 0x01FF
	ModeISVTX   = 0x0200 // Sticky bit
	ModeISGID   = 0x0400 // Set GID
	ModeISUID   = 0x0800 // Set UID

	ModeIFMT  = 0xF000 // Type mask
	ModeIFIFO = 0x1000 // FIFO
	ModeIFCHR = 0x2000 // Character device
	ModeIFDIR = 0x4000 // Directory
	ModeIFBLK = 0x6000 // Block device
	ModeIFREG = 0x8000 // Regular file
	ModeIFLNK = 0xA000 // Symbolic link
	ModeIFSOC = 0xC000 // Socket
)

Mode bits for stat

View Source
const (
	OpenRDONLY    = 0x00000000
	OpenWRONLY    = 0x00000001
	OpenRDWR      = 0x00000002
	OpenNOACCESS  = 0x00000003
	OpenCREAT     = 0x00000040
	OpenEXCL      = 0x00000080
	OpenNOCTTY    = 0x00000100
	OpenTRUNC     = 0x00000200
	OpenAPPEND    = 0x00000400
	OpenNONBLOCK  = 0x00000800
	OpenDSYNC     = 0x00001000
	OpenFASYNC    = 0x00002000
	OpenDIRECT    = 0x00004000
	OpenLARGEFILE = 0x00008000
	OpenDIRECTORY = 0x00010000
	OpenNOFOLLOW  = 0x00020000
	OpenNOATIME   = 0x00040000
	OpenCLOEXEC   = 0x00080000
	OpenSYNC      = 0x00100000
)

Open flags

View Source
const (
	SetattrMode     = 0x00000001
	SetattrUID      = 0x00000002
	SetattrGID      = 0x00000004
	SetattrSize     = 0x00000008
	SetattrAtime    = 0x00000010
	SetattrMtime    = 0x00000020
	SetattrCtime    = 0x00000040
	SetattrAtimeSet = 0x00000080
	SetattrMtimeSet = 0x00000100
)

Setattr mask bits

View Source
const (
	GetattrMode    = 0x00000001
	GetattrNlink   = 0x00000002
	GetattrUID     = 0x00000004
	GetattrGID     = 0x00000008
	GetattrRdev    = 0x00000010
	GetattrAtime   = 0x00000020
	GetattrMtime   = 0x00000040
	GetattrCtime   = 0x00000080
	GetattrIno     = 0x00000100
	GetattrSize    = 0x00000200
	GetattrBlocks  = 0x00000400
	GetattrBtime   = 0x00000800
	GetattrGen     = 0x00001000
	GetattrDataVer = 0x00002000
	GetattrBasic   = 0x000007ff // All basic stats
	GetattrAll     = 0x00003fff // All stats
)

Getattr request mask bits

View Source
const (
	LockTypeRDLCK = 0
	LockTypeWRLCK = 1
	LockTypeUNLCK = 2
)

Lock types

View Source
const (
	LockFlagsBlock   = 1
	LockFlagsReclaim = 2
)

Lock flags

View Source
const (
	LockSuccess = 0
	LockBlocked = 1
	LockError   = 2
	LockGrace   = 3
)

Lock status values

View Source
const (
	EPERM     = 1
	ENOENT    = 2
	EIO       = 5
	EEXIST    = 17
	ENOTDIR   = 20
	EINVAL    = 22
	ENOSPC    = 28
	ENOTEMPTY = 39
	EPROTO    = 71
	ENOTSUP   = 524
)

Error codes (Unix errno values)

View Source
const DefaultMsize = 8192

Maximum message size (default, can be negotiated)

View Source
const HeaderSize = 7

Message header size: 4 (size) + 1 (type) + 2 (tag)

View Source
const NOFID = 0xFFFFFFFF

NOFID is used when no fid is specified

View Source
const NoTag = 0xFFFF

NoTag is a special tag used for Tversion/Rversion messages

Variables

View Source
var ErrInvalidMessage = errors.New("invalid message format")

ErrInvalidMessage indicates the message format is invalid.

View Source
var ErrMessageTooLarge = errors.New("message too large")

ErrMessageTooLarge indicates the message exceeds the maximum size.

View Source
var ErrMessageTooShort = errors.New("message too short")

ErrMessageTooShort indicates the message buffer is too short.

Functions

func DirentSize

func DirentSize(name string) int

DirentSize returns the encoded size of a directory entry.

func ErrorCode

func ErrorCode(err error) uint32

ErrorCode returns the 9P error code from an error, or EIO if unknown.

func MarshalDirent

func MarshalDirent(e *Encoder, d Dirent) error

MarshalDirent marshals a single directory entry. Returns the number of bytes written.

func MarshalHeader

func MarshalHeader(b []byte, h Header)

MarshalHeader writes a 9P message header to a byte slice.

func MarshalRattach

func MarshalRattach(e *Encoder, msg RattachMsg) error

MarshalRattach marshals a Rattach message.

func MarshalRerror

func MarshalRerror(e *Encoder, ecode uint32) error

MarshalRerror marshals an Rerror message.

func MarshalRgetattr

func MarshalRgetattr(e *Encoder, msg RgetattrMsg) error

MarshalRgetattr marshals an Rgetattr message.

func MarshalRgetlock

func MarshalRgetlock(e *Encoder, msg RgetlockMsg) error

MarshalRgetlock marshals an Rgetlock message.

func MarshalRlock

func MarshalRlock(e *Encoder, status uint8) error

MarshalRlock marshals an Rlock message.

func MarshalRlopen

func MarshalRlopen(e *Encoder, msg RlopenMsg) error

MarshalRlopen marshals an Rlopen message.

func MarshalRmkdir

func MarshalRmkdir(e *Encoder, qid QID) error

MarshalRmkdir marshals an Rmkdir message.

func MarshalRread

func MarshalRread(e *Encoder, data []byte) error

MarshalRread marshals an Rread message.

func MarshalRreadlink(e *Encoder, target string) error

MarshalRreadlink marshals an Rreadlink message.

func MarshalRstatfs

func MarshalRstatfs(e *Encoder, st StatFS) error

MarshalRstatfs marshals an Rstatfs message.

func MarshalRversion

func MarshalRversion(e *Encoder, msg RversionMsg) error

MarshalRversion marshals an Rversion message.

func MarshalRwalk

func MarshalRwalk(e *Encoder, msg RwalkMsg) error

MarshalRwalk marshals an Rwalk message.

func MarshalRwrite

func MarshalRwrite(e *Encoder, count uint32) error

MarshalRwrite marshals an Rwrite message.

func MessageTypeName

func MessageTypeName(typ uint8) string

MessageTypeName returns the name of a message type.

func ReadMessage

func ReadMessage(r io.Reader, maxSize uint32) ([]byte, error)

ReadMessage reads a complete 9P message from a reader.

func WriteMessage

func WriteMessage(w io.Writer, msgType uint8, tag uint16, body []byte) error

WriteMessage writes a complete 9P message to a writer.

Types

type Decoder

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

Decoder handles decoding of 9P messages.

func NewDecoder

func NewDecoder(buf []byte) *Decoder

NewDecoder creates a new decoder for the given buffer.

func (*Decoder) GetBytes

func (d *Decoder) GetBytes(n int) ([]byte, error)

GetBytes reads a fixed number of raw bytes.

func (*Decoder) GetQID

func (d *Decoder) GetQID() (QID, error)

GetQID reads a QID (13 bytes).

func (*Decoder) GetStat

func (d *Decoder) GetStat() (Stat, error)

GetStat reads a Stat structure from an Rgetattr response. Reference: tinyemu-2019-12-21/virtio.c:2241-2251 (getattr marshalling) Note: nsec fields are uint64 on the wire but stored as uint32 in the struct.

func (*Decoder) GetString

func (d *Decoder) GetString() (string, error)

GetString reads a string (2-byte length prefix + data).

func (*Decoder) GetUint8

func (d *Decoder) GetUint8() (uint8, error)

GetUint8 reads a uint8.

func (*Decoder) GetUint16

func (d *Decoder) GetUint16() (uint16, error)

GetUint16 reads a little-endian uint16.

func (*Decoder) GetUint32

func (d *Decoder) GetUint32() (uint32, error)

GetUint32 reads a little-endian uint32.

func (*Decoder) GetUint64

func (d *Decoder) GetUint64() (uint64, error)

GetUint64 reads a little-endian uint64.

func (*Decoder) Remaining

func (d *Decoder) Remaining() int

Remaining returns the number of bytes remaining.

func (*Decoder) Reset

func (d *Decoder) Reset(buf []byte)

Reset resets the decoder to read from the beginning.

func (*Decoder) Skip

func (d *Decoder) Skip(n int) error

Skip skips n bytes.

type Dirent

type Dirent struct {
	QID    QID
	Offset uint64 // Offset for next readdir
	Type   uint8  // Entry type
	Name   string
}

Dirent represents a directory entry.

type Encoder

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

Encoder handles encoding of 9P messages.

func NewEncoder

func NewEncoder(buf []byte) *Encoder

NewEncoder creates a new encoder with the given buffer.

func (*Encoder) Bytes

func (e *Encoder) Bytes() []byte

Bytes returns the encoded bytes.

func (*Encoder) Len

func (e *Encoder) Len() int

Len returns the number of bytes written.

func (*Encoder) PutBytes

func (e *Encoder) PutBytes(b []byte) error

PutBytes writes raw bytes.

func (*Encoder) PutQID

func (e *Encoder) PutQID(q QID) error

PutQID writes a QID (1 + 4 + 8 = 13 bytes).

func (*Encoder) PutStat

func (e *Encoder) PutStat(st Stat) error

PutStat writes a Stat structure for Rgetattr response. Reference: tinyemu-2019-12-21/virtio.c:2241-2251 (getattr marshalling) Note: nsec fields are marshalled as uint64 on the wire (matching C behavior), and trailing zeros are added for btime_sec, btime_nsec, gen, data_version.

func (*Encoder) PutString

func (e *Encoder) PutString(s string) error

PutString writes a string (2-byte length prefix + data).

func (*Encoder) PutUint8

func (e *Encoder) PutUint8(v uint8) error

PutUint8 writes a uint8.

func (*Encoder) PutUint16

func (e *Encoder) PutUint16(v uint16) error

PutUint16 writes a little-endian uint16.

func (*Encoder) PutUint32

func (e *Encoder) PutUint32(v uint32) error

PutUint32 writes a little-endian uint32.

func (*Encoder) PutUint64

func (e *Encoder) PutUint64(v uint64) error

PutUint64 writes a little-endian uint64.

func (*Encoder) Reset

func (e *Encoder) Reset()

Reset resets the encoder to write from the beginning.

type FSDevice

type FSDevice interface {
	// Statfs returns filesystem statistics.
	Statfs() (StatFS, error)

	// Attach attaches to the filesystem and returns a root file handle.
	Attach(uid uint32, uname, aname string) (File, QID, error)

	// Walk walks the filesystem tree from f using the given path components.
	// Returns the new file handle and QIDs for each path component walked.
	Walk(f File, names []string) (File, []QID, error)

	// Open opens a file with the given flags.
	Open(f File, flags uint32) (QID, uint32, error) // Returns QID, IOUnit, error

	// Create creates a new file.
	Create(f File, name string, flags, mode, gid uint32) (QID, uint32, error)

	// Read reads data from a file.
	Read(f File, offset uint64, count uint32) ([]byte, error)

	// Write writes data to a file.
	Write(f File, offset uint64, data []byte) (uint32, error)

	// Clunk closes a file handle (releases fid).
	Clunk(f File) error

	// Remove removes a file (and clunks the fid).
	Remove(f File) error

	// Getattr returns file attributes.
	Getattr(f File, mask uint64) (Stat, uint64, error) // Returns stat, valid_mask, error

	// Setattr sets file attributes.
	Setattr(f File, valid uint32, mode, uid, gid uint32, size uint64,
		atimeSec, atimeNsec, mtimeSec, mtimeNsec uint64) error

	// Readdir reads directory entries.
	// Returns directory entries starting at offset, up to count bytes.
	Readdir(f File, offset uint64, count uint32) ([]byte, error)

	// Mkdir creates a directory.
	Mkdir(f File, name string, mode, gid uint32) (QID, error)

	// Symlink creates a symbolic link.
	Symlink(f File, name, target string, gid uint32) (QID, error)

	// Mknod creates a device node.
	Mknod(f File, name string, mode, major, minor, gid uint32) (QID, error)

	// Readlink reads a symbolic link.
	Readlink(f File) (string, error)

	// Link creates a hard link.
	Link(dfid File, f File, name string) error

	// Renameat renames a file.
	Renameat(oldDirF File, oldName string, newDirF File, newName string) error

	// Unlinkat removes a file or directory.
	Unlinkat(f File, name string, flags uint32) error

	// Fsync synchronizes file data.
	Fsync(f File) error

	// Lock applies a file lock.
	Lock(f File, lock *Lock) (uint8, error)

	// Getlock gets lock information.
	Getlock(f File, lock *Lock) (*Lock, error)
}

FSDevice is the interface for 9P filesystem providers. It abstracts filesystem operations for use with the 9P protocol.

type File

type File interface {
	// Path returns the file path (for debugging).
	Path() string
}

File represents an open file handle (fid) in the 9P protocol. This is an opaque handle that the FSDevice implementation uses to track open files.

type Header struct {
	Size uint32 // Total message size including header
	Type uint8  // Message type
	Tag  uint16 // Request tag for matching responses
}

Header represents a 9P message header.

func ParseHeader

func ParseHeader(b []byte) (Header, error)

ParseHeader parses a 9P message header from a byte slice.

type HostFS

type HostFS struct {
	// contains filtered or unexported fields
}

HostFS implements FSDevice by exposing a host directory.

func NewHostFS

func NewHostFS(rootPath string) (*HostFS, error)

NewHostFS creates a new host filesystem rooted at the given path. Reference: tinyemu-2019-12-21/fs_disk.c:623-659

func (*HostFS) Attach

func (h *HostFS) Attach(uid uint32, uname, aname string) (File, QID, error)

Attach attaches to the filesystem.

func (*HostFS) Clunk

func (h *HostFS) Clunk(f File) error

Clunk closes a file handle. Reference: tinyemu-2019-12-21/fs_disk.c:377-386 (fs_close)

func (*HostFS) Create

func (h *HostFS) Create(f File, name string, flags, mode, gid uint32) (QID, uint32, error)

Create creates a new file.

func (*HostFS) Fsync

func (h *HostFS) Fsync(f File) error

Fsync synchronizes file data.

func (*HostFS) Getattr

func (h *HostFS) Getattr(f File, mask uint64) (Stat, uint64, error)

Getattr returns file attributes. Reference: tinyemu-2019-12-21/fs_disk.c:388-410 (fs_stat)

func (*HostFS) Getlock

func (h *HostFS) Getlock(f File, lock *Lock) (*Lock, error)

Getlock gets lock information. Reference: tinyemu-2019-12-21/fs_disk.c:592-615

func (h *HostFS) Link(dfid File, f File, name string) error

Link creates a hard link. Reference: tinyemu-2019-12-21/fs_disk.c:473-484

func (*HostFS) Lock

func (h *HostFS) Lock(f File, lock *Lock) (uint8, error)

Lock applies a file lock. Reference: tinyemu-2019-12-21/fs_disk.c:567-590

func (*HostFS) Mkdir

func (h *HostFS) Mkdir(f File, name string, mode, gid uint32) (QID, error)

Mkdir creates a directory.

func (*HostFS) Mknod

func (h *HostFS) Mknod(f File, name string, mode, major, minor, gid uint32) (QID, error)

Mknod creates a device node. Reference: tinyemu-2019-12-21/fs_disk.c:506-525

func (*HostFS) Open

func (h *HostFS) Open(f File, flags uint32) (QID, uint32, error)

Open opens a file.

func (*HostFS) Read

func (h *HostFS) Read(f File, offset uint64, count uint32) ([]byte, error)

Read reads from a file. Reference: tinyemu-2019-12-21/fs_disk.c:349-361

func (*HostFS) Readdir

func (h *HostFS) Readdir(f File, offset uint64, count uint32) ([]byte, error)

Readdir reads directory entries. Reference: tinyemu-2019-12-21/fs_disk.c:293-347

func (h *HostFS) Readlink(f File) (string, error)

Readlink reads a symbolic link. Reference: tinyemu-2019-12-21/fs_disk.c:527-535

func (*HostFS) Remove

func (h *HostFS) Remove(f File) error

Remove removes a file.

func (*HostFS) Renameat

func (h *HostFS) Renameat(oldDirF File, oldName string, newDirF File, newName string) error

Renameat renames a file. Reference: tinyemu-2019-12-21/fs_disk.c:537-551

func (*HostFS) Setattr

func (h *HostFS) Setattr(f File, valid uint32, mode, uid, gid uint32, size uint64,
	atimeSec, atimeNsec, mtimeSec, mtimeNsec uint64) error

Setattr sets file attributes. Reference: tinyemu-2019-12-21/fs_disk.c:412-471

func (*HostFS) Statfs

func (h *HostFS) Statfs() (StatFS, error)

Statfs returns filesystem statistics.

func (h *HostFS) Symlink(f File, name, target string, gid uint32) (QID, error)

Symlink creates a symbolic link. Reference: tinyemu-2019-12-21/fs_disk.c:486-504

func (*HostFS) Unlinkat

func (h *HostFS) Unlinkat(f File, name string, flags uint32) error

Unlinkat removes a file or directory. Reference: tinyemu-2019-12-21/fs_disk.c:553-565

func (*HostFS) Walk

func (h *HostFS) Walk(f File, names []string) (File, []QID, error)

Walk walks the filesystem tree.

func (*HostFS) Write

func (h *HostFS) Write(f File, offset uint64, data []byte) (uint32, error)

Write writes to a file. Reference: tinyemu-2019-12-21/fs_disk.c:363-375

type Lock

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

Lock represents a file lock.

type QID

type QID struct {
	Type    uint8  // QID type (QtDir, QtFile, etc.)
	Version uint32 // Version number for cache coherence
	Path    uint64 // Unique identifier (like inode number)
}

QID represents a unique file identifier. The QID is comparable to an inode number in Unix.

type RattachMsg

type RattachMsg struct {
	QID QID
}

RattachMsg represents a Rattach response.

type RerrorMsg

type RerrorMsg struct {
	Ecode uint32
}

RerrorMsg represents an Rerror response.

type RgetattrMsg

type RgetattrMsg struct {
	Valid uint64
	Stat  Stat
}

RgetattrMsg represents an Rgetattr response.

type RgetlockMsg

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

RgetlockMsg represents an Rgetlock response.

type RlopenMsg

type RlopenMsg struct {
	QID    QID
	IOUnit uint32
}

RlopenMsg represents an Rlopen response.

type RmkdirMsg

type RmkdirMsg struct {
	QID QID
}

RmkdirMsg represents an Rmkdir response.

type RreadMsg

type RreadMsg struct {
	Data []byte
}

RreadMsg represents an Rread response.

type RversionMsg

type RversionMsg struct {
	Msize   uint32
	Version string
}

RversionMsg represents an Rversion response.

type RwalkMsg

type RwalkMsg struct {
	QIDs []QID
}

RwalkMsg represents an Rwalk response.

type RwriteMsg

type RwriteMsg struct {
	Count uint32
}

RwriteMsg represents an Rwrite response.

type Stat

type Stat struct {
	QID       QID
	Mode      uint32
	UID       uint32
	GID       uint32
	NLink     uint64
	RDev      uint64
	Size      uint64
	BlkSize   uint64
	Blocks    uint64
	AtimeSec  uint64
	AtimeNsec uint32
	MtimeSec  uint64
	MtimeNsec uint32
	CtimeSec  uint64
	CtimeNsec uint32
}

Stat represents file attributes (9P2000.L style).

type StatFS

type StatFS struct {
	Type    uint32 // Filesystem type
	BSize   uint32 // Block size
	Blocks  uint64 // Total blocks
	BFree   uint64 // Free blocks
	BAvail  uint64 // Available blocks (non-root)
	Files   uint64 // Total file nodes
	FFree   uint64 // Free file nodes
	FSid    uint64 // Filesystem ID
	NameLen uint32 // Max filename length
}

StatFS represents filesystem statistics.

type TattachMsg

type TattachMsg struct {
	Fid    uint32
	AFid   uint32 // Auth fid (usually NOFID)
	Uname  string
	Aname  string
	NUname uint32 // Numeric user ID (9P2000.L extension)
}

TattachMsg represents a Tattach request.

func ParseTattach

func ParseTattach(d *Decoder) (TattachMsg, error)

ParseTattach parses a Tattach message body.

type TclunkMsg

type TclunkMsg struct {
	Fid uint32
}

TclunkMsg represents a Tclunk request.

func ParseTclunk

func ParseTclunk(d *Decoder) (TclunkMsg, error)

ParseTclunk parses a Tclunk message body.

type TflushMsg

type TflushMsg struct {
	OldTag uint16
}

TflushMsg represents a Tflush request.

func ParseTflush

func ParseTflush(d *Decoder) (TflushMsg, error)

ParseTflush parses a Tflush message body.

type TfsyncMsg

type TfsyncMsg struct {
	Fid uint32
}

TfsyncMsg represents a Tfsync request.

func ParseTfsync

func ParseTfsync(d *Decoder) (TfsyncMsg, error)

ParseTfsync parses a Tfsync message body.

type TgetattrMsg

type TgetattrMsg struct {
	Fid     uint32
	ReqMask uint64
}

TgetattrMsg represents a Tgetattr request.

func ParseTgetattr

func ParseTgetattr(d *Decoder) (TgetattrMsg, error)

ParseTgetattr parses a Tgetattr message body.

type TgetlockMsg

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

TgetlockMsg represents a Tgetlock request.

func ParseTgetlock

func ParseTgetlock(d *Decoder) (TgetlockMsg, error)

ParseTgetlock parses a Tgetlock message body.

type TlcreateMsg

type TlcreateMsg struct {
	Fid   uint32
	Name  string
	Flags uint32
	Mode  uint32
	GID   uint32
}

TlcreateMsg represents a Tlcreate request.

func ParseTlcreate

func ParseTlcreate(d *Decoder) (TlcreateMsg, error)

ParseTlcreate parses a Tlcreate message body.

type TlinkMsg

type TlinkMsg struct {
	DFid uint32
	Fid  uint32
	Name string
}

TlinkMsg represents a Tlink request.

func ParseTlink(d *Decoder) (TlinkMsg, error)

ParseTlink parses a Tlink message body.

type TlockMsg

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

TlockMsg represents a Tlock request.

func ParseTlock

func ParseTlock(d *Decoder) (TlockMsg, error)

ParseTlock parses a Tlock message body.

type TlopenMsg

type TlopenMsg struct {
	Fid   uint32
	Flags uint32
}

TlopenMsg represents a Tlopen request.

func ParseTlopen

func ParseTlopen(d *Decoder) (TlopenMsg, error)

ParseTlopen parses a Tlopen message body.

type TmkdirMsg

type TmkdirMsg struct {
	DFid uint32
	Name string
	Mode uint32
	GID  uint32
}

TmkdirMsg represents a Tmkdir request.

func ParseTmkdir

func ParseTmkdir(d *Decoder) (TmkdirMsg, error)

ParseTmkdir parses a Tmkdir message body.

type TmknodMsg

type TmknodMsg struct {
	DFid  uint32
	Name  string
	Mode  uint32
	Major uint32
	Minor uint32
	GID   uint32
}

TmknodMsg represents a Tmknod request.

func ParseTmknod

func ParseTmknod(d *Decoder) (TmknodMsg, error)

ParseTmknod parses a Tmknod message body.

type TreadMsg

type TreadMsg struct {
	Fid    uint32
	Offset uint64
	Count  uint32
}

TreadMsg represents a Tread request.

func ParseTread

func ParseTread(d *Decoder) (TreadMsg, error)

ParseTread parses a Tread message body.

type TreaddirMsg

type TreaddirMsg struct {
	Fid    uint32
	Offset uint64
	Count  uint32
}

TreaddirMsg represents a Treaddir request.

func ParseTreaddir

func ParseTreaddir(d *Decoder) (TreaddirMsg, error)

ParseTreaddir parses a Treaddir message body.

type TreadlinkMsg

type TreadlinkMsg struct {
	Fid uint32
}

TreadlinkMsg represents a Treadlink request.

func ParseTreadlink(d *Decoder) (TreadlinkMsg, error)

ParseTreadlink parses a Treadlink message body.

type TrenameatMsg

type TrenameatMsg struct {
	OldDFid uint32
	OldName string
	NewDFid uint32
	NewName string
}

TrenameatMsg represents a Trenameat request.

func ParseTrenameat

func ParseTrenameat(d *Decoder) (TrenameatMsg, error)

ParseTrenameat parses a Trenameat message body.

type TsetattrMsg

type TsetattrMsg struct {
	Fid       uint32
	Valid     uint32
	Mode      uint32
	UID       uint32
	GID       uint32
	Size      uint64
	AtimeSec  uint64
	AtimeNsec uint64
	MtimeSec  uint64
	MtimeNsec uint64
}

TsetattrMsg represents a Tsetattr request.

func ParseTsetattr

func ParseTsetattr(d *Decoder) (TsetattrMsg, error)

ParseTsetattr parses a Tsetattr message body.

type TstatfsMsg

type TstatfsMsg struct {
	Fid uint32
}

TstatfsMsg represents a Tstatfs request.

func ParseTstatfs

func ParseTstatfs(d *Decoder) (TstatfsMsg, error)

ParseTstatfs parses a Tstatfs message body.

type TsymlinkMsg

type TsymlinkMsg struct {
	Fid    uint32
	Name   string
	Target string
	GID    uint32
}

TsymlinkMsg represents a Tsymlink request.

func ParseTsymlink(d *Decoder) (TsymlinkMsg, error)

ParseTsymlink parses a Tsymlink message body.

type TunlinkatMsg

type TunlinkatMsg struct {
	DFid  uint32
	Name  string
	Flags uint32
}

TunlinkatMsg represents a Tunlinkat request.

func ParseTunlinkat

func ParseTunlinkat(d *Decoder) (TunlinkatMsg, error)

ParseTunlinkat parses a Tunlinkat message body.

type TversionMsg

type TversionMsg struct {
	Msize   uint32
	Version string
}

TversionMsg represents a Tversion request.

func ParseTversion

func ParseTversion(d *Decoder) (TversionMsg, error)

ParseTversion parses a Tversion message body.

type TwalkMsg

type TwalkMsg struct {
	Fid    uint32
	NewFid uint32
	Names  []string
}

TwalkMsg represents a Twalk request.

func ParseTwalk

func ParseTwalk(d *Decoder) (TwalkMsg, error)

ParseTwalk parses a Twalk message body.

type TwriteMsg

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

TwriteMsg represents a Twrite request.

func ParseTwrite

func ParseTwrite(d *Decoder) (TwriteMsg, error)

ParseTwrite parses a Twrite message body.

Jump to

Keyboard shortcuts

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