4 * Copyright (c) 2007 Antti Kantee. All Rights Reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 #ifndef PUFFS9P_9PROTO_H_
29 #define PUFFS9P_9PROTO_H_
33 #define P9PROTO_VERSION "9P2000"
35 #define P9PROTO_T_VERSION 100
36 #define P9PROTO_R_VERSION 101
37 #define P9PROTO_T_AUTH 102
38 #define P9PROTO_R_AUTH 103
39 #define P9PROTO_T_ATTACH 104
40 #define P9PROTO_R_ATTACH 105
41 #define P9PROTO_T_ERROR 106
42 #define P9PROTO_R_ERROR 107
43 #define P9PROTO_T_FLUSH 108
44 #define P9PROTO_R_FLUSH 109
45 #define P9PROTO_T_WALK 110
46 #define P9PROTO_R_WALK 111
47 #define P9PROTO_T_OPEN 112
48 #define P9PROTO_R_OPEN 113
49 #define P9PROTO_T_CREATE 114
50 #define P9PROTO_R_CREATE 115
51 #define P9PROTO_T_READ 116
52 #define P9PROTO_R_READ 117
53 #define P9PROTO_T_WRITE 118
54 #define P9PROTO_R_WRITE 119
55 #define P9PROTO_T_CLUNK 120
56 #define P9PROTO_R_CLUNK 121
57 #define P9PROTO_T_REMOVE 122
58 #define P9PROTO_R_REMOVE 123
59 #define P9PROTO_T_STAT 124
60 #define P9PROTO_R_STAT 125
61 #define P9PROTO_T_WSTAT 126
62 #define P9PROTO_R_WSTAT 127
63 #define P9PROTO_MIN 9PROTO_T_VERSION
64 #define P9PROTO_MAX 9PROTO_R_MAX
66 #define P9PROTO_NOFID (uint32_t)~0
67 #define P9PROTO_NOTAG (uint16_t)~0
69 /* type field in a qid */
70 #define P9PROTO_QID_TYPE_DIR 0x80
71 #define P9PROTO_QID_TYPE_APPEND 0x40
72 #define P9PROTO_QID_TYPE_EXCL 0x20
73 #define P9PROTO_QID_TYPE_MOUNT 0x10
74 #define P9PROTO_QID_TYPE_AUTH 0x08
77 #define P9PROTO_OMODE_READ 0x00
78 #define P9PROTO_OMODE_WRITE 0x01
79 #define P9PROTO_OMODE_RDWR 0x02
80 #define P9PROTO_OMODE_EXEC 0x03
81 #define P9PROTO_OMODE_TRUNC 0x10
82 #define P9PROTO_OMODE_RMCLOSE 0x40
84 /* for creating directories */
85 #define P9PROTO_CPERM_DIR 0x80000000
88 #define P9PROTO_STAT_NOVAL1 (uint8_t)~0
89 #define P9PROTO_STAT_NOVAL2 (uint16_t)~0
90 #define P9PROTO_STAT_NOVAL4 (uint32_t)~0
91 #define P9PROTO_STAT_NOVAL8 (uint64_t)~0
93 #endif /* PUFFS9P_PROTO_H_ */