9 // DefaultMSize messages size used to establish a session.
10 DefaultMSize = 64 << 10
12 // DefaultVersion for this package. Currently, the only supported version.
13 DefaultVersion = "9P2000"
16 // Mode constants for use Dir.Mode.
18 DMDIR = 0x80000000 // mode bit for directories
19 DMAPPEND = 0x40000000 // mode bit for append only files
20 DMEXCL = 0x20000000 // mode bit for exclusive use files
21 DMMOUNT = 0x10000000 // mode bit for mounted channel
22 DMAUTH = 0x08000000 // mode bit for authentication file
23 DMTMP = 0x04000000 // mode bit for non-backed-up files
25 // 9p2000.u extensions
27 DMSYMLINK = 0x02000000
29 DMNAMEDPIPE = 0x00200000
34 DMREAD = 0x4 // mode bit for read permission
35 DMWRITE = 0x2 // mode bit for write permission
36 DMEXEC = 0x1 // mode bit for execute permission
39 // Flag defines the flag type for use with open and create
42 // Constants to use when opening files.
44 OREAD Flag = 0x00 // open for read
45 OWRITE Flag = 0x01 // write
46 ORDWR Flag = 0x02 // read and write
47 OEXEC Flag = 0x03 // execute, == read but check execute permission
49 // PROPOSAL(stevvooe): Possible protocal extension to allow the create of
50 // symlinks. Initially, the link is created with no value. Read and write
51 // to read and set the link value.
55 OTRUNC Flag = 0x10 // or'ed in (except for exec), truncate file first
56 OCEXEC Flag = 0x20 // or'ed in, close on exec
57 ORCLOSE Flag = 0x40 // or'ed in, remove on close
60 // QType indicates the type of a resource within the Qid.
63 // Constants for use in Qid to indicate resource type.
65 QTDIR QType = 0x80 // type bit for directories
66 QTAPPEND QType = 0x40 // type bit for append only files
67 QTEXCL QType = 0x20 // type bit for exclusive use files
68 QTMOUNT QType = 0x10 // type bit for mounted channel
69 QTAUTH QType = 0x08 // type bit for authentication file
70 QTTMP QType = 0x04 // type bit for not-backed-up file
71 QTFILE QType = 0x00 // plain file
74 func (qt QType) String() string {
95 // Tag uniquely identifies an outstanding fcall in a 9p session.
98 // NOTAG is a reserved values for messages sent before establishing a session,
100 const NOTAG Tag = ^Tag(0)
102 // Fid defines a type to hold Fid values.
105 // NOFID indicates the lack of an Fid.
106 const NOFID Fid = ^Fid(0)
108 // Qid indicates the type, path and version of the resource returned by a
109 // server. It is only valid for a session.
111 // Typically, a client maintains a mapping of Fid-Qid as Qids are returned by
114 Type QType `9p:"type,1"`
119 func (qid Qid) String() string {
120 return fmt.Sprintf("qid(%v, v=%x, p=%x)",
121 qid.Type, qid.Version, qid.Path)
124 // Dir defines the structure used for expressing resources in stat/wstat and
125 // when reading directories.
132 // BUG(stevvooe): The Year 2038 is coming soon. 9p wire protocol has these
133 // as 4 byte epoch times. Some possibilities include time dilation fields
134 // or atemporal files. We can also just not use them and set them to zero.
146 func (d Dir) String() string {
147 return fmt.Sprintf("dir(%v mode=%v atime=%v mtime=%v length=%v name=%v uid=%v gid=%v muid=%v)",
148 d.Qid, d.Mode, d.AccessTime, d.ModTime, d.Length, d.Name, d.UID, d.GID, d.MUID)