Commit | Line | Data |
---|---|---|
2f5c161b RS |
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 | */ | |
6916a665 | 29 | |
6b93021b | 30 | typedef unsigned hyper uint64; |
e01ed6a2 RS |
31 | |
32 | struct nlm_fh4 { | |
33 | opaque data<>; | |
34 | }; | |
35 | ||
36 | typedef string nlm4_oh<>; | |
37 | ||
38 | struct nlm_cookie { | |
39 | opaque data<>; | |
40 | }; | |
6916a665 RS |
41 | |
42 | enum 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 | ||
55 | struct nlm4_holder { | |
e01ed6a2 RS |
56 | bool exclusive; |
57 | unsigned int svid; | |
58 | nlm4_oh oh; | |
6b93021b RS |
59 | uint64 l_offset; |
60 | uint64 l_len; | |
6916a665 RS |
61 | }; |
62 | ||
63 | const NLM_MAXNAME = 256; | |
64 | struct nlm4_lock { | |
e01ed6a2 RS |
65 | string caller_name<NLM_MAXNAME>; |
66 | struct nlm_fh4 fh; | |
67 | nlm4_oh oh; | |
68 | unsigned int svid; | |
6b93021b RS |
69 | uint64 l_offset; |
70 | uint64 l_len; | |
6916a665 RS |
71 | }; |
72 | ||
73 | struct nlm4_share { | |
e01ed6a2 RS |
74 | string caller_name<NLM_MAXNAME>; |
75 | struct nlm_fh4 fh; | |
76 | nlm4_oh oh; | |
77 | unsigned int mode; | |
78 | unsigned int access; | |
6916a665 RS |
79 | }; |
80 | ||
2faefcac | 81 | struct nlm4_testres_denied { |
6916a665 RS |
82 | nlm4_holder holder; |
83 | }; | |
84 | ||
2faefcac RS |
85 | union nlm4_testreply switch (nlmstat4 status) { |
86 | case NLM4_DENIED: | |
87 | nlm4_testres_denied lock; | |
6916a665 RS |
88 | default: |
89 | void; | |
90 | }; | |
91 | ||
2faefcac RS |
92 | struct NLM4_TESTres { |
93 | nlm_cookie cookie; | |
94 | nlm4_testreply reply; | |
95 | }; | |
96 | ||
e01ed6a2 | 97 | struct NLM4_TESTargs { |
6916a665 RS |
98 | nlm_cookie cookie; |
99 | bool exclusive; | |
100 | nlm4_lock lock; | |
101 | }; | |
102 | ||
c880fdac RS |
103 | struct NLM4_CANCres { |
104 | nlm_cookie cookie; | |
105 | nlmstat4 status; | |
106 | }; | |
107 | ||
108 | struct NLM4_CANCargs { | |
109 | nlm_cookie cookie; | |
110 | bool block; | |
111 | bool exclusive; | |
112 | nlm4_lock lock; | |
113 | }; | |
114 | ||
8d3c1af0 RS |
115 | struct NLM4_UNLOCKres { |
116 | nlm_cookie cookie; | |
117 | nlmstat4 status; | |
118 | }; | |
119 | ||
120 | struct NLM4_UNLOCKargs { | |
121 | nlm_cookie cookie; | |
122 | nlm4_lock lock; | |
123 | }; | |
124 | ||
04ba56c4 RS |
125 | struct NLM4_LOCKres { |
126 | nlm_cookie cookie; | |
127 | nlmstat4 status; | |
128 | }; | |
129 | ||
130 | struct NLM4_LOCKargs { | |
131 | nlm_cookie cookie; | |
132 | bool block; | |
133 | bool exclusive; | |
134 | nlm4_lock lock; | |
135 | bool reclaim; | |
136 | int state; | |
137 | }; | |
138 | ||
c33ce42c RS |
139 | struct NLM4_GRANTEDargs { |
140 | nlm_cookie cookie; | |
141 | bool exclusive; | |
142 | nlm4_lock lock; | |
143 | }; | |
144 | ||
145 | struct NLM4_GRANTEDres { | |
146 | nlm_cookie cookie; | |
147 | nlmstat4 status; | |
148 | }; | |
149 | ||
6916a665 RS |
150 | program NLM_PROGRAM { |
151 | version NLM_V4 { | |
152 | void | |
153 | NLM4_NULL(void) = 0; | |
154 | ||
e01ed6a2 RS |
155 | NLM4_TESTres |
156 | NLM4_TEST(NLM4_TESTargs) = 1; | |
6916a665 | 157 | |
04ba56c4 RS |
158 | NLM4_LOCKres |
159 | NLM4_LOCK(NLM4_LOCKargs) = 2; | |
6916a665 | 160 | |
c880fdac RS |
161 | NLM4_CANCres |
162 | NLM4_CANCEL(NLM4_CANCargs) = 3; | |
6916a665 | 163 | |
8d3c1af0 RS |
164 | NLM4_UNLOCKres |
165 | NLM4_UNLOCK(NLM4_UNLOCKargs) = 4; | |
6916a665 | 166 | |
c33ce42c RS |
167 | NLM4_GRANTEDres |
168 | NLM4_GRANT(NLM4_GRANTEDargs) = 5; | |
6916a665 | 169 | |
e01ed6a2 RS |
170 | void |
171 | NLM4_TEST_MSG(NLM4_TESTargs) = 6; | |
6916a665 | 172 | |
04ba56c4 RS |
173 | void |
174 | NLM4_LOCK_MSG(NLM4_LOCKargs) = 7; | |
6916a665 | 175 | |
c880fdac RS |
176 | void |
177 | NLM4_CANCEL_MSG(NLM4_CANCargs) = 8; | |
6916a665 | 178 | |
8d3c1af0 RS |
179 | void |
180 | NLM4_UNLOCK_MSG(NLM4_UNLOCKargs) = 9; | |
6916a665 | 181 | |
c33ce42c RS |
182 | void |
183 | NLM4_GRANT_MSG(NLM4_GRANTEDargs) = 10; | |
6916a665 | 184 | |
e01ed6a2 RS |
185 | void |
186 | NLM4_TEST_RES(NLM4_TESTres) = 11; | |
6916a665 | 187 | |
04ba56c4 RS |
188 | void |
189 | NLM4_LOCK_RES(NLM4_LOCKres) = 12; | |
6916a665 | 190 | |
c880fdac RS |
191 | void |
192 | NLM4_CANCEL_RES(NLM4_CANCres) = 13; | |
6916a665 | 193 | |
8d3c1af0 RS |
194 | void |
195 | NLM4_UNLOCK_RES(NLM4_UNLOCKres) = 14; | |
6916a665 | 196 | |
c33ce42c RS |
197 | void |
198 | NLM4_GRANT_RES(NLM4_GRANTEDres) = 15; | |
6916a665 RS |
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; |