proto files: add a simplified bsd licence to the dot-x files
[deb_libnfs.git] / nlm / nlm.x
... / ...
CommitLineData
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*/
29
30typedef unsigned hyper uint64;
31
32struct nlm_fh4 {
33 opaque data<>;
34};
35
36typedef string nlm4_oh<>;
37
38struct nlm_cookie {
39 opaque data<>;
40};
41
42enum nlmstat4 {
43 NLM4_GRANTED = 0,
44 NLM4_DENIED = 1,
45 NLM4_DENIED_NOLOCKS = 2,
46 NLM4_BLOCKED = 3,
47 NLM4_DENIED_GRACE_PERIOD = 4,
48 NLM4_DEADLCK = 5,
49 NLM4_ROFS = 6,
50 NLM4_STALE_FH = 7,
51 NLM4_FBIG = 8,
52 NLM4_FAILED = 9
53};
54
55struct nlm4_holder {
56 bool exclusive;
57 unsigned int svid;
58 nlm4_oh oh;
59 uint64 l_offset;
60 uint64 l_len;
61};
62
63const NLM_MAXNAME = 256;
64struct nlm4_lock {
65 string caller_name<NLM_MAXNAME>;
66 struct nlm_fh4 fh;
67 nlm4_oh oh;
68 unsigned int svid;
69 uint64 l_offset;
70 uint64 l_len;
71};
72
73struct nlm4_share {
74 string caller_name<NLM_MAXNAME>;
75 struct nlm_fh4 fh;
76 nlm4_oh oh;
77 unsigned int mode;
78 unsigned int access;
79};
80
81struct nlm4_testres_denied {
82 nlm4_holder holder;
83};
84
85union nlm4_testreply switch (nlmstat4 status) {
86 case NLM4_DENIED:
87 nlm4_testres_denied lock;
88 default:
89 void;
90};
91
92struct NLM4_TESTres {
93 nlm_cookie cookie;
94 nlm4_testreply reply;
95};
96
97struct NLM4_TESTargs {
98 nlm_cookie cookie;
99 bool exclusive;
100 nlm4_lock lock;
101};
102
103struct NLM4_CANCres {
104 nlm_cookie cookie;
105 nlmstat4 status;
106};
107
108struct NLM4_CANCargs {
109 nlm_cookie cookie;
110 bool block;
111 bool exclusive;
112 nlm4_lock lock;
113};
114
115struct NLM4_UNLOCKres {
116 nlm_cookie cookie;
117 nlmstat4 status;
118};
119
120struct NLM4_UNLOCKargs {
121 nlm_cookie cookie;
122 nlm4_lock lock;
123};
124
125struct NLM4_LOCKres {
126 nlm_cookie cookie;
127 nlmstat4 status;
128};
129
130struct NLM4_LOCKargs {
131 nlm_cookie cookie;
132 bool block;
133 bool exclusive;
134 nlm4_lock lock;
135 bool reclaim;
136 int state;
137};
138
139struct NLM4_GRANTEDargs {
140 nlm_cookie cookie;
141 bool exclusive;
142 nlm4_lock lock;
143};
144
145struct NLM4_GRANTEDres {
146 nlm_cookie cookie;
147 nlmstat4 status;
148};
149
150program NLM_PROGRAM {
151 version NLM_V4 {
152 void
153 NLM4_NULL(void) = 0;
154
155 NLM4_TESTres
156 NLM4_TEST(NLM4_TESTargs) = 1;
157
158 NLM4_LOCKres
159 NLM4_LOCK(NLM4_LOCKargs) = 2;
160
161 NLM4_CANCres
162 NLM4_CANCEL(NLM4_CANCargs) = 3;
163
164 NLM4_UNLOCKres
165 NLM4_UNLOCK(NLM4_UNLOCKargs) = 4;
166
167 NLM4_GRANTEDres
168 NLM4_GRANT(NLM4_GRANTEDargs) = 5;
169
170 void
171 NLM4_TEST_MSG(NLM4_TESTargs) = 6;
172
173 void
174 NLM4_LOCK_MSG(NLM4_LOCKargs) = 7;
175
176 void
177 NLM4_CANCEL_MSG(NLM4_CANCargs) = 8;
178
179 void
180 NLM4_UNLOCK_MSG(NLM4_UNLOCKargs) = 9;
181
182 void
183 NLM4_GRANT_MSG(NLM4_GRANTEDargs) = 10;
184
185 void
186 NLM4_TEST_RES(NLM4_TESTres) = 11;
187
188 void
189 NLM4_LOCK_RES(NLM4_LOCKres) = 12;
190
191 void
192 NLM4_CANCEL_RES(NLM4_CANCres) = 13;
193
194 void
195 NLM4_UNLOCK_RES(NLM4_UNLOCKres) = 14;
196
197 void
198 NLM4_GRANT_RES(NLM4_GRANTEDres) = 15;
199
200/* nlm4_shareres */
201/* NLM4_SHARE(nlm4_shareargs) = 20; */
202
203/* nlm4_shareres */
204/* NLM4_UNSHARE(nlm4_shareargs) = 21; */
205
206/* nlm4_res */
207/* NLM4_NM_LOCK(nlm4_lockargs) = 22; */
208
209/* void */
210/* NLM4_FREE_ALL(nlm4_notify) = 23; */
211 } = 4;
212} = 100021;