Documentation ¶
Index ¶
- Constants
- Variables
- func PackRattach(buf Buffer, tag uint16, aqid *Qid) error
- func PackRauth(buf Buffer, tag uint16, aqid *Qid) error
- func PackRclunk(buf Buffer, tag uint16) error
- func PackRcreate(buf Buffer, tag uint16, qid *Qid, iounit uint32) error
- func PackRerror(buf Buffer, tag uint16, error string, errornum uint32, dotu bool) error
- func PackRflush(buf Buffer, tag uint16) error
- func PackRopen(buf Buffer, tag uint16, qid *Qid, iounit uint32) error
- func PackRread(buf Buffer, tag uint16, count uint32) error
- func PackRremove(buf Buffer, tag uint16) error
- func PackRstat(buf Buffer, tag uint16, d *Dir, dotu bool) error
- func PackRversion(buf Buffer, tag uint16, msize uint32, version string) error
- func PackRwalk(buf Buffer, tag uint16, wqids []Qid) error
- func PackRwrite(buf Buffer, tag uint16, count uint32) error
- func PackRwstat(buf Buffer, tag uint16) error
- type Buffer
- type Dir
- type Error
- type Fcall
- type Fid
- type Fidpool
- type File
- type Fs
- type Qid
- type Reqlist
Constants ¶
View Source
const ( Tversion = 100 + iota Rversion Tauth Rauth Tattach Rattach Terror Rerror Tflush Rflush Twalk Rwalk Topen Ropen Tcreate Rcreate Tread Rread Twrite Rwrite Tclunk Rclunk Tremove Rremove Tstat Rstat Twstat Rwstat Tlast )
9P2000 message types
View Source
const ( MSIZE = 8192 + IOHDRSZ // default message size (8192+IOHdrSz) IOHDRSZ = 24 // the non-data size of the Twrite messages PORT = 564 // default port for 9P file servers )
View Source
const ( QTDIR = 0x80 // directories QTAPPEND = 0x40 // append only files QTEXCL = 0x20 // exclusive use files QTMOUNT = 0x10 // mounted channel QTAUTH = 0x08 // authentication file QTTMP = 0x04 // non-backed-up file QTSYMLINK = 0x02 // symbolic link (Unix, 9P2000.u) QTLINK = 0x01 // hard link (Unix, 9P2000.u) QTFILE = 0x00 )
Qid types
View Source
const ( OREAD = 0 // open read-only OWRITE = 1 // open write-only ORDWR = 2 // open read-write OEXEC = 3 // execute (== read but check execute permission) OTRUNC = 16 // or'ed in (except for exec), truncate file first OCEXEC = 32 // or'ed in, close on exec ORCLOSE = 64 // or'ed in, remove on close )
Flags for the mode field in Topen and Tcreate messages
View Source
const ( DMDIR = 0x80000000 // mode bit for directories DMAPPEND = 0x40000000 // mode bit for append only files DMEXCL = 0x20000000 // mode bit for exclusive use files DMMOUNT = 0x10000000 // mode bit for mounted channel DMAUTH = 0x08000000 // mode bit for authentication file DMTMP = 0x04000000 // mode bit for non-backed-up file DMSYMLINK = 0x02000000 // mode bit for symbolic link (Unix, 9P2000.u) DMLINK = 0x01000000 // mode bit for hard link (Unix, 9P2000.u) DMDEVICE = 0x00800000 // mode bit for device file (Unix, 9P2000.u) DMNAMEDPIPE = 0x00200000 // mode bit for named pipe (Unix, 9P2000.u) DMSOCKET = 0x00100000 // mode bit for socket (Unix, 9P2000.u) DMSETUID = 0x00080000 // mode bit for setuid (Unix, 9P2000.u) DMSETGID = 0x00040000 // mode bit for setgid (Unix, 9P2000.u) DMREAD = 0x4 // mode bit for read permission DMWRITE = 0x2 // mode bit for write permission DMEXEC = 0x1 // mode bit for execute permission )
File modes
View Source
const ( NOTAG uint16 = 0xFFFF // no tag specified NOFID uint32 = 0xFFFFFFFF // no fid specified NOUID uint32 = 0xFFFFFFFF // no uid specified )
View Source
const ( EPERM = 1 ENOENT = 2 EIO = 5 EEXIST = 17 ENOTDIR = 20 EINVAL = 22 )
Error values
Variables ¶
View Source
var BufferInsufficient = errors.New("insufficient buffer?")
Global errors.
View Source
var Ebadoffset error = &Error{"bad offset in directory read", EINVAL}
View Source
var Ebaduse error = &Error{"bad use of fid", EINVAL}
View Source
var Edirchange error = &Error{"cannot convert between files and directories", EINVAL}
View Source
var Eexist = &Error{"file already exists", EEXIST}
View Source
var Einuse error = &Error{"fid already in use", EINVAL}
View Source
var Enoauth error = &Error{"no authentication required", EINVAL}
View Source
var Enoent = &Error{"file not found", ENOENT}
View Source
var Enotdir error = &Error{"not a directory", ENOTDIR}
View Source
var Enotempty = &Error{"directory not empty", EPERM}
View Source
var Enotimpl error = &Error{"not implemented", EINVAL}
View Source
var Enouser error = &Error{"unknown user", EINVAL}
View Source
var Eopen error = &Error{"fid already opened", EINVAL}
View Source
var Eperm error = &Error{"permission denied", EPERM}
View Source
var Etoolarge error = &Error{"i/o count too large", EINVAL}
View Source
var Eunknownfid error = &Error{"unknown fid", EINVAL}
Internal errors.
View Source
var InvalidMessage = errors.New("invalid 9pfs message?")
View Source
var ModeToP9Mode = map[uint32]uint32{ syscall.S_IFDIR: DMDIR, syscall.S_IFLNK: DMSYMLINK, syscall.S_IFSOCK: DMSOCKET, syscall.S_IFBLK: DMDEVICE, syscall.S_IFCHR: DMDEVICE, syscall.S_ISUID: DMSETUID, syscall.S_ISGID: DMSETGID, syscall.S_IRUSR: DMREAD << 6, syscall.S_IWUSR: DMWRITE << 6, syscall.S_IXUSR: DMEXEC << 6, syscall.S_IRGRP: DMREAD << 3, syscall.S_IWGRP: DMWRITE << 3, syscall.S_IXGRP: DMEXEC << 3, syscall.S_IROTH: DMREAD, syscall.S_IWOTH: DMWRITE, syscall.S_IXOTH: DMEXEC, }
View Source
var ModeToP9Type = map[uint32]uint16{ syscall.S_IFDIR: QTDIR, syscall.S_IFLNK: QTSYMLINK, }
View Source
var P9ModeToMode = map[uint32]uint32{ DMDIR: syscall.S_IFDIR, DMSYMLINK: syscall.S_IFLNK, DMSOCKET: syscall.S_IFSOCK, DMDEVICE: syscall.S_IFCHR, DMSETUID: syscall.S_ISUID, DMSETGID: syscall.S_ISGID, (DMREAD << 6): syscall.S_IRUSR, (DMWRITE << 6): syscall.S_IWUSR, (DMEXEC << 6): syscall.S_IXUSR, (DMREAD << 3): syscall.S_IRGRP, (DMWRITE << 3): syscall.S_IWGRP, (DMEXEC << 3): syscall.S_IXGRP, DMREAD: syscall.S_IROTH, DMWRITE: syscall.S_IWOTH, DMEXEC: syscall.S_IXOTH, }
View Source
var P9TypeToMode = map[uint8]uint32{ QTDIR: syscall.S_IFDIR, QTSYMLINK: syscall.S_IFLNK, }
View Source
var XattrError = errors.New("unable to fetch xattr?")
Functions ¶
func PackRclunk ¶
func PackRerror ¶
func PackRflush ¶
func PackRremove ¶
func PackRwstat ¶
Types ¶
type Buffer ¶
type Buffer interface { ReadLeft() int WriteLeft() int ReadRewind() WriteRewind() Read8() uint8 Read16() uint16 Read32() uint32 Read64() uint64 ReadBytes(length int) []byte ReadString() string Write8(value uint8) Write16(value uint16) Write32(value uint32) Write64(value uint64) WriteBytes(value []byte) WriteString(value string) ReadFromFd(fd int, offset int64, length int) (int, error) WriteToFd(fd int, offset int64, length int) (int, error) }
type Dir ¶
type Dir struct { Type uint16 Dev uint32 Qid // file's Qid Mode uint32 // permissions and flags Atime uint32 // last access time in seconds Mtime uint32 // last modified time in seconds Length uint64 // file length in bytes Name string // file name Uid string // owner name Gid string // group name Muid string // name of the last user that modified the file // 9P2000.u extension Ext string // special file's descriptor Uidnum uint32 // owner ID Gidnum uint32 // group ID Muidnum uint32 // ID of the last user that modified the file }
Dir describes a file.
type Error ¶
type Error struct { Err string // textual representation of the error Errornum uint32 // numeric representation of the error (9P2000.u) }
Error represents a 9P2000 (and 9P2000.u) error.
type Fcall ¶
type Fcall struct { Size uint32 // size of the message Type uint8 // message type Fid uint32 // file identifier Tag uint16 // message tag Msize uint32 // maximum message size (used by Tversion, Rversion) Version string // protocol version (used by Tversion, Rversion) Oldtag uint16 // tag of the message to flush (used by Tflush) Error string // error (used by Rerror) Qid // file Qid (used by Rauth, Rattach, Ropen, Rcreate) Iounit uint32 // maximum bytes read without breaking in multiple messages (used by Ropen, Rcreate) Afid uint32 // authentication fid (used by Tauth, Tattach) Uname string // user name (used by Tauth, Tattach) Aname string // attach name (used by Tauth, Tattach) Perm uint32 // file permission (mode) (used by Tcreate) Name string // file name (used by Tcreate) Mode uint8 // open mode (used by Topen, Tcreate) Newfid uint32 // the fid that represents the file walked to (used by Twalk) Wname []string // list of names to walk (used by Twalk) Wqid []Qid // list of Qids for the walked files (used by Rwalk) Offset uint64 // offset in the file to read/write from/to (used by Tread, Twrite) Count uint32 // number of bytes read/written (used by Tread, Rread, Twrite, Rwrite) Dir // file description (used by Rstat, Twstat) /* 9P2000.u extensions */ Errornum uint32 // error code, 9P2000.u only (used by Rerror) Ext string // special file description, 9P2000.u only (used by Tcreate) }
Fcall represents a 9P2000 message.
type Fid ¶
type Fid struct { // The associated Fid. Fid uint32 `json:"fid"` // The associated path. Path string `json:"path"` // True if the Fid is opened. Opened bool `json:"opened"` // Open mode (O* flags). Omode uint8 `json:"omode"` // If directory, next valid read position. Diroffset uint64 `json:"diroffset"` // If directory, list of children (reset by read(offset=0). Direntries []*Dir `json:"direntries"` // contains filtered or unexported fields }
type Fidpool ¶
Our collection of Fids.
This is a special type to handle marshal/unmarshal.
func (*Fidpool) MarshalJSON ¶
func (*Fidpool) UnmarshalJSON ¶
type File ¶
type Fs ¶
type Fs struct { // The read mappings. Read map[string][]string `json:"read"` // The write mappings. Write map[string]string `json:"write"` // are we speaking 9P2000.u? Dotu bool `json:"dotu"` // open FiDs. Pool Fidpool `json:"pool"` // requests outstanding. Reqs Reqlist `json"reqs"` // Our next fileid. Fileid uint64 `json:"fileid"` // Our file descriptor limits. Fdlimit uint `json:"fdlimit"` // contains filtered or unexported fields }
Filesystem state.
Click to show internal directories.
Click to hide internal directories.