blob: 31cb48425733033529d4a7e7ba63014773b1226b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/fs/lockd/svcproc.c
3 *
4 * Lockd server procedures. We don't implement the NLM_*_RES
5 * procedures because we don't use the async procedures.
6 *
7 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
8 */
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/types.h>
11#include <linux/time.h>
12#include <linux/slab.h>
13#include <linux/in.h>
14#include <linux/sunrpc/svc.h>
15#include <linux/sunrpc/clnt.h>
16#include <linux/nfsd/nfsd.h>
17#include <linux/lockd/lockd.h>
18#include <linux/lockd/share.h>
19#include <linux/lockd/sm_inter.h>
20
21
22#define NLMDBG_FACILITY NLMDBG_CLIENT
23
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#ifdef CONFIG_LOCKD_V4
Al Viro52921e02006-10-19 23:28:46 -070025static __be32
26cast_to_nlm(__be32 status, u32 vers)
Linus Torvalds1da177e2005-04-16 15:20:36 -070027{
28 /* Note: status is assumed to be in network byte order !!! */
29 if (vers != 4){
30 switch (status) {
31 case nlm_granted:
32 case nlm_lck_denied:
33 case nlm_lck_denied_nolocks:
34 case nlm_lck_blocked:
35 case nlm_lck_denied_grace_period:
36 break;
37 case nlm4_deadlock:
38 status = nlm_lck_denied;
39 break;
40 default:
41 status = nlm_lck_denied_nolocks;
42 }
43 }
44
45 return (status);
46}
47#define cast_status(status) (cast_to_nlm(status, rqstp->rq_vers))
48#else
49#define cast_status(status) (status)
50#endif
51
52/*
53 * Obtain client and file from arguments
54 */
Al Viro52921e02006-10-19 23:28:46 -070055static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -070056nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
57 struct nlm_host **hostp, struct nlm_file **filp)
58{
59 struct nlm_host *host = NULL;
60 struct nlm_file *file = NULL;
61 struct nlm_lock *lock = &argp->lock;
Al Viro52921e02006-10-19 23:28:46 -070062 __be32 error = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64 /* nfsd callbacks must have been installed for this procedure */
65 if (!nlmsvc_ops)
66 return nlm_lck_denied_nolocks;
67
68 /* Obtain host handle */
Olaf Kirchdb4e4c92006-10-04 02:15:52 -070069 if (!(host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len))
Olaf Kirch977faf32006-10-04 02:15:51 -070070 || (argp->monitor && nsm_monitor(host) < 0))
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 goto no_locks;
72 *hostp = host;
73
74 /* Obtain file pointer. Not used by FREE_ALL call. */
75 if (filp != NULL) {
76 if ((error = nlm_lookup_file(rqstp, &file, &lock->fh)) != 0)
77 goto no_locks;
78 *filp = file;
79
80 /* Set up the missing parts of the file_lock structure */
81 lock->fl.fl_file = file->f_file;
82 lock->fl.fl_owner = (fl_owner_t) host;
83 lock->fl.fl_lmops = &nlmsvc_lock_operations;
84 }
85
86 return 0;
87
88no_locks:
89 if (host)
90 nlm_release_host(host);
NeilBrownd343fce2006-10-17 00:10:18 -070091 if (error)
92 return error;
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 return nlm_lck_denied_nolocks;
94}
95
96/*
97 * NULL: Test for presence of service
98 */
Al Viro7111c662006-10-19 23:28:45 -070099static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100nlmsvc_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
101{
102 dprintk("lockd: NULL called\n");
103 return rpc_success;
104}
105
106/*
107 * TEST: Check for conflicting lock
108 */
Al Viro7111c662006-10-19 23:28:45 -0700109static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
111 struct nlm_res *resp)
112{
113 struct nlm_host *host;
114 struct nlm_file *file;
115
116 dprintk("lockd: TEST called\n");
117 resp->cookie = argp->cookie;
118
119 /* Don't accept test requests during grace period */
120 if (nlmsvc_grace_period) {
121 resp->status = nlm_lck_denied_grace_period;
122 return rpc_success;
123 }
124
125 /* Obtain client and file */
126 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
NeilBrownd343fce2006-10-17 00:10:18 -0700127 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128
129 /* Now check for conflicting locks */
130 resp->status = cast_status(nlmsvc_testlock(file, &argp->lock, &resp->lock));
131
132 dprintk("lockd: TEST status %d vers %d\n",
133 ntohl(resp->status), rqstp->rq_vers);
134 nlm_release_host(host);
135 nlm_release_file(file);
136 return rpc_success;
137}
138
Al Viro7111c662006-10-19 23:28:45 -0700139static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
141 struct nlm_res *resp)
142{
143 struct nlm_host *host;
144 struct nlm_file *file;
145
146 dprintk("lockd: LOCK called\n");
147
148 resp->cookie = argp->cookie;
149
150 /* Don't accept new lock requests during grace period */
151 if (nlmsvc_grace_period && !argp->reclaim) {
152 resp->status = nlm_lck_denied_grace_period;
153 return rpc_success;
154 }
155
156 /* Obtain client and file */
157 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
NeilBrownd343fce2006-10-17 00:10:18 -0700158 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159
160#if 0
161 /* If supplied state doesn't match current state, we assume it's
162 * an old request that time-warped somehow. Any error return would
163 * do in this case because it's irrelevant anyway.
164 *
165 * NB: We don't retrieve the remote host's state yet.
166 */
167 if (host->h_nsmstate && host->h_nsmstate != argp->state) {
168 resp->status = nlm_lck_denied_nolocks;
169 } else
170#endif
171
172 /* Now try to lock the file */
173 resp->status = cast_status(nlmsvc_lock(rqstp, file, &argp->lock,
174 argp->block, &argp->cookie));
175
176 dprintk("lockd: LOCK status %d\n", ntohl(resp->status));
177 nlm_release_host(host);
178 nlm_release_file(file);
179 return rpc_success;
180}
181
Al Viro7111c662006-10-19 23:28:45 -0700182static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp,
184 struct nlm_res *resp)
185{
186 struct nlm_host *host;
187 struct nlm_file *file;
188
189 dprintk("lockd: CANCEL called\n");
190
191 resp->cookie = argp->cookie;
192
193 /* Don't accept requests during grace period */
194 if (nlmsvc_grace_period) {
195 resp->status = nlm_lck_denied_grace_period;
196 return rpc_success;
197 }
198
199 /* Obtain client and file */
200 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
NeilBrownd343fce2006-10-17 00:10:18 -0700201 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202
203 /* Try to cancel request. */
204 resp->status = cast_status(nlmsvc_cancel_blocked(file, &argp->lock));
205
206 dprintk("lockd: CANCEL status %d\n", ntohl(resp->status));
207 nlm_release_host(host);
208 nlm_release_file(file);
209 return rpc_success;
210}
211
212/*
213 * UNLOCK: release a lock
214 */
Al Viro7111c662006-10-19 23:28:45 -0700215static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp,
217 struct nlm_res *resp)
218{
219 struct nlm_host *host;
220 struct nlm_file *file;
221
222 dprintk("lockd: UNLOCK called\n");
223
224 resp->cookie = argp->cookie;
225
226 /* Don't accept new lock requests during grace period */
227 if (nlmsvc_grace_period) {
228 resp->status = nlm_lck_denied_grace_period;
229 return rpc_success;
230 }
231
232 /* Obtain client and file */
233 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
NeilBrownd343fce2006-10-17 00:10:18 -0700234 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235
236 /* Now try to remove the lock */
237 resp->status = cast_status(nlmsvc_unlock(file, &argp->lock));
238
239 dprintk("lockd: UNLOCK status %d\n", ntohl(resp->status));
240 nlm_release_host(host);
241 nlm_release_file(file);
242 return rpc_success;
243}
244
245/*
246 * GRANTED: A server calls us to tell that a process' lock request
247 * was granted
248 */
Al Viro7111c662006-10-19 23:28:45 -0700249static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
251 struct nlm_res *resp)
252{
253 resp->cookie = argp->cookie;
254
255 dprintk("lockd: GRANTED called\n");
Chuck Lever27459f02007-02-12 00:53:34 -0800256 resp->status = nlmclnt_grant(svc_addr_in(rqstp), &argp->lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
258 return rpc_success;
259}
260
261/*
Trond Myklebustd4716622006-03-20 13:44:45 -0500262 * This is the generic lockd callback for async RPC calls
263 */
264static void nlmsvc_callback_exit(struct rpc_task *task, void *data)
265{
Chuck Leverc041b5f2006-12-05 16:36:03 -0500266 dprintk("lockd: %5u callback returned %d\n", task->tk_pid,
Trond Myklebustd4716622006-03-20 13:44:45 -0500267 -task->tk_status);
268}
269
270static void nlmsvc_callback_release(void *data)
271{
272 nlm_release_call(data);
273}
274
275static const struct rpc_call_ops nlmsvc_callback_ops = {
276 .rpc_call_done = nlmsvc_callback_exit,
277 .rpc_release = nlmsvc_callback_release,
278};
279
280/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281 * `Async' versions of the above service routines. They aren't really,
282 * because we send the callback before the reply proper. I hope this
283 * doesn't break any clients.
284 */
Al Viro7111c662006-10-19 23:28:45 -0700285static __be32 nlmsvc_callback(struct svc_rqst *rqstp, u32 proc, struct nlm_args *argp,
286 __be32 (*func)(struct svc_rqst *, struct nlm_args *, struct nlm_res *))
Trond Myklebustd4716622006-03-20 13:44:45 -0500287{
288 struct nlm_host *host;
289 struct nlm_rqst *call;
Al Viro7111c662006-10-19 23:28:45 -0700290 __be32 stat;
Trond Myklebustd4716622006-03-20 13:44:45 -0500291
Olaf Kirchdb4e4c92006-10-04 02:15:52 -0700292 host = nlmsvc_lookup_host(rqstp,
293 argp->lock.caller,
294 argp->lock.len);
Trond Myklebustd4716622006-03-20 13:44:45 -0500295 if (host == NULL)
296 return rpc_system_err;
297
298 call = nlm_alloc_call(host);
299 if (call == NULL)
300 return rpc_system_err;
301
302 stat = func(rqstp, argp, &call->a_res);
303 if (stat != 0) {
304 nlm_release_call(call);
305 return stat;
306 }
307
308 call->a_flags = RPC_TASK_ASYNC;
309 if (nlm_async_reply(call, proc, &nlmsvc_callback_ops) < 0)
310 return rpc_system_err;
311 return rpc_success;
312}
313
Al Viro7111c662006-10-19 23:28:45 -0700314static __be32 nlmsvc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315 void *resp)
316{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317 dprintk("lockd: TEST_MSG called\n");
Trond Myklebustd4716622006-03-20 13:44:45 -0500318 return nlmsvc_callback(rqstp, NLMPROC_TEST_RES, argp, nlmsvc_proc_test);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319}
320
Al Viro7111c662006-10-19 23:28:45 -0700321static __be32 nlmsvc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 void *resp)
323{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324 dprintk("lockd: LOCK_MSG called\n");
Trond Myklebustd4716622006-03-20 13:44:45 -0500325 return nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, argp, nlmsvc_proc_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700326}
327
Al Viro7111c662006-10-19 23:28:45 -0700328static __be32 nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329 void *resp)
330{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331 dprintk("lockd: CANCEL_MSG called\n");
Trond Myklebustd4716622006-03-20 13:44:45 -0500332 return nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, argp, nlmsvc_proc_cancel);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700333}
334
Al Viro7111c662006-10-19 23:28:45 -0700335static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
337 void *resp)
338{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339 dprintk("lockd: UNLOCK_MSG called\n");
Trond Myklebustd4716622006-03-20 13:44:45 -0500340 return nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, argp, nlmsvc_proc_unlock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341}
342
Al Viro7111c662006-10-19 23:28:45 -0700343static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344nlmsvc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
345 void *resp)
346{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347 dprintk("lockd: GRANTED_MSG called\n");
Trond Myklebustd4716622006-03-20 13:44:45 -0500348 return nlmsvc_callback(rqstp, NLMPROC_GRANTED_RES, argp, nlmsvc_proc_granted);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349}
350
351/*
352 * SHARE: create a DOS share or alter existing share.
353 */
Al Viro7111c662006-10-19 23:28:45 -0700354static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp,
356 struct nlm_res *resp)
357{
358 struct nlm_host *host;
359 struct nlm_file *file;
360
361 dprintk("lockd: SHARE called\n");
362
363 resp->cookie = argp->cookie;
364
365 /* Don't accept new lock requests during grace period */
366 if (nlmsvc_grace_period && !argp->reclaim) {
367 resp->status = nlm_lck_denied_grace_period;
368 return rpc_success;
369 }
370
371 /* Obtain client and file */
372 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
NeilBrownd343fce2006-10-17 00:10:18 -0700373 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374
375 /* Now try to create the share */
376 resp->status = cast_status(nlmsvc_share_file(host, file, argp));
377
378 dprintk("lockd: SHARE status %d\n", ntohl(resp->status));
379 nlm_release_host(host);
380 nlm_release_file(file);
381 return rpc_success;
382}
383
384/*
385 * UNSHARE: Release a DOS share.
386 */
Al Viro7111c662006-10-19 23:28:45 -0700387static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp,
389 struct nlm_res *resp)
390{
391 struct nlm_host *host;
392 struct nlm_file *file;
393
394 dprintk("lockd: UNSHARE called\n");
395
396 resp->cookie = argp->cookie;
397
398 /* Don't accept requests during grace period */
399 if (nlmsvc_grace_period) {
400 resp->status = nlm_lck_denied_grace_period;
401 return rpc_success;
402 }
403
404 /* Obtain client and file */
405 if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file)))
NeilBrownd343fce2006-10-17 00:10:18 -0700406 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407
408 /* Now try to unshare the file */
409 resp->status = cast_status(nlmsvc_unshare_file(host, file, argp));
410
411 dprintk("lockd: UNSHARE status %d\n", ntohl(resp->status));
412 nlm_release_host(host);
413 nlm_release_file(file);
414 return rpc_success;
415}
416
417/*
418 * NM_LOCK: Create an unmonitored lock
419 */
Al Viro7111c662006-10-19 23:28:45 -0700420static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421nlmsvc_proc_nm_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
422 struct nlm_res *resp)
423{
424 dprintk("lockd: NM_LOCK called\n");
425
426 argp->monitor = 0; /* just clean the monitor flag */
427 return nlmsvc_proc_lock(rqstp, argp, resp);
428}
429
430/*
431 * FREE_ALL: Release all locks and shares held by client
432 */
Al Viro7111c662006-10-19 23:28:45 -0700433static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
435 void *resp)
436{
437 struct nlm_host *host;
438
439 /* Obtain client */
440 if (nlmsvc_retrieve_args(rqstp, argp, &host, NULL))
441 return rpc_success;
442
443 nlmsvc_free_host_resources(host);
444 nlm_release_host(host);
445 return rpc_success;
446}
447
448/*
449 * SM_NOTIFY: private callback from statd (not part of official NLM proto)
450 */
Al Viro7111c662006-10-19 23:28:45 -0700451static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
453 void *resp)
454{
Chuck Lever27459f02007-02-12 00:53:34 -0800455 struct sockaddr_in saddr;
456
457 memcpy(&saddr, svc_addr_in(rqstp), sizeof(saddr));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458
459 dprintk("lockd: SM_NOTIFY called\n");
460 if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)
461 || ntohs(saddr.sin_port) >= 1024) {
Chuck Leverad06e4b2007-02-12 00:53:32 -0800462 char buf[RPC_MAX_ADDRBUFLEN];
463 printk(KERN_WARNING "lockd: rejected NSM callback from %s\n",
464 svc_print_addr(rqstp, buf, sizeof(buf)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465 return rpc_system_err;
466 }
467
468 /* Obtain the host pointer for this NFS server and try to
469 * reclaim all locks we hold on this server.
470 */
Olaf Kirchcf712c22006-10-04 02:15:52 -0700471 memset(&saddr, 0, sizeof(saddr));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 saddr.sin_addr.s_addr = argp->addr;
Olaf Kirch5c8dd292006-10-04 02:15:55 -0700473 nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700474
475 return rpc_success;
476}
477
478/*
479 * client sent a GRANTED_RES, let's remove the associated block
480 */
Al Viro7111c662006-10-19 23:28:45 -0700481static __be32
Linus Torvalds1da177e2005-04-16 15:20:36 -0700482nlmsvc_proc_granted_res(struct svc_rqst *rqstp, struct nlm_res *argp,
483 void *resp)
484{
485 if (!nlmsvc_ops)
486 return rpc_success;
487
488 dprintk("lockd: GRANTED_RES called\n");
489
Olaf Kirch39be4502006-10-04 02:16:03 -0700490 nlmsvc_grant_reply(&argp->cookie, argp->status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491 return rpc_success;
492}
493
494/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495 * NLM Server procedures.
496 */
497
498#define nlmsvc_encode_norep nlmsvc_encode_void
499#define nlmsvc_decode_norep nlmsvc_decode_void
500#define nlmsvc_decode_testres nlmsvc_decode_void
501#define nlmsvc_decode_lockres nlmsvc_decode_void
502#define nlmsvc_decode_unlockres nlmsvc_decode_void
503#define nlmsvc_decode_cancelres nlmsvc_decode_void
504#define nlmsvc_decode_grantedres nlmsvc_decode_void
505
506#define nlmsvc_proc_none nlmsvc_proc_null
507#define nlmsvc_proc_test_res nlmsvc_proc_null
508#define nlmsvc_proc_lock_res nlmsvc_proc_null
509#define nlmsvc_proc_cancel_res nlmsvc_proc_null
510#define nlmsvc_proc_unlock_res nlmsvc_proc_null
511
512struct nlm_void { int dummy; };
513
514#define PROC(name, xargt, xrest, argt, rest, respsize) \
515 { .pc_func = (svc_procfunc) nlmsvc_proc_##name, \
516 .pc_decode = (kxdrproc_t) nlmsvc_decode_##xargt, \
517 .pc_encode = (kxdrproc_t) nlmsvc_encode_##xrest, \
518 .pc_release = NULL, \
519 .pc_argsize = sizeof(struct nlm_##argt), \
520 .pc_ressize = sizeof(struct nlm_##rest), \
521 .pc_xdrressize = respsize, \
522 }
523
524#define Ck (1+XDR_QUADLEN(NLM_MAXCOOKIELEN)) /* cookie */
525#define St 1 /* status */
526#define No (1+1024/4) /* Net Obj */
527#define Rg 2 /* range - offset + size */
528
529struct svc_procedure nlmsvc_procedures[] = {
530 PROC(null, void, void, void, void, 1),
531 PROC(test, testargs, testres, args, res, Ck+St+2+No+Rg),
532 PROC(lock, lockargs, res, args, res, Ck+St),
533 PROC(cancel, cancargs, res, args, res, Ck+St),
534 PROC(unlock, unlockargs, res, args, res, Ck+St),
535 PROC(granted, testargs, res, args, res, Ck+St),
536 PROC(test_msg, testargs, norep, args, void, 1),
537 PROC(lock_msg, lockargs, norep, args, void, 1),
538 PROC(cancel_msg, cancargs, norep, args, void, 1),
539 PROC(unlock_msg, unlockargs, norep, args, void, 1),
540 PROC(granted_msg, testargs, norep, args, void, 1),
541 PROC(test_res, testres, norep, res, void, 1),
542 PROC(lock_res, lockres, norep, res, void, 1),
543 PROC(cancel_res, cancelres, norep, res, void, 1),
544 PROC(unlock_res, unlockres, norep, res, void, 1),
545 PROC(granted_res, res, norep, res, void, 1),
546 /* statd callback */
547 PROC(sm_notify, reboot, void, reboot, void, 1),
548 PROC(none, void, void, void, void, 1),
549 PROC(none, void, void, void, void, 1),
550 PROC(none, void, void, void, void, 1),
551 PROC(share, shareargs, shareres, args, res, Ck+St+1),
552 PROC(unshare, shareargs, shareres, args, res, Ck+St+1),
553 PROC(nm_lock, lockargs, res, args, res, Ck+St),
554 PROC(free_all, notify, void, args, void, 0),
555
556};