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