libnfs.c: Fix a warning
[deb_libnfs.git] / nlm / nlm.x
CommitLineData
2f5c161b
RS
1/*
2Copyright (c) 2014, Ronnie Sahlberg
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7
81. Redistributions of source code must retain the above copyright notice, this
9 list of conditions and the following disclaimer.
102. Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13
14THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
25The views and conclusions contained in the software and documentation are those
26of the authors and should not be interpreted as representing official policies,
27either expressed or implied, of the FreeBSD Project.
28*/
6916a665 29
e01ed6a2
RS
30struct nlm_fh4 {
31 opaque data<>;
32};
33
34typedef string nlm4_oh<>;
35
36struct nlm_cookie {
37 opaque data<>;
38};
6916a665
RS
39
40enum nlmstat4 {
41 NLM4_GRANTED = 0,
42 NLM4_DENIED = 1,
43 NLM4_DENIED_NOLOCKS = 2,
44 NLM4_BLOCKED = 3,
45 NLM4_DENIED_GRACE_PERIOD = 4,
46 NLM4_DEADLCK = 5,
47 NLM4_ROFS = 6,
48 NLM4_STALE_FH = 7,
49 NLM4_FBIG = 8,
50 NLM4_FAILED = 9
51};
52
53struct nlm4_holder {
e01ed6a2
RS
54 bool exclusive;
55 unsigned int svid;
56 nlm4_oh oh;
a0c4ea7d
RS
57 u_quad_t l_offset;
58 u_quad_t l_len;
6916a665
RS
59};
60
61const NLM_MAXNAME = 256;
62struct nlm4_lock {
e01ed6a2
RS
63 string caller_name<NLM_MAXNAME>;
64 struct nlm_fh4 fh;
65 nlm4_oh oh;
66 unsigned int svid;
a0c4ea7d
RS
67 u_quad_t l_offset;
68 u_quad_t l_len;
6916a665
RS
69};
70
71struct nlm4_share {
e01ed6a2
RS
72 string caller_name<NLM_MAXNAME>;
73 struct nlm_fh4 fh;
74 nlm4_oh oh;
75 unsigned int mode;
76 unsigned int access;
6916a665
RS
77};
78
2faefcac 79struct nlm4_testres_denied {
6916a665
RS
80 nlm4_holder holder;
81};
82
2faefcac
RS
83union nlm4_testreply switch (nlmstat4 status) {
84 case NLM4_DENIED:
85 nlm4_testres_denied lock;
6916a665
RS
86 default:
87 void;
88};
89
2faefcac
RS
90struct NLM4_TESTres {
91 nlm_cookie cookie;
92 nlm4_testreply reply;
93};
94
e01ed6a2 95struct NLM4_TESTargs {
6916a665
RS
96 nlm_cookie cookie;
97 bool exclusive;
98 nlm4_lock lock;
99};
100
c880fdac
RS
101struct NLM4_CANCres {
102 nlm_cookie cookie;
103 nlmstat4 status;
104};
105
106struct NLM4_CANCargs {
107 nlm_cookie cookie;
108 bool block;
109 bool exclusive;
110 nlm4_lock lock;
111};
112
8d3c1af0
RS
113struct NLM4_UNLOCKres {
114 nlm_cookie cookie;
115 nlmstat4 status;
116};
117
118struct NLM4_UNLOCKargs {
119 nlm_cookie cookie;
120 nlm4_lock lock;
121};
122
04ba56c4
RS
123struct NLM4_LOCKres {
124 nlm_cookie cookie;
125 nlmstat4 status;
126};
127
128struct NLM4_LOCKargs {
129 nlm_cookie cookie;
130 bool block;
131 bool exclusive;
132 nlm4_lock lock;
133 bool reclaim;
134 int state;
135};
136
c33ce42c
RS
137struct NLM4_GRANTEDargs {
138 nlm_cookie cookie;
139 bool exclusive;
140 nlm4_lock lock;
141};
142
143struct NLM4_GRANTEDres {
144 nlm_cookie cookie;
145 nlmstat4 status;
146};
147
6916a665
RS
148program NLM_PROGRAM {
149 version NLM_V4 {
150 void
151 NLM4_NULL(void) = 0;
152
e01ed6a2
RS
153 NLM4_TESTres
154 NLM4_TEST(NLM4_TESTargs) = 1;
6916a665 155
04ba56c4
RS
156 NLM4_LOCKres
157 NLM4_LOCK(NLM4_LOCKargs) = 2;
6916a665 158
c880fdac
RS
159 NLM4_CANCres
160 NLM4_CANCEL(NLM4_CANCargs) = 3;
6916a665 161
8d3c1af0
RS
162 NLM4_UNLOCKres
163 NLM4_UNLOCK(NLM4_UNLOCKargs) = 4;
6916a665 164
c33ce42c
RS
165 NLM4_GRANTEDres
166 NLM4_GRANT(NLM4_GRANTEDargs) = 5;
6916a665 167
e01ed6a2
RS
168 void
169 NLM4_TEST_MSG(NLM4_TESTargs) = 6;
6916a665 170
04ba56c4
RS
171 void
172 NLM4_LOCK_MSG(NLM4_LOCKargs) = 7;
6916a665 173
c880fdac
RS
174 void
175 NLM4_CANCEL_MSG(NLM4_CANCargs) = 8;
6916a665 176
8d3c1af0
RS
177 void
178 NLM4_UNLOCK_MSG(NLM4_UNLOCKargs) = 9;
6916a665 179
c33ce42c
RS
180 void
181 NLM4_GRANT_MSG(NLM4_GRANTEDargs) = 10;
6916a665 182
e01ed6a2
RS
183 void
184 NLM4_TEST_RES(NLM4_TESTres) = 11;
6916a665 185
04ba56c4
RS
186 void
187 NLM4_LOCK_RES(NLM4_LOCKres) = 12;
6916a665 188
c880fdac
RS
189 void
190 NLM4_CANCEL_RES(NLM4_CANCres) = 13;
6916a665 191
8d3c1af0
RS
192 void
193 NLM4_UNLOCK_RES(NLM4_UNLOCKres) = 14;
6916a665 194
c33ce42c
RS
195 void
196 NLM4_GRANT_RES(NLM4_GRANTEDres) = 15;
6916a665
RS
197
198/* nlm4_shareres */
199/* NLM4_SHARE(nlm4_shareargs) = 20; */
200
201/* nlm4_shareres */
202/* NLM4_UNSHARE(nlm4_shareargs) = 21; */
203
204/* nlm4_res */
205/* NLM4_NM_LOCK(nlm4_lockargs) = 22; */
206
207/* void */
208/* NLM4_FREE_ALL(nlm4_notify) = 23; */
209 } = 4;
210} = 100021;