]> git.ipfire.org Git - people/ms/linux.git/blame - fs/lockd/svc4proc.c
Merge branch 'for-6.0/dax' into libnvdimm-fixes
[people/ms/linux.git] / fs / lockd / svc4proc.c
CommitLineData
b2441318 1// SPDX-License-Identifier: GPL-2.0
1da177e4
LT
2/*
3 * linux/fs/lockd/svc4proc.c
4 *
5 * Lockd server procedures. We don't implement the NLM_*_RES
6 * procedures because we don't use the async procedures.
7 *
8 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
9 */
10
11#include <linux/types.h>
12#include <linux/time.h>
1da177e4
LT
13#include <linux/lockd/lockd.h>
14#include <linux/lockd/share.h>
5ccb0066 15#include <linux/sunrpc/svc_xprt.h>
1da177e4
LT
16
17#define NLMDBG_FACILITY NLMDBG_CLIENT
18
1da177e4
LT
19/*
20 * Obtain client and file from arguments
21 */
52921e02 22static __be32
1da177e4
LT
23nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
24 struct nlm_host **hostp, struct nlm_file **filp)
25{
26 struct nlm_host *host = NULL;
27 struct nlm_file *file = NULL;
28 struct nlm_lock *lock = &argp->lock;
52921e02 29 __be32 error = 0;
1da177e4
LT
30
31 /* nfsd callbacks must have been installed for this procedure */
32 if (!nlmsvc_ops)
33 return nlm_lck_denied_nolocks;
34
6930bcbf
JL
35 if (lock->lock_start > OFFSET_MAX ||
36 (lock->lock_len && ((lock->lock_len - 1) > (OFFSET_MAX - lock->lock_start))))
37 return nlm4_fbig;
38
1da177e4 39 /* Obtain host handle */
db4e4c9a 40 if (!(host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len))
977faf39 41 || (argp->monitor && nsm_monitor(host) < 0))
1da177e4
LT
42 goto no_locks;
43 *hostp = host;
44
45 /* Obtain file pointer. Not used by FREE_ALL call. */
46 if (filp != NULL) {
7f024fcd
BF
47 int mode = lock_to_openmode(&lock->fl);
48
2dc6f19e
BF
49 error = nlm_lookup_file(rqstp, &file, lock);
50 if (error)
1da177e4
LT
51 goto no_locks;
52 *filp = file;
53
54 /* Set up the missing parts of the file_lock structure */
7f024fcd 55 lock->fl.fl_file = file->f_file[mode];
646d73e9 56 lock->fl.fl_pid = current->tgid;
6930bcbf
JL
57 lock->fl.fl_start = (loff_t)lock->lock_start;
58 lock->fl.fl_end = lock->lock_len ?
59 (loff_t)(lock->lock_start + lock->lock_len - 1) :
60 OFFSET_MAX;
1da177e4 61 lock->fl.fl_lmops = &nlmsvc_lock_operations;
89e0edfb
BC
62 nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);
63 if (!lock->fl.fl_owner) {
64 /* lockowner allocation has failed */
65 nlmsvc_release_host(host);
66 return nlm_lck_denied_nolocks;
67 }
1da177e4
LT
68 }
69
70 return 0;
71
72no_locks:
67216b94 73 nlmsvc_release_host(host);
1da177e4
LT
74 if (error)
75 return error;
76 return nlm_lck_denied_nolocks;
77}
78
79/*
80 * NULL: Test for presence of service
81 */
7111c66e 82static __be32
a6beb732 83nlm4svc_proc_null(struct svc_rqst *rqstp)
1da177e4
LT
84{
85 dprintk("lockd: NULL called\n");
86 return rpc_success;
87}
88
89/*
90 * TEST: Check for conflicting lock
91 */
7111c66e 92static __be32
a6beb732 93__nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
1da177e4 94{
a6beb732 95 struct nlm_args *argp = rqstp->rq_argp;
1da177e4
LT
96 struct nlm_host *host;
97 struct nlm_file *file;
184cefbe 98 struct nlm_lockowner *test_owner;
317602f3 99 __be32 rc = rpc_success;
1da177e4
LT
100
101 dprintk("lockd: TEST4 called\n");
102 resp->cookie = argp->cookie;
103
1da177e4
LT
104 /* Obtain client and file */
105 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
d343fce1 106 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
1da177e4 107
184cefbe 108 test_owner = argp->lock.fl.fl_owner;
1da177e4 109 /* Now check for conflicting locks */
8f920d5e 110 resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie);
5ea0d750 111 if (resp->status == nlm_drop_reply)
b7e6b869
OD
112 rc = rpc_drop_reply;
113 else
114 dprintk("lockd: TEST4 status %d\n", ntohl(resp->status));
1da177e4 115
184cefbe 116 nlmsvc_put_lockowner(test_owner);
67216b94 117 nlmsvc_release_host(host);
1da177e4 118 nlm_release_file(file);
b7e6b869 119 return rc;
1da177e4
LT
120}
121
7111c66e 122static __be32
a6beb732 123nlm4svc_proc_test(struct svc_rqst *rqstp)
1da177e4 124{
a6beb732
CH
125 return __nlm4svc_proc_test(rqstp, rqstp->rq_resp);
126}
127
128static __be32
129__nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
130{
131 struct nlm_args *argp = rqstp->rq_argp;
1da177e4
LT
132 struct nlm_host *host;
133 struct nlm_file *file;
317602f3 134 __be32 rc = rpc_success;
1da177e4
LT
135
136 dprintk("lockd: LOCK called\n");
137
138 resp->cookie = argp->cookie;
139
1da177e4
LT
140 /* Obtain client and file */
141 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
d343fce1 142 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
1da177e4
LT
143
144#if 0
145 /* If supplied state doesn't match current state, we assume it's
146 * an old request that time-warped somehow. Any error return would
147 * do in this case because it's irrelevant anyway.
148 *
149 * NB: We don't retrieve the remote host's state yet.
150 */
151 if (host->h_nsmstate && host->h_nsmstate != argp->state) {
152 resp->status = nlm_lck_denied_nolocks;
153 } else
154#endif
155
156 /* Now try to lock the file */
6cde4de8 157 resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock,
b2b50289
BF
158 argp->block, &argp->cookie,
159 argp->reclaim);
1a8322b2 160 if (resp->status == nlm_drop_reply)
b7e6b869
OD
161 rc = rpc_drop_reply;
162 else
163 dprintk("lockd: LOCK status %d\n", ntohl(resp->status));
1da177e4 164
89e0edfb 165 nlmsvc_release_lockowner(&argp->lock);
67216b94 166 nlmsvc_release_host(host);
1da177e4 167 nlm_release_file(file);
b7e6b869 168 return rc;
1da177e4
LT
169}
170
7111c66e 171static __be32
a6beb732
CH
172nlm4svc_proc_lock(struct svc_rqst *rqstp)
173{
174 return __nlm4svc_proc_lock(rqstp, rqstp->rq_resp);
175}
176
177static __be32
178__nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
1da177e4 179{
a6beb732 180 struct nlm_args *argp = rqstp->rq_argp;
1da177e4
LT
181 struct nlm_host *host;
182 struct nlm_file *file;
183
184 dprintk("lockd: CANCEL called\n");
185
186 resp->cookie = argp->cookie;
187
188 /* Don't accept requests during grace period */
5ccb0066 189 if (locks_in_grace(SVC_NET(rqstp))) {
1da177e4
LT
190 resp->status = nlm_lck_denied_grace_period;
191 return rpc_success;
192 }
193
194 /* Obtain client and file */
195 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
d343fce1 196 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
1da177e4
LT
197
198 /* Try to cancel request. */
5ccb0066 199 resp->status = nlmsvc_cancel_blocked(SVC_NET(rqstp), file, &argp->lock);
1da177e4
LT
200
201 dprintk("lockd: CANCEL status %d\n", ntohl(resp->status));
89e0edfb 202 nlmsvc_release_lockowner(&argp->lock);
67216b94 203 nlmsvc_release_host(host);
1da177e4
LT
204 nlm_release_file(file);
205 return rpc_success;
206}
207
a6beb732
CH
208static __be32
209nlm4svc_proc_cancel(struct svc_rqst *rqstp)
210{
211 return __nlm4svc_proc_cancel(rqstp, rqstp->rq_resp);
212}
213
1da177e4
LT
214/*
215 * UNLOCK: release a lock
216 */
7111c66e 217static __be32
a6beb732 218__nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
1da177e4 219{
a6beb732 220 struct nlm_args *argp = rqstp->rq_argp;
1da177e4
LT
221 struct nlm_host *host;
222 struct nlm_file *file;
223
224 dprintk("lockd: UNLOCK called\n");
225
226 resp->cookie = argp->cookie;
227
228 /* Don't accept new lock requests during grace period */
5ccb0066 229 if (locks_in_grace(SVC_NET(rqstp))) {
1da177e4
LT
230 resp->status = nlm_lck_denied_grace_period;
231 return rpc_success;
232 }
233
234 /* Obtain client and file */
235 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
d343fce1 236 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
1da177e4
LT
237
238 /* Now try to remove the lock */
5ccb0066 239 resp->status = nlmsvc_unlock(SVC_NET(rqstp), file, &argp->lock);
1da177e4
LT
240
241 dprintk("lockd: UNLOCK status %d\n", ntohl(resp->status));
89e0edfb 242 nlmsvc_release_lockowner(&argp->lock);
67216b94 243 nlmsvc_release_host(host);
1da177e4
LT
244 nlm_release_file(file);
245 return rpc_success;
246}
247
a6beb732
CH
248static __be32
249nlm4svc_proc_unlock(struct svc_rqst *rqstp)
250{
251 return __nlm4svc_proc_unlock(rqstp, rqstp->rq_resp);
252}
253
1da177e4
LT
254/*
255 * GRANTED: A server calls us to tell that a process' lock request
256 * was granted
257 */
7111c66e 258static __be32
a6beb732 259__nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_res *resp)
1da177e4 260{
a6beb732
CH
261 struct nlm_args *argp = rqstp->rq_argp;
262
1da177e4
LT
263 resp->cookie = argp->cookie;
264
265 dprintk("lockd: GRANTED called\n");
dcff09f1 266 resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock);
1da177e4
LT
267 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
268 return rpc_success;
269}
270
a6beb732
CH
271static __be32
272nlm4svc_proc_granted(struct svc_rqst *rqstp)
273{
274 return __nlm4svc_proc_granted(rqstp, rqstp->rq_resp);
275}
276
d4716624
TM
277/*
278 * This is the generic lockd callback for async RPC calls
279 */
280static void nlm4svc_callback_exit(struct rpc_task *task, void *data)
281{
d4716624
TM
282}
283
284static void nlm4svc_callback_release(void *data)
285{
7db836d4 286 nlmsvc_release_call(data);
d4716624
TM
287}
288
289static const struct rpc_call_ops nlm4svc_callback_ops = {
290 .rpc_call_done = nlm4svc_callback_exit,
291 .rpc_release = nlm4svc_callback_release,
292};
293
1da177e4
LT
294/*
295 * `Async' versions of the above service routines. They aren't really,
296 * because we send the callback before the reply proper. I hope this
297 * doesn't break any clients.
298 */
a6beb732
CH
299static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc,
300 __be32 (*func)(struct svc_rqst *, struct nlm_res *))
1da177e4 301{
a6beb732 302 struct nlm_args *argp = rqstp->rq_argp;
d4716624
TM
303 struct nlm_host *host;
304 struct nlm_rqst *call;
7111c66e 305 __be32 stat;
1da177e4 306
db4e4c9a
OK
307 host = nlmsvc_lookup_host(rqstp,
308 argp->lock.caller,
309 argp->lock.len);
d4716624
TM
310 if (host == NULL)
311 return rpc_system_err;
312
313 call = nlm_alloc_call(host);
446945ab 314 nlmsvc_release_host(host);
d4716624
TM
315 if (call == NULL)
316 return rpc_system_err;
317
a6beb732 318 stat = func(rqstp, &call->a_res);
d4716624 319 if (stat != 0) {
7db836d4 320 nlmsvc_release_call(call);
d4716624
TM
321 return stat;
322 }
1da177e4 323
d4716624
TM
324 call->a_flags = RPC_TASK_ASYNC;
325 if (nlm_async_reply(call, proc, &nlm4svc_callback_ops) < 0)
326 return rpc_system_err;
327 return rpc_success;
1da177e4
LT
328}
329
a6beb732 330static __be32 nlm4svc_proc_test_msg(struct svc_rqst *rqstp)
1da177e4 331{
d4716624 332 dprintk("lockd: TEST_MSG called\n");
a6beb732 333 return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, __nlm4svc_proc_test);
d4716624 334}
1da177e4 335
a6beb732 336static __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp)
d4716624 337{
1da177e4 338 dprintk("lockd: LOCK_MSG called\n");
a6beb732 339 return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, __nlm4svc_proc_lock);
1da177e4
LT
340}
341
a6beb732 342static __be32 nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp)
1da177e4 343{
1da177e4 344 dprintk("lockd: CANCEL_MSG called\n");
a6beb732 345 return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, __nlm4svc_proc_cancel);
1da177e4
LT
346}
347
a6beb732 348static __be32 nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp)
1da177e4 349{
1da177e4 350 dprintk("lockd: UNLOCK_MSG called\n");
a6beb732 351 return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, __nlm4svc_proc_unlock);
1da177e4
LT
352}
353
a6beb732 354static __be32 nlm4svc_proc_granted_msg(struct svc_rqst *rqstp)
1da177e4 355{
1da177e4 356 dprintk("lockd: GRANTED_MSG called\n");
a6beb732 357 return nlm4svc_callback(rqstp, NLMPROC_GRANTED_RES, __nlm4svc_proc_granted);
1da177e4
LT
358}
359
360/*
361 * SHARE: create a DOS share or alter existing share.
362 */
7111c66e 363static __be32
a6beb732 364nlm4svc_proc_share(struct svc_rqst *rqstp)
1da177e4 365{
a6beb732
CH
366 struct nlm_args *argp = rqstp->rq_argp;
367 struct nlm_res *resp = rqstp->rq_resp;
1da177e4
LT
368 struct nlm_host *host;
369 struct nlm_file *file;
370
371 dprintk("lockd: SHARE called\n");
372
373 resp->cookie = argp->cookie;
374
375 /* Don't accept new lock requests during grace period */
5ccb0066 376 if (locks_in_grace(SVC_NET(rqstp)) && !argp->reclaim) {
1da177e4
LT
377 resp->status = nlm_lck_denied_grace_period;
378 return rpc_success;
379 }
380
381 /* Obtain client and file */
382 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
d343fce1 383 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
1da177e4
LT
384
385 /* Now try to create the share */
386 resp->status = nlmsvc_share_file(host, file, argp);
387
388 dprintk("lockd: SHARE status %d\n", ntohl(resp->status));
89e0edfb 389 nlmsvc_release_lockowner(&argp->lock);
67216b94 390 nlmsvc_release_host(host);
1da177e4
LT
391 nlm_release_file(file);
392 return rpc_success;
393}
394
395/*
396 * UNSHARE: Release a DOS share.
397 */
7111c66e 398static __be32
a6beb732 399nlm4svc_proc_unshare(struct svc_rqst *rqstp)
1da177e4 400{
a6beb732
CH
401 struct nlm_args *argp = rqstp->rq_argp;
402 struct nlm_res *resp = rqstp->rq_resp;
1da177e4
LT
403 struct nlm_host *host;
404 struct nlm_file *file;
405
406 dprintk("lockd: UNSHARE called\n");
407
408 resp->cookie = argp->cookie;
409
410 /* Don't accept requests during grace period */
5ccb0066 411 if (locks_in_grace(SVC_NET(rqstp))) {
1da177e4
LT
412 resp->status = nlm_lck_denied_grace_period;
413 return rpc_success;
414 }
415
416 /* Obtain client and file */
417 if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
d343fce1 418 return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
1da177e4
LT
419
420 /* Now try to lock the file */
421 resp->status = nlmsvc_unshare_file(host, file, argp);
422
423 dprintk("lockd: UNSHARE status %d\n", ntohl(resp->status));
89e0edfb 424 nlmsvc_release_lockowner(&argp->lock);
67216b94 425 nlmsvc_release_host(host);
1da177e4
LT
426 nlm_release_file(file);
427 return rpc_success;
428}
429
430/*
431 * NM_LOCK: Create an unmonitored lock
432 */
7111c66e 433static __be32
a6beb732 434nlm4svc_proc_nm_lock(struct svc_rqst *rqstp)
1da177e4 435{
a6beb732
CH
436 struct nlm_args *argp = rqstp->rq_argp;
437
1da177e4
LT
438 dprintk("lockd: NM_LOCK called\n");
439
440 argp->monitor = 0; /* just clean the monitor flag */
a6beb732 441 return nlm4svc_proc_lock(rqstp);
1da177e4
LT
442}
443
444/*
445 * FREE_ALL: Release all locks and shares held by client
446 */
7111c66e 447static __be32
a6beb732 448nlm4svc_proc_free_all(struct svc_rqst *rqstp)
1da177e4 449{
a6beb732 450 struct nlm_args *argp = rqstp->rq_argp;
1da177e4
LT
451 struct nlm_host *host;
452
453 /* Obtain client */
454 if (nlm4svc_retrieve_args(rqstp, argp, &host, NULL))
455 return rpc_success;
456
457 nlmsvc_free_host_resources(host);
67216b94 458 nlmsvc_release_host(host);
1da177e4
LT
459 return rpc_success;
460}
461
462/*
463 * SM_NOTIFY: private callback from statd (not part of official NLM proto)
464 */
7111c66e 465static __be32
a6beb732 466nlm4svc_proc_sm_notify(struct svc_rqst *rqstp)
1da177e4 467{
a6beb732
CH
468 struct nlm_reboot *argp = rqstp->rq_argp;
469
1da177e4 470 dprintk("lockd: SM_NOTIFY called\n");
b85e4676
CL
471
472 if (!nlm_privileged_requester(rqstp)) {
ad06e4bd
CL
473 char buf[RPC_MAX_ADDRBUFLEN];
474 printk(KERN_WARNING "lockd: rejected NSM callback from %s\n",
475 svc_print_addr(rqstp, buf, sizeof(buf)));
1da177e4
LT
476 return rpc_system_err;
477 }
478
0ad95472 479 nlm_host_rebooted(SVC_NET(rqstp), argp);
1da177e4
LT
480 return rpc_success;
481}
482
483/*
484 * client sent a GRANTED_RES, let's remove the associated block
485 */
7111c66e 486static __be32
a6beb732 487nlm4svc_proc_granted_res(struct svc_rqst *rqstp)
1da177e4 488{
a6beb732
CH
489 struct nlm_res *argp = rqstp->rq_argp;
490
1da177e4
LT
491 if (!nlmsvc_ops)
492 return rpc_success;
493
494 dprintk("lockd: GRANTED_RES called\n");
495
39be4502 496 nlmsvc_grant_reply(&argp->cookie, argp->status);
1da177e4
LT
497 return rpc_success;
498}
499
49d99608
CL
500static __be32
501nlm4svc_proc_unused(struct svc_rqst *rqstp)
502{
503 return rpc_proc_unavail;
504}
505
1da177e4 506
1da177e4
LT
507/*
508 * NLM Server procedures.
509 */
510
1da177e4
LT
511struct nlm_void { int dummy; };
512
1da177e4
LT
513#define Ck (1+XDR_QUADLEN(NLM_MAXCOOKIELEN)) /* cookie */
514#define No (1+1024/4) /* netobj */
515#define St 1 /* status */
516#define Rg 4 /* range (offset + length) */
1da177e4 517
49d99608
CL
518const struct svc_procedure nlmsvc_procedures4[24] = {
519 [NLMPROC_NULL] = {
520 .pc_func = nlm4svc_proc_null,
521 .pc_decode = nlm4svc_decode_void,
522 .pc_encode = nlm4svc_encode_void,
523 .pc_argsize = sizeof(struct nlm_void),
524 .pc_ressize = sizeof(struct nlm_void),
525 .pc_xdrressize = St,
2289e87b 526 .pc_name = "NULL",
49d99608
CL
527 },
528 [NLMPROC_TEST] = {
529 .pc_func = nlm4svc_proc_test,
530 .pc_decode = nlm4svc_decode_testargs,
531 .pc_encode = nlm4svc_encode_testres,
532 .pc_argsize = sizeof(struct nlm_args),
533 .pc_ressize = sizeof(struct nlm_res),
534 .pc_xdrressize = Ck+St+2+No+Rg,
2289e87b 535 .pc_name = "TEST",
49d99608
CL
536 },
537 [NLMPROC_LOCK] = {
538 .pc_func = nlm4svc_proc_lock,
539 .pc_decode = nlm4svc_decode_lockargs,
540 .pc_encode = nlm4svc_encode_res,
541 .pc_argsize = sizeof(struct nlm_args),
542 .pc_ressize = sizeof(struct nlm_res),
543 .pc_xdrressize = Ck+St,
2289e87b 544 .pc_name = "LOCK",
49d99608
CL
545 },
546 [NLMPROC_CANCEL] = {
547 .pc_func = nlm4svc_proc_cancel,
548 .pc_decode = nlm4svc_decode_cancargs,
549 .pc_encode = nlm4svc_encode_res,
550 .pc_argsize = sizeof(struct nlm_args),
551 .pc_ressize = sizeof(struct nlm_res),
552 .pc_xdrressize = Ck+St,
2289e87b 553 .pc_name = "CANCEL",
49d99608
CL
554 },
555 [NLMPROC_UNLOCK] = {
556 .pc_func = nlm4svc_proc_unlock,
557 .pc_decode = nlm4svc_decode_unlockargs,
558 .pc_encode = nlm4svc_encode_res,
559 .pc_argsize = sizeof(struct nlm_args),
560 .pc_ressize = sizeof(struct nlm_res),
561 .pc_xdrressize = Ck+St,
2289e87b 562 .pc_name = "UNLOCK",
49d99608
CL
563 },
564 [NLMPROC_GRANTED] = {
565 .pc_func = nlm4svc_proc_granted,
566 .pc_decode = nlm4svc_decode_testargs,
567 .pc_encode = nlm4svc_encode_res,
568 .pc_argsize = sizeof(struct nlm_args),
569 .pc_ressize = sizeof(struct nlm_res),
570 .pc_xdrressize = Ck+St,
2289e87b 571 .pc_name = "GRANTED",
49d99608
CL
572 },
573 [NLMPROC_TEST_MSG] = {
574 .pc_func = nlm4svc_proc_test_msg,
575 .pc_decode = nlm4svc_decode_testargs,
576 .pc_encode = nlm4svc_encode_void,
577 .pc_argsize = sizeof(struct nlm_args),
578 .pc_ressize = sizeof(struct nlm_void),
579 .pc_xdrressize = St,
2289e87b 580 .pc_name = "TEST_MSG",
49d99608
CL
581 },
582 [NLMPROC_LOCK_MSG] = {
583 .pc_func = nlm4svc_proc_lock_msg,
584 .pc_decode = nlm4svc_decode_lockargs,
585 .pc_encode = nlm4svc_encode_void,
586 .pc_argsize = sizeof(struct nlm_args),
587 .pc_ressize = sizeof(struct nlm_void),
588 .pc_xdrressize = St,
2289e87b 589 .pc_name = "LOCK_MSG",
49d99608
CL
590 },
591 [NLMPROC_CANCEL_MSG] = {
592 .pc_func = nlm4svc_proc_cancel_msg,
593 .pc_decode = nlm4svc_decode_cancargs,
594 .pc_encode = nlm4svc_encode_void,
595 .pc_argsize = sizeof(struct nlm_args),
596 .pc_ressize = sizeof(struct nlm_void),
597 .pc_xdrressize = St,
2289e87b 598 .pc_name = "CANCEL_MSG",
49d99608
CL
599 },
600 [NLMPROC_UNLOCK_MSG] = {
601 .pc_func = nlm4svc_proc_unlock_msg,
602 .pc_decode = nlm4svc_decode_unlockargs,
603 .pc_encode = nlm4svc_encode_void,
604 .pc_argsize = sizeof(struct nlm_args),
605 .pc_ressize = sizeof(struct nlm_void),
606 .pc_xdrressize = St,
2289e87b 607 .pc_name = "UNLOCK_MSG",
49d99608
CL
608 },
609 [NLMPROC_GRANTED_MSG] = {
610 .pc_func = nlm4svc_proc_granted_msg,
611 .pc_decode = nlm4svc_decode_testargs,
612 .pc_encode = nlm4svc_encode_void,
613 .pc_argsize = sizeof(struct nlm_args),
614 .pc_ressize = sizeof(struct nlm_void),
615 .pc_xdrressize = St,
2289e87b 616 .pc_name = "GRANTED_MSG",
49d99608
CL
617 },
618 [NLMPROC_TEST_RES] = {
619 .pc_func = nlm4svc_proc_null,
620 .pc_decode = nlm4svc_decode_void,
621 .pc_encode = nlm4svc_encode_void,
622 .pc_argsize = sizeof(struct nlm_res),
623 .pc_ressize = sizeof(struct nlm_void),
624 .pc_xdrressize = St,
2289e87b 625 .pc_name = "TEST_RES",
49d99608
CL
626 },
627 [NLMPROC_LOCK_RES] = {
628 .pc_func = nlm4svc_proc_null,
629 .pc_decode = nlm4svc_decode_void,
630 .pc_encode = nlm4svc_encode_void,
631 .pc_argsize = sizeof(struct nlm_res),
632 .pc_ressize = sizeof(struct nlm_void),
633 .pc_xdrressize = St,
2289e87b 634 .pc_name = "LOCK_RES",
49d99608
CL
635 },
636 [NLMPROC_CANCEL_RES] = {
637 .pc_func = nlm4svc_proc_null,
638 .pc_decode = nlm4svc_decode_void,
639 .pc_encode = nlm4svc_encode_void,
640 .pc_argsize = sizeof(struct nlm_res),
641 .pc_ressize = sizeof(struct nlm_void),
642 .pc_xdrressize = St,
2289e87b 643 .pc_name = "CANCEL_RES",
49d99608
CL
644 },
645 [NLMPROC_UNLOCK_RES] = {
646 .pc_func = nlm4svc_proc_null,
647 .pc_decode = nlm4svc_decode_void,
648 .pc_encode = nlm4svc_encode_void,
649 .pc_argsize = sizeof(struct nlm_res),
650 .pc_ressize = sizeof(struct nlm_void),
651 .pc_xdrressize = St,
2289e87b 652 .pc_name = "UNLOCK_RES",
49d99608
CL
653 },
654 [NLMPROC_GRANTED_RES] = {
655 .pc_func = nlm4svc_proc_granted_res,
656 .pc_decode = nlm4svc_decode_res,
657 .pc_encode = nlm4svc_encode_void,
658 .pc_argsize = sizeof(struct nlm_res),
659 .pc_ressize = sizeof(struct nlm_void),
660 .pc_xdrressize = St,
2289e87b 661 .pc_name = "GRANTED_RES",
49d99608
CL
662 },
663 [NLMPROC_NSM_NOTIFY] = {
664 .pc_func = nlm4svc_proc_sm_notify,
665 .pc_decode = nlm4svc_decode_reboot,
666 .pc_encode = nlm4svc_encode_void,
667 .pc_argsize = sizeof(struct nlm_reboot),
668 .pc_ressize = sizeof(struct nlm_void),
669 .pc_xdrressize = St,
2289e87b 670 .pc_name = "SM_NOTIFY",
49d99608
CL
671 },
672 [17] = {
673 .pc_func = nlm4svc_proc_unused,
674 .pc_decode = nlm4svc_decode_void,
675 .pc_encode = nlm4svc_encode_void,
676 .pc_argsize = sizeof(struct nlm_void),
677 .pc_ressize = sizeof(struct nlm_void),
678 .pc_xdrressize = 0,
2289e87b 679 .pc_name = "UNUSED",
49d99608
CL
680 },
681 [18] = {
682 .pc_func = nlm4svc_proc_unused,
683 .pc_decode = nlm4svc_decode_void,
684 .pc_encode = nlm4svc_encode_void,
685 .pc_argsize = sizeof(struct nlm_void),
686 .pc_ressize = sizeof(struct nlm_void),
687 .pc_xdrressize = 0,
2289e87b 688 .pc_name = "UNUSED",
49d99608
CL
689 },
690 [19] = {
691 .pc_func = nlm4svc_proc_unused,
692 .pc_decode = nlm4svc_decode_void,
693 .pc_encode = nlm4svc_encode_void,
694 .pc_argsize = sizeof(struct nlm_void),
695 .pc_ressize = sizeof(struct nlm_void),
696 .pc_xdrressize = 0,
2289e87b 697 .pc_name = "UNUSED",
49d99608
CL
698 },
699 [NLMPROC_SHARE] = {
700 .pc_func = nlm4svc_proc_share,
701 .pc_decode = nlm4svc_decode_shareargs,
702 .pc_encode = nlm4svc_encode_shareres,
703 .pc_argsize = sizeof(struct nlm_args),
704 .pc_ressize = sizeof(struct nlm_res),
705 .pc_xdrressize = Ck+St+1,
2289e87b 706 .pc_name = "SHARE",
49d99608
CL
707 },
708 [NLMPROC_UNSHARE] = {
709 .pc_func = nlm4svc_proc_unshare,
710 .pc_decode = nlm4svc_decode_shareargs,
711 .pc_encode = nlm4svc_encode_shareres,
712 .pc_argsize = sizeof(struct nlm_args),
713 .pc_ressize = sizeof(struct nlm_res),
714 .pc_xdrressize = Ck+St+1,
2289e87b 715 .pc_name = "UNSHARE",
49d99608
CL
716 },
717 [NLMPROC_NM_LOCK] = {
718 .pc_func = nlm4svc_proc_nm_lock,
719 .pc_decode = nlm4svc_decode_lockargs,
720 .pc_encode = nlm4svc_encode_res,
721 .pc_argsize = sizeof(struct nlm_args),
722 .pc_ressize = sizeof(struct nlm_res),
723 .pc_xdrressize = Ck+St,
2289e87b 724 .pc_name = "NM_LOCK",
49d99608
CL
725 },
726 [NLMPROC_FREE_ALL] = {
727 .pc_func = nlm4svc_proc_free_all,
728 .pc_decode = nlm4svc_decode_notify,
729 .pc_encode = nlm4svc_encode_void,
730 .pc_argsize = sizeof(struct nlm_args),
731 .pc_ressize = sizeof(struct nlm_void),
732 .pc_xdrressize = St,
2289e87b 733 .pc_name = "FREE_ALL",
49d99608 734 },
1da177e4 735};