Blame


1 fb1a36c0 2022-01-09 op .\" Copyright (c) 2021 Omar Polo <op@omarpolo.com>
2 fb1a36c0 2022-01-09 op .\"
3 fb1a36c0 2022-01-09 op .\" Permission to use, copy, modify, and distribute this software for any
4 fb1a36c0 2022-01-09 op .\" purpose with or without fee is hereby granted, provided that the above
5 fb1a36c0 2022-01-09 op .\" copyright notice and this permission notice appear in all copies.
6 fb1a36c0 2022-01-09 op .\"
7 fb1a36c0 2022-01-09 op .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 fb1a36c0 2022-01-09 op .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 fb1a36c0 2022-01-09 op .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 fb1a36c0 2022-01-09 op .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 fb1a36c0 2022-01-09 op .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 fb1a36c0 2022-01-09 op .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 fb1a36c0 2022-01-09 op .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 fb1a36c0 2022-01-09 op .\"
15 fb1a36c0 2022-01-09 op .Dd $Mdocdate: July 30 2021 $
16 fb1a36c0 2022-01-09 op .Dt 9P 7
17 fb1a36c0 2022-01-09 op .Os
18 fb1a36c0 2022-01-09 op .Sh NAME
19 fb1a36c0 2022-01-09 op .Nm 9P
20 fb1a36c0 2022-01-09 op .Nd Simple Distributed File System
21 fb1a36c0 2022-01-09 op .Sh DESCRIPTION
22 fb1a36c0 2022-01-09 op .Nm
23 fb1a36c0 2022-01-09 op is a protocol that implements a distributed file systems.
24 fb1a36c0 2022-01-09 op It provides primitives to manage
25 fb1a36c0 2022-01-09 op .Pq create, read, write and delete
26 fb1a36c0 2022-01-09 op sets of files remotely.
27 fb1a36c0 2022-01-09 op These files don't necessarily need to be actually stored on a disk,
28 fb1a36c0 2022-01-09 op they may be, for example, synthesise on demand from external sources.
29 fb1a36c0 2022-01-09 op .Pp
30 fb1a36c0 2022-01-09 op A client transmits requests
31 fb1a36c0 2022-01-09 op .Pq T-messages
32 fb1a36c0 2022-01-09 op to a server, which returns replies
33 fb1a36c0 2022-01-09 op .Pq R-messages
34 fb1a36c0 2022-01-09 op to the client.
35 fb1a36c0 2022-01-09 op The combined acts of transmitting a request of a particular type and
36 fb1a36c0 2022-01-09 op receiving a reply is called a transaction of that type.
37 fb1a36c0 2022-01-09 op .Pp
38 fb1a36c0 2022-01-09 op Each message consists of a sequence of bytes mostly grouped in one,
39 fb1a36c0 2022-01-09 op two or four integer fields transmitted in little-endian order
40 fb1a36c0 2022-01-09 op .Pq least significant byte first .
41 fb1a36c0 2022-01-09 op Data items of larger or variable lengths are represented by a two-byte
42 fb1a36c0 2022-01-09 op field specifying the length followed by the actual data.
43 fb1a36c0 2022-01-09 op The only exception to this rule are QIDs, thirteen byte long
44 fb1a36c0 2022-01-09 op objects, that are sent as-is.
45 fb1a36c0 2022-01-09 op .Pp
46 fb1a36c0 2022-01-09 op Text strings are represented with a two-byte count and the sequence of
47 fb1a36c0 2022-01-09 op UNICODE codepoints encoded in UTF-8.
48 fb1a36c0 2022-01-09 op Text strings in 9p are not NUL-terminated.
49 fb1a36c0 2022-01-09 op The NUL-terminator is illegal in all text strings and thus excluded
50 fb1a36c0 2022-01-09 op from paths, user names and so on.
51 fb1a36c0 2022-01-09 op .Pp
52 fb1a36c0 2022-01-09 op Fields are hereafter denoted as
53 fb1a36c0 2022-01-09 op .Bd -literal -offset indent
54 fb1a36c0 2022-01-09 op type[1] tag[2] fid[4]
55 fb1a36c0 2022-01-09 op .Ed
56 fb1a36c0 2022-01-09 op .Pp
57 fb1a36c0 2022-01-09 op to indicate that type is one byte long, tag two and fid four.
58 fb1a36c0 2022-01-09 op Strings are denoted as name[s] and are sent on the wire as
59 fb1a36c0 2022-01-09 op .Bd -literal -offset indent
60 fb1a36c0 2022-01-09 op length[2] string[length]
61 fb1a36c0 2022-01-09 op .Ed
62 fb1a36c0 2022-01-09 op .Pp
63 fb1a36c0 2022-01-09 op A qid, described later, is a 13-byte value that is sent on the wire as
64 fb1a36c0 2022-01-09 op .Bd -literal -offset indent
65 fb1a36c0 2022-01-09 op type[1] version[4] path[8]
66 fb1a36c0 2022-01-09 op .Ed
67 fb1a36c0 2022-01-09 op .Sh MESSAGE STRUCTURE
68 fb1a36c0 2022-01-09 op Every message has a header with the following fields:
69 fb1a36c0 2022-01-09 op .Bd -literal -offset indent
70 fb1a36c0 2022-01-09 op len[4] type[1] tag[2]
71 fb1a36c0 2022-01-09 op .Ed
72 fb1a36c0 2022-01-09 op .Pp
73 fb1a36c0 2022-01-09 op where len indicates the overall length of the message, including
74 fb1a36c0 2022-01-09 op itself; type is one byte indicating the type of the message and the
75 fb1a36c0 2022-01-09 op tag is a number choosen by the client that indicate uniquely the
76 fb1a36c0 2022-01-09 op request.
77 fb1a36c0 2022-01-09 op Then follows an optional body whose structure depends on the type of
78 fb1a36c0 2022-01-09 op the message.
79 fb1a36c0 2022-01-09 op .Pp
80 fb1a36c0 2022-01-09 op The message types are as follows:
81 fb1a36c0 2022-01-09 op .Pq the header is omitted for brevity
82 fb1a36c0 2022-01-09 op .Bl -tag -width versionxx
83 fb1a36c0 2022-01-09 op .It Ic version
84 fb1a36c0 2022-01-09 op Negotiate the version and maximum message size.
85 fb1a36c0 2022-01-09 op .Bd -literal
86 fb1a36c0 2022-01-09 op msize[4] version[s]
87 fb1a36c0 2022-01-09 op msize[4] version[s]
88 fb1a36c0 2022-01-09 op .Ed
89 fb1a36c0 2022-01-09 op .Pp
90 fb1a36c0 2022-01-09 op The
91 fb1a36c0 2022-01-09 op .Ic version
92 fb1a36c0 2022-01-09 op request must be the first message sent, and the client cannot issue
93 fb1a36c0 2022-01-09 op further requests until receiving the Rversion reply.
94 e13d3f6e 2022-01-22 op .Ar tag
95 fb1a36c0 2022-01-09 op should be
96 fb1a36c0 2022-01-09 op .Dv NOTAG
97 fb1a36c0 2022-01-09 op .Pq \-1 or 255 .
98 fb1a36c0 2022-01-09 op The client suggest a
99 e13d3f6e 2022-01-22 op .Ar msize
100 fb1a36c0 2022-01-09 op .Pq the maximum size for packets
101 fb1a36c0 2022-01-09 op and the protocol version used, the server replies with a
102 e13d3f6e 2022-01-22 op .Ar msize
103 fb1a36c0 2022-01-09 op smaller or equal to the one proposed by the client.
104 fb1a36c0 2022-01-09 op The version string must always begin with the two character
105 fb1a36c0 2022-01-09 op .Dq 9P .
106 fb1a36c0 2022-01-09 op If the server don't understand the client required version, should
107 fb1a36c0 2022-01-09 op reply with a Rversion using the version string
108 fb1a36c0 2022-01-09 op .Dq unknown
109 fb1a36c0 2022-01-09 op and not use a Rerror.
110 fb1a36c0 2022-01-09 op .It Ic attach
111 fb1a36c0 2022-01-09 op Populate the namespace
112 fb1a36c0 2022-01-09 op .Bd -literal
113 fb1a36c0 2022-01-09 op fid[4] afid[4] uname[s] aname[s]
114 fb1a36c0 2022-01-09 op qid[13]
115 fb1a36c0 2022-01-09 op .Ed
116 fb1a36c0 2022-01-09 op .Pp
117 fb1a36c0 2022-01-09 op The
118 fb1a36c0 2022-01-09 op .Ic attach
119 fb1a36c0 2022-01-09 op message binds the given
120 fb1a36c0 2022-01-09 op .Ar fid
121 fb1a36c0 2022-01-09 op to the root of the file tree identified by
122 fb1a36c0 2022-01-09 op .Ar aname .
123 fb1a36c0 2022-01-09 op .Ar uname
124 fb1a36c0 2022-01-09 op identifies the user and
125 fb1a36c0 2022-01-09 op .Ar afid
126 fb1a36c0 2022-01-09 op specifies a fid previously established by an auth message, or the
127 fb1a36c0 2022-01-09 op special
128 fb1a36c0 2022-01-09 op .Dv NOFID
129 fb1a36c0 2022-01-09 op value
130 e13d3f6e 2022-01-22 op .Pq defined as (u32int_t)~0
131 fb1a36c0 2022-01-09 op if the authentication is not required.
132 fb1a36c0 2022-01-09 op .It Ic clunk
133 fb1a36c0 2022-01-09 op Close fids.
134 fb1a36c0 2022-01-09 op .Bd -literal
135 fb1a36c0 2022-01-09 op fid[4]
136 fb1a36c0 2022-01-09 op .Aq empty response
137 fb1a36c0 2022-01-09 op .Ed
138 fb1a36c0 2022-01-09 op .Pp
139 fb1a36c0 2022-01-09 op Once a fid has been clunked
140 fb1a36c0 2022-01-09 op .Pq closed
141 fb1a36c0 2022-01-09 op it becomes
142 fb1a36c0 2022-01-09 op .Dq free
143 fb1a36c0 2022-01-09 op and the same value can be used for subsequential
144 fb1a36c0 2022-01-09 op .Ic walk
145 fb1a36c0 2022-01-09 op or
146 fb1a36c0 2022-01-09 op .Ic attach
147 fb1a36c0 2022-01-09 op requests.
148 fb1a36c0 2022-01-09 op .Pp
149 a452e7cd 2022-01-23 op The actual file on the disk is not removed unless it was opened with the
150 fb1a36c0 2022-01-09 op .Dv ORCLOSE
151 fb1a36c0 2022-01-09 op flag.
152 fb1a36c0 2022-01-09 op .It Ic error
153 fb1a36c0 2022-01-09 op Return an error string.
154 fb1a36c0 2022-01-09 op .Bd -literal
155 92f79c88 2022-01-22 op .Aq no request
156 fb1a36c0 2022-01-09 op ename[s]
157 fb1a36c0 2022-01-09 op .Ed
158 fb1a36c0 2022-01-09 op .Pp
159 fb1a36c0 2022-01-09 op The Rerror message is used to return an error string describing the
160 fb1a36c0 2022-01-09 op failure of a request.
161 fb1a36c0 2022-01-09 op The
162 e13d3f6e 2022-01-22 op .Ar tag
163 fb1a36c0 2022-01-09 op indicates the failed request.
164 fb1a36c0 2022-01-09 op .Pp
165 fb1a36c0 2022-01-09 op Note that there isn't a
166 fb1a36c0 2022-01-09 op .Ic Terror
167 fb1a36c0 2022-01-09 op request for obvious reason and it's not possible for a server to reply to
168 fb1a36c0 2022-01-09 op a
169 fb1a36c0 2022-01-09 op .Ic Tversion
170 fb1a36c0 2022-01-09 op or
171 fb1a36c0 2022-01-09 op .Ic Tflush
172 fb1a36c0 2022-01-09 op using
173 fb1a36c0 2022-01-09 op .Ic Rerror .
174 fb1a36c0 2022-01-09 op .It Ic flush
175 fb1a36c0 2022-01-09 op Abort an ongoing operation.
176 fb1a36c0 2022-01-09 op .Bd -literal
177 fb1a36c0 2022-01-09 op oldtag[2]
178 fb1a36c0 2022-01-09 op .Aq empty response
179 fb1a36c0 2022-01-09 op .Ed
180 fb1a36c0 2022-01-09 op .Pp
181 fb1a36c0 2022-01-09 op Given the asynchronous nature of the protocol, the server may respond to
182 fb1a36c0 2022-01-09 op the pending request before responding to the
183 fb1a36c0 2022-01-09 op .Ic Tflush
184 fb1a36c0 2022-01-09 op and is possible for a client to send multiple
185 fb1a36c0 2022-01-09 op .Ic Tflush
186 fb1a36c0 2022-01-09 op for the same operation.
187 fb1a36c0 2022-01-09 op The client must wait to receive a corresponding
188 fb1a36c0 2022-01-09 op .Ic Rflush
189 fb1a36c0 2022-01-09 op before reusing
190 fb1a36c0 2022-01-09 op .Ar oldtag
191 fb1a36c0 2022-01-09 op for subsequent messages.
192 fb1a36c0 2022-01-09 op .Pp
193 fb1a36c0 2022-01-09 op If a response for
194 fb1a36c0 2022-01-09 op .Ar oldtag
195 fb1a36c0 2022-01-09 op is received before the
196 fb1a36c0 2022-01-09 op .Ic Rflush
197 fb1a36c0 2022-01-09 op reply, the client must assume that the operation was completed with success
198 fb1a36c0 2022-01-09 op .Pq fid allocated, files created, ...
199 fb1a36c0 2022-01-09 op If no response is received before the
200 fb1a36c0 2022-01-09 op .Ic Rflush
201 fb1a36c0 2022-01-09 op then the transaction is considered to have been successfully cancelled.
202 fb1a36c0 2022-01-09 op .Pp
203 fb1a36c0 2022-01-09 op Note that the tag of this request and the corresponding reply is NOT
204 fb1a36c0 2022-01-09 op .Ar oldtag
205 fb1a36c0 2022-01-09 op but a new tag value.
206 fb1a36c0 2022-01-09 op .It Ic walk
207 fb1a36c0 2022-01-09 op Traverse a file tree.
208 fb1a36c0 2022-01-09 op .Bd -literal
209 fb1a36c0 2022-01-09 op fid[4] newfid[4] nwname[2] nwname*(wname[s])
210 fb1a36c0 2022-01-09 op nwqid[2] nwqid*(qid[13])
211 fb1a36c0 2022-01-09 op .Ed
212 fb1a36c0 2022-01-09 op .Pp
213 fb1a36c0 2022-01-09 op The
214 fb1a36c0 2022-01-09 op .Ar nwname
215 fb1a36c0 2022-01-09 op components are walked in order starting from
216 fb1a36c0 2022-01-09 op .Ar fid
217 fb1a36c0 2022-01-09 op .Pq which must point to a directory
218 fb1a36c0 2022-01-09 op and, if successful,
219 fb1a36c0 2022-01-09 op .Ar newfid
220 fb1a36c0 2022-01-09 op is associated to the reached file.
221 fb1a36c0 2022-01-09 op .Pp
222 fb1a36c0 2022-01-09 op It is possible for
223 fb1a36c0 2022-01-09 op .Ar fid
224 fb1a36c0 2022-01-09 op and
225 fb1a36c0 2022-01-09 op .Ar newfid
226 fb1a36c0 2022-01-09 op to be equal, in this case the fid is
227 fb1a36c0 2022-01-09 op .Dq mutated ,
228 fb1a36c0 2022-01-09 op otherwise
229 fb1a36c0 2022-01-09 op .Ar newfid
230 fb1a36c0 2022-01-09 op must be unused.
231 fb1a36c0 2022-01-09 op As a special case, a walk of zero components duplicates the fid.
232 fb1a36c0 2022-01-09 op .Pp
233 fb1a36c0 2022-01-09 op If the first element cannot be walked for any reason an
234 fb1a36c0 2022-01-09 op .Ic Rerror
235 fb1a36c0 2022-01-09 op is returned.
236 fb1a36c0 2022-01-09 op Otherwise,
237 fb1a36c0 2022-01-09 op .Ic Rwalk
238 fb1a36c0 2022-01-09 op is returned with a number of qids equal to the file viside by the walk.
239 fb1a36c0 2022-01-09 op A client can thus detect a walk when that the replied
240 fb1a36c0 2022-01-09 op .Ar nwqid
241 fb1a36c0 2022-01-09 op number is not equal to the
242 fb1a36c0 2022-01-09 op .Ar nwname
243 fb1a36c0 2022-01-09 op field in the request.
244 fb1a36c0 2022-01-09 op Only when walk return successfully
245 fb1a36c0 2022-01-09 op .Ar newfid
246 fb1a36c0 2022-01-09 op will be affected.
247 fb1a36c0 2022-01-09 op .Pp
248 fb1a36c0 2022-01-09 op A maximum of 16 component can be used per walk request.
249 fb1a36c0 2022-01-09 op .It Ic open
250 fb1a36c0 2022-01-09 op Prepare a fid for I/O.
251 fb1a36c0 2022-01-09 op .Bd -literal
252 fb1a36c0 2022-01-09 op fid[4] mode[1]
253 fb1a36c0 2022-01-09 op qid[13] iounit[4]
254 fb1a36c0 2022-01-09 op .Ed
255 fb1a36c0 2022-01-09 op .Pp
256 fb1a36c0 2022-01-09 op .Ar mode
257 fb1a36c0 2022-01-09 op determines the type of I/O:
258 fb1a36c0 2022-01-09 op .Bl -tag -width Ds -offset indent -compact
259 92f79c88 2022-01-22 op .It 0x00 Pq Dv OREAD
260 92f79c88 2022-01-22 op Open the file for reading.
261 92f79c88 2022-01-22 op .It 0x01 Pq Dv OWRITE
262 92f79c88 2022-01-22 op Open the file for writing.
263 92f79c88 2022-01-22 op .It 0x02 Pq Dv ORDWD
264 92f79c88 2022-01-22 op Open the file for both reading and writing.
265 92f79c88 2022-01-22 op .It 0x03 Pq Dv OEXEC
266 92f79c88 2022-01-22 op Open for exec.
267 92f79c88 2022-01-22 op .El
268 92f79c88 2022-01-22 op .Pp
269 92f79c88 2022-01-22 op Additionally, the following flags can be or'ed to
270 92f79c88 2022-01-22 op .Ar mode :
271 92f79c88 2022-01-22 op .Bl -tag -width Ds -offset indent -compact
272 92f79c88 2022-01-22 op .It 0x10 Pq Dv OTRUNC
273 92f79c88 2022-01-22 op Truncate the file before opening
274 92f79c88 2022-01-22 op .It 0x40 Pq Dv ORCLOSE
275 92f79c88 2022-01-22 op Remove the file upon
276 92f79c88 2022-01-22 op .Ic clunk .
277 fb1a36c0 2022-01-09 op .El
278 fb1a36c0 2022-01-09 op .Pp
279 fb1a36c0 2022-01-09 op The returned
280 fb1a36c0 2022-01-09 op .Ar iounit
281 fb1a36c0 2022-01-09 op is the optimal blocksize for I/O.
282 fb1a36c0 2022-01-09 op .It Ic create
283 fb1a36c0 2022-01-09 op Create a file
284 fb1a36c0 2022-01-09 op .Bd -literal
285 fb1a36c0 2022-01-09 op fid[4] name[s] perm[4] mode[1]
286 fb1a36c0 2022-01-09 op qid[13] iounit[4]
287 fb1a36c0 2022-01-09 op .Ed
288 fb1a36c0 2022-01-09 op .Pp
289 fb1a36c0 2022-01-09 op The call attempts to create a file named
290 fb1a36c0 2022-01-09 op .Ar name
291 fb1a36c0 2022-01-09 op in the directory identified by
292 fb1a36c0 2022-01-09 op .Ar fid
293 fb1a36c0 2022-01-09 op according to
294 fb1a36c0 2022-01-09 op .Ar perm
295 fb1a36c0 2022-01-09 op and then to open it with
296 fb1a36c0 2022-01-09 op .Ar mode
297 fb1a36c0 2022-01-09 op into the given
298 fb1a36c0 2022-01-09 op .Ar fid .
299 fb1a36c0 2022-01-09 op .Pp
300 fb1a36c0 2022-01-09 op It is illegal to use an already opened
301 fb1a36c0 2022-01-09 op .Ar fid
302 fb1a36c0 2022-01-09 op or to attempt to create the
303 fb1a36c0 2022-01-09 op .Dq \&.
304 fb1a36c0 2022-01-09 op or
305 fb1a36c0 2022-01-09 op .Dq ..
306 fb1a36c0 2022-01-09 op entries.
307 fb1a36c0 2022-01-09 op .It Ic read
308 3bc95011 2022-01-31 op Read data at offset
309 fb1a36c0 2022-01-09 op .Bd -literal
310 fb1a36c0 2022-01-09 op fid[4] offset[8] count[4]
311 fb1a36c0 2022-01-09 op count[4] data[count]
312 fb1a36c0 2022-01-09 op .Ed
313 fb1a36c0 2022-01-09 op .Pp
314 fb1a36c0 2022-01-09 op .Ar fid
315 fb1a36c0 2022-01-09 op must have been prepared for I/O with a previous
316 fb1a36c0 2022-01-09 op .Ic open
317 fb1a36c0 2022-01-09 op call.
318 fb1a36c0 2022-01-09 op The returned
319 fb1a36c0 2022-01-09 op .Ar count
320 fb1a36c0 2022-01-09 op is zero when reaching end-of-file and may be lesser than what requested.
321 fb1a36c0 2022-01-09 op .Pp
322 fb1a36c0 2022-01-09 op Directories are a stream of stat structures, as described in
323 fb1a36c0 2022-01-09 op .Ic stat ,
324 fb1a36c0 2022-01-09 op and for them the read request message must have offset equal to zero or
325 fb1a36c0 2022-01-09 op the value of
326 fb1a36c0 2022-01-09 op .Ar offset
327 fb1a36c0 2022-01-09 op in the previous read on the directory plus the number of bytes returned
328 fb1a36c0 2022-01-09 op in the previous read.
329 fb1a36c0 2022-01-09 op Thus, is not possible to seek into directories except for rewinding.
330 fb1a36c0 2022-01-09 op .It Ic write
331 fb1a36c0 2022-01-09 op Write data at offset
332 fb1a36c0 2022-01-09 op .Bd -literal
333 fb1a36c0 2022-01-09 op fid[4] offset[8] count[4] data[count]
334 fb1a36c0 2022-01-09 op count[4]
335 fb1a36c0 2022-01-09 op .Ed
336 e13d3f6e 2022-01-22 op .Pp
337 e13d3f6e 2022-01-22 op .Ar fid
338 e13d3f6e 2022-01-22 op must have been prepared for I/O with a previous
339 e13d3f6e 2022-01-22 op .Ic open
340 e13d3f6e 2022-01-22 op or
341 e13d3f6e 2022-01-22 op .Ic create
342 e13d3f6e 2022-01-22 op call.
343 e13d3f6e 2022-01-22 op The returned
344 e13d3f6e 2022-01-22 op .Ar count
345 e13d3f6e 2022-01-22 op is the amount of data actually written and may differ from the one in
346 e13d3f6e 2022-01-22 op the request.
347 fb1a36c0 2022-01-09 op .It Ic stat
348 92f79c88 2022-01-22 op Get file status
349 fb1a36c0 2022-01-09 op .Bd -literal
350 fb1a36c0 2022-01-09 op fid[4]
351 fb1a36c0 2022-01-09 op stat[n]
352 fb1a36c0 2022-01-09 op .Ed
353 fb1a36c0 2022-01-09 op .Pp
354 fb1a36c0 2022-01-09 op The stat structure is made by the following fields:
355 ea9dc606 2022-01-22 op .Bl -tag -width tenletters -compact
356 fb1a36c0 2022-01-09 op .It size[2]
357 fb1a36c0 2022-01-09 op total byte count of the following data
358 fb1a36c0 2022-01-09 op .It type[2]
359 fb1a36c0 2022-01-09 op for kernel use
360 fb1a36c0 2022-01-09 op .It dev[4]
361 fb1a36c0 2022-01-09 op for kernel use
362 fb1a36c0 2022-01-09 op .It qid[13]
363 fb1a36c0 2022-01-09 op server unique identifier of the file
364 fb1a36c0 2022-01-09 op .It mode[4]
365 fb1a36c0 2022-01-09 op permissions and flags
366 fb1a36c0 2022-01-09 op .It atime[4]
367 fb1a36c0 2022-01-09 op last access time
368 fb1a36c0 2022-01-09 op .It mtime[4]
369 fb1a36c0 2022-01-09 op last modification time
370 fb1a36c0 2022-01-09 op .It length[8]
371 fb1a36c0 2022-01-09 op length of file in bytes
372 fb1a36c0 2022-01-09 op .It name[s]
373 fb1a36c0 2022-01-09 op file name
374 fb1a36c0 2022-01-09 op (must be
375 fb1a36c0 2022-01-09 op .Dq /
376 fb1a36c0 2022-01-09 op if the file is the root directory of the server)
377 fb1a36c0 2022-01-09 op .It uid[s]
378 fb1a36c0 2022-01-09 op owner name
379 fb1a36c0 2022-01-09 op .It gid[s]
380 fb1a36c0 2022-01-09 op group name
381 fb1a36c0 2022-01-09 op .It muid[s]
382 fb1a36c0 2022-01-09 op name of the user who last modified the file.
383 fb1a36c0 2022-01-09 op .El
384 2254cace 2022-01-22 op .Pp
385 2254cace 2022-01-22 op Note that the
386 e13d3f6e 2022-01-22 op .Ar size
387 e13d3f6e 2022-01-22 op is always present, even in the
388 2254cace 2022-01-22 op .Ic wstat
389 2254cace 2022-01-22 op call.
390 2254cace 2022-01-22 op While it may be considered redundant, it's kept to simplify the
391 2254cace 2022-01-22 op parsing of the stat entries in a directory.
392 cab30d8a 2022-01-22 op .It Ic wstat
393 92f79c88 2022-01-22 op Change file attributes
394 cab30d8a 2022-01-22 op .Bd -literal
395 cab30d8a 2022-01-22 op fid[4] stat[n]
396 cab30d8a 2022-01-22 op .Aq empty response
397 cab30d8a 2022-01-22 op .Ed
398 cab30d8a 2022-01-22 op .Pp
399 92f79c88 2022-01-22 op .Ar fid
400 92f79c88 2022-01-22 op must have been prepared for writing with a previous
401 92f79c88 2022-01-22 op .Ic open
402 92f79c88 2022-01-22 op or
403 92f79c88 2022-01-22 op .Ic create
404 92f79c88 2022-01-22 op call.
405 92f79c88 2022-01-22 op .Pp
406 cab30d8a 2022-01-22 op The
407 e13d3f6e 2022-01-22 op .Ar stat
408 cab30d8a 2022-01-22 op structure is the same described in
409 cab30d8a 2022-01-22 op .Ic stat .
410 cab30d8a 2022-01-22 op .Pp
411 cab30d8a 2022-01-22 op The
412 e13d3f6e 2022-01-22 op .Ar stat
413 cab30d8a 2022-01-22 op structure sent reflect what changes the client wishes to make to the
414 cab30d8a 2022-01-22 op given fid.
415 cab30d8a 2022-01-22 op To leave some fields as unchanged, use empty string or the maximum
416 cab30d8a 2022-01-22 op allowed value for integral fields.
417 cab30d8a 2022-01-22 op For example, to avoid changing the permission of the fid use
418 cab30d8a 2022-01-22 op 0xFFFFFFFF, or (uint32_t)-1.
419 fb1a36c0 2022-01-09 op .It Ic remove
420 12a6df20 2022-01-29 op Remove and clunk fid
421 fb1a36c0 2022-01-09 op .Bd -literal
422 fb1a36c0 2022-01-09 op fid[4]
423 fb1a36c0 2022-01-09 op .Aq empty response
424 fb1a36c0 2022-01-09 op .Ed
425 12a6df20 2022-01-29 op .Pp
426 12a6df20 2022-01-29 op After a
427 12a6df20 2022-01-29 op .Ic remove
428 12a6df20 2022-01-29 op call, even if an error is returned, the
429 12a6df20 2022-01-29 op .Ar fid
430 12a6df20 2022-01-29 op is closed.
431 fb1a36c0 2022-01-09 op .El
432 fb1a36c0 2022-01-09 op .\" .Sh 9P2000.L EXTENSIONS
433 fb1a36c0 2022-01-09 op .\" .Xr kamid 8
434 fb1a36c0 2022-01-09 op .\" supports also a subset of the
435 fb1a36c0 2022-01-09 op .\" .Sq 9P2000.L
436 fb1a36c0 2022-01-09 op .\" dialect.
437 fb1a36c0 2022-01-09 op .\" The supported messages are
438 fb1a36c0 2022-01-09 op .\" .Bl -tag -width readdir
439 fb1a36c0 2022-01-09 op .\" .It Ic readdir
440 fb1a36c0 2022-01-09 op .\" Read directory entries
441 fb1a36c0 2022-01-09 op .\" .Bd -literal
442 fb1a36c0 2022-01-09 op .\" fid[4] offset[8] count[4]
443 fb1a36c0 2022-01-09 op .\" count[4] data[count]
444 fb1a36c0 2022-01-09 op .\" .Ed
445 fb1a36c0 2022-01-09 op .\" .Pp
446 fb1a36c0 2022-01-09 op .\" Each directory entry is described by a variable-length record:
447 fb1a36c0 2022-01-09 op .\" .Ql qid[13] offset[8] type[1] name[s] .
448 fb1a36c0 2022-01-09 op .\" Offset is zero upon the first call.
449 fb1a36c0 2022-01-09 op .\" If the
450 fb1a36c0 2022-01-09 op .\" .Ar count
451 fb1a36c0 2022-01-09 op .\" field in the
452 fb1a36c0 2022-01-09 op .\" .Ic Rreaddir
453 fb1a36c0 2022-01-09 op .\" response is not zero then more data is available.
454 fb1a36c0 2022-01-09 op .\" .Pp
455 fb1a36c0 2022-01-09 op .\" .Ar count
456 fb1a36c0 2022-01-09 op .\" is allowed to be zero in the request.
457 fb1a36c0 2022-01-09 op .\" .El
458 fb1a36c0 2022-01-09 op .Sh SEE ALSO
459 fb1a36c0 2022-01-09 op .Xr utf8 7 ,
460 fb1a36c0 2022-01-09 op .Xr kamid 8