1 .\" Copyright (c) 2021 Omar Polo <op@omarpolo.com>
3 .\" Permission to use, copy, modify, and distribute this software for any
4 .\" purpose with or without fee is hereby granted, provided that the above
5 .\" copyright notice and this permission notice appear in all copies.
7 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 .Dd $Mdocdate: July 30 2021 $
20 .Nd Simple Distributed File System
23 is a protocol that implements a distributed file systems.
24 It provides primitives to manage
25 .Pq create, read, write and delete
26 sets of files remotely.
27 These files don't necessarily need to be actually stored on a disk,
28 they may be, for example, synthesise on demand from external sources.
30 A client transmits requests
32 to a server, which returns replies
35 The combined acts of transmitting a request of a particular type and
36 receiving a reply is called a transaction of that type.
38 Each message consists of a sequence of bytes mostly grouped in one,
39 two or four integer fields transmitted in little-endian order
40 .Pq least significant byte first .
41 Data items of larger or variable lengths are represented by a two-byte
42 field specifying the length followed by the actual data.
43 The only exception to this rule are QIDs, thirteen byte long
44 objects, that are sent as-is.
46 Text strings are represented with a two-byte count and the sequence of
47 UNICODE codepoints encoded in UTF-8.
48 Text strings in 9p are not NUL-terminated.
49 The NUL-terminator is illegal in all text strings and thus excluded
50 from paths, user names and so on.
52 Fields are hereafter denoted as
53 .Bd -literal -offset indent
57 to indicate that type is one byte long, tag two and fid four.
58 Strings are denoted as name[s] and are sent on the wire as
59 .Bd -literal -offset indent
60 length[2] string[length]
63 A qid, described later, is a 13-byte value that is sent on the wire as
64 .Bd -literal -offset indent
65 type[1] version[4] path[8]
68 Every message has a header with the following fields:
69 .Bd -literal -offset indent
73 where len indicates the overall length of the message, including
74 itself; type is one byte indicating the type of the message and the
75 tag is a number choosen by the client that indicate uniquely the
77 Then follows an optional body whose structure depends on the type of
80 The message types are as follows:
81 .Pq the header is omitted for brevity
82 .Bl -tag -width versionxx
84 Negotiate the version and maximum message size.
92 request must be the first message sent, and the client cannot issue
93 further requests until receiving the Rversion reply.
100 .Pq the maximum size for packets
101 and the protocol version used, the server replies with a
103 smaller or equal to the one proposed by the client.
104 The version string must always begin with the two character
106 If the server don't understand the client required version, should
107 reply with a Rversion using the version string
109 and not use a Rerror.
111 Populate the namespace
113 fid[4] afid[4] uname[s] aname[s]
123 Return an error string
128 The Rerror message is used to return an error string describing the
129 failure of a request.
132 indicates the failed request.
133 Note that there isn't a
135 request and it's not possible for a
141 Abort an ongoing operation.
147 Traverse a file tree.
149 fid[4] newfid[4] nwname[2] nwname*(wname[s])
150 nwqid[2] nwqid*(qid[13])
153 Prepare a fid for I/O