18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * linux/fs/lockd/svc4proc.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Lockd server procedures. We don't implement the NLM_*_RES 68c2ecf20Sopenharmony_ci * procedures because we don't use the async procedures. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/types.h> 128c2ecf20Sopenharmony_ci#include <linux/time.h> 138c2ecf20Sopenharmony_ci#include <linux/lockd/lockd.h> 148c2ecf20Sopenharmony_ci#include <linux/lockd/share.h> 158c2ecf20Sopenharmony_ci#include <linux/sunrpc/svc_xprt.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define NLMDBG_FACILITY NLMDBG_CLIENT 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci/* 208c2ecf20Sopenharmony_ci * Obtain client and file from arguments 218c2ecf20Sopenharmony_ci */ 228c2ecf20Sopenharmony_cistatic __be32 238c2ecf20Sopenharmony_cinlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, 248c2ecf20Sopenharmony_ci struct nlm_host **hostp, struct nlm_file **filp) 258c2ecf20Sopenharmony_ci{ 268c2ecf20Sopenharmony_ci struct nlm_host *host = NULL; 278c2ecf20Sopenharmony_ci struct nlm_file *file = NULL; 288c2ecf20Sopenharmony_ci struct nlm_lock *lock = &argp->lock; 298c2ecf20Sopenharmony_ci __be32 error = 0; 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci /* nfsd callbacks must have been installed for this procedure */ 328c2ecf20Sopenharmony_ci if (!nlmsvc_ops) 338c2ecf20Sopenharmony_ci return nlm_lck_denied_nolocks; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci /* Obtain host handle */ 368c2ecf20Sopenharmony_ci if (!(host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len)) 378c2ecf20Sopenharmony_ci || (argp->monitor && nsm_monitor(host) < 0)) 388c2ecf20Sopenharmony_ci goto no_locks; 398c2ecf20Sopenharmony_ci *hostp = host; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci /* Obtain file pointer. Not used by FREE_ALL call. */ 428c2ecf20Sopenharmony_ci if (filp != NULL) { 438c2ecf20Sopenharmony_ci if ((error = nlm_lookup_file(rqstp, &file, &lock->fh)) != 0) 448c2ecf20Sopenharmony_ci goto no_locks; 458c2ecf20Sopenharmony_ci *filp = file; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci /* Set up the missing parts of the file_lock structure */ 488c2ecf20Sopenharmony_ci lock->fl.fl_file = file->f_file; 498c2ecf20Sopenharmony_ci lock->fl.fl_pid = current->tgid; 508c2ecf20Sopenharmony_ci lock->fl.fl_lmops = &nlmsvc_lock_operations; 518c2ecf20Sopenharmony_ci nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); 528c2ecf20Sopenharmony_ci if (!lock->fl.fl_owner) { 538c2ecf20Sopenharmony_ci /* lockowner allocation has failed */ 548c2ecf20Sopenharmony_ci nlmsvc_release_host(host); 558c2ecf20Sopenharmony_ci return nlm_lck_denied_nolocks; 568c2ecf20Sopenharmony_ci } 578c2ecf20Sopenharmony_ci } 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci return 0; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cino_locks: 628c2ecf20Sopenharmony_ci nlmsvc_release_host(host); 638c2ecf20Sopenharmony_ci if (error) 648c2ecf20Sopenharmony_ci return error; 658c2ecf20Sopenharmony_ci return nlm_lck_denied_nolocks; 668c2ecf20Sopenharmony_ci} 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci/* 698c2ecf20Sopenharmony_ci * NULL: Test for presence of service 708c2ecf20Sopenharmony_ci */ 718c2ecf20Sopenharmony_cistatic __be32 728c2ecf20Sopenharmony_cinlm4svc_proc_null(struct svc_rqst *rqstp) 738c2ecf20Sopenharmony_ci{ 748c2ecf20Sopenharmony_ci dprintk("lockd: NULL called\n"); 758c2ecf20Sopenharmony_ci return rpc_success; 768c2ecf20Sopenharmony_ci} 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci/* 798c2ecf20Sopenharmony_ci * TEST: Check for conflicting lock 808c2ecf20Sopenharmony_ci */ 818c2ecf20Sopenharmony_cistatic __be32 828c2ecf20Sopenharmony_ci__nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp) 838c2ecf20Sopenharmony_ci{ 848c2ecf20Sopenharmony_ci struct nlm_args *argp = rqstp->rq_argp; 858c2ecf20Sopenharmony_ci struct nlm_host *host; 868c2ecf20Sopenharmony_ci struct nlm_file *file; 878c2ecf20Sopenharmony_ci __be32 rc = rpc_success; 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci dprintk("lockd: TEST4 called\n"); 908c2ecf20Sopenharmony_ci resp->cookie = argp->cookie; 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci /* Obtain client and file */ 938c2ecf20Sopenharmony_ci if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 948c2ecf20Sopenharmony_ci return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci /* Now check for conflicting locks */ 978c2ecf20Sopenharmony_ci resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie); 988c2ecf20Sopenharmony_ci if (resp->status == nlm_drop_reply) 998c2ecf20Sopenharmony_ci rc = rpc_drop_reply; 1008c2ecf20Sopenharmony_ci else 1018c2ecf20Sopenharmony_ci dprintk("lockd: TEST4 status %d\n", ntohl(resp->status)); 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci nlmsvc_release_lockowner(&argp->lock); 1048c2ecf20Sopenharmony_ci nlmsvc_release_host(host); 1058c2ecf20Sopenharmony_ci nlm_release_file(file); 1068c2ecf20Sopenharmony_ci return rc; 1078c2ecf20Sopenharmony_ci} 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_cistatic __be32 1108c2ecf20Sopenharmony_cinlm4svc_proc_test(struct svc_rqst *rqstp) 1118c2ecf20Sopenharmony_ci{ 1128c2ecf20Sopenharmony_ci return __nlm4svc_proc_test(rqstp, rqstp->rq_resp); 1138c2ecf20Sopenharmony_ci} 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_cistatic __be32 1168c2ecf20Sopenharmony_ci__nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp) 1178c2ecf20Sopenharmony_ci{ 1188c2ecf20Sopenharmony_ci struct nlm_args *argp = rqstp->rq_argp; 1198c2ecf20Sopenharmony_ci struct nlm_host *host; 1208c2ecf20Sopenharmony_ci struct nlm_file *file; 1218c2ecf20Sopenharmony_ci __be32 rc = rpc_success; 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci dprintk("lockd: LOCK called\n"); 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci resp->cookie = argp->cookie; 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci /* Obtain client and file */ 1288c2ecf20Sopenharmony_ci if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 1298c2ecf20Sopenharmony_ci return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci#if 0 1328c2ecf20Sopenharmony_ci /* If supplied state doesn't match current state, we assume it's 1338c2ecf20Sopenharmony_ci * an old request that time-warped somehow. Any error return would 1348c2ecf20Sopenharmony_ci * do in this case because it's irrelevant anyway. 1358c2ecf20Sopenharmony_ci * 1368c2ecf20Sopenharmony_ci * NB: We don't retrieve the remote host's state yet. 1378c2ecf20Sopenharmony_ci */ 1388c2ecf20Sopenharmony_ci if (host->h_nsmstate && host->h_nsmstate != argp->state) { 1398c2ecf20Sopenharmony_ci resp->status = nlm_lck_denied_nolocks; 1408c2ecf20Sopenharmony_ci } else 1418c2ecf20Sopenharmony_ci#endif 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci /* Now try to lock the file */ 1448c2ecf20Sopenharmony_ci resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock, 1458c2ecf20Sopenharmony_ci argp->block, &argp->cookie, 1468c2ecf20Sopenharmony_ci argp->reclaim); 1478c2ecf20Sopenharmony_ci if (resp->status == nlm_drop_reply) 1488c2ecf20Sopenharmony_ci rc = rpc_drop_reply; 1498c2ecf20Sopenharmony_ci else 1508c2ecf20Sopenharmony_ci dprintk("lockd: LOCK status %d\n", ntohl(resp->status)); 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci nlmsvc_release_lockowner(&argp->lock); 1538c2ecf20Sopenharmony_ci nlmsvc_release_host(host); 1548c2ecf20Sopenharmony_ci nlm_release_file(file); 1558c2ecf20Sopenharmony_ci return rc; 1568c2ecf20Sopenharmony_ci} 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_cistatic __be32 1598c2ecf20Sopenharmony_cinlm4svc_proc_lock(struct svc_rqst *rqstp) 1608c2ecf20Sopenharmony_ci{ 1618c2ecf20Sopenharmony_ci return __nlm4svc_proc_lock(rqstp, rqstp->rq_resp); 1628c2ecf20Sopenharmony_ci} 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_cistatic __be32 1658c2ecf20Sopenharmony_ci__nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp) 1668c2ecf20Sopenharmony_ci{ 1678c2ecf20Sopenharmony_ci struct nlm_args *argp = rqstp->rq_argp; 1688c2ecf20Sopenharmony_ci struct nlm_host *host; 1698c2ecf20Sopenharmony_ci struct nlm_file *file; 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci dprintk("lockd: CANCEL called\n"); 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci resp->cookie = argp->cookie; 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci /* Don't accept requests during grace period */ 1768c2ecf20Sopenharmony_ci if (locks_in_grace(SVC_NET(rqstp))) { 1778c2ecf20Sopenharmony_ci resp->status = nlm_lck_denied_grace_period; 1788c2ecf20Sopenharmony_ci return rpc_success; 1798c2ecf20Sopenharmony_ci } 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci /* Obtain client and file */ 1828c2ecf20Sopenharmony_ci if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 1838c2ecf20Sopenharmony_ci return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci /* Try to cancel request. */ 1868c2ecf20Sopenharmony_ci resp->status = nlmsvc_cancel_blocked(SVC_NET(rqstp), file, &argp->lock); 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci dprintk("lockd: CANCEL status %d\n", ntohl(resp->status)); 1898c2ecf20Sopenharmony_ci nlmsvc_release_lockowner(&argp->lock); 1908c2ecf20Sopenharmony_ci nlmsvc_release_host(host); 1918c2ecf20Sopenharmony_ci nlm_release_file(file); 1928c2ecf20Sopenharmony_ci return rpc_success; 1938c2ecf20Sopenharmony_ci} 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_cistatic __be32 1968c2ecf20Sopenharmony_cinlm4svc_proc_cancel(struct svc_rqst *rqstp) 1978c2ecf20Sopenharmony_ci{ 1988c2ecf20Sopenharmony_ci return __nlm4svc_proc_cancel(rqstp, rqstp->rq_resp); 1998c2ecf20Sopenharmony_ci} 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci/* 2028c2ecf20Sopenharmony_ci * UNLOCK: release a lock 2038c2ecf20Sopenharmony_ci */ 2048c2ecf20Sopenharmony_cistatic __be32 2058c2ecf20Sopenharmony_ci__nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp) 2068c2ecf20Sopenharmony_ci{ 2078c2ecf20Sopenharmony_ci struct nlm_args *argp = rqstp->rq_argp; 2088c2ecf20Sopenharmony_ci struct nlm_host *host; 2098c2ecf20Sopenharmony_ci struct nlm_file *file; 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci dprintk("lockd: UNLOCK called\n"); 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci resp->cookie = argp->cookie; 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci /* Don't accept new lock requests during grace period */ 2168c2ecf20Sopenharmony_ci if (locks_in_grace(SVC_NET(rqstp))) { 2178c2ecf20Sopenharmony_ci resp->status = nlm_lck_denied_grace_period; 2188c2ecf20Sopenharmony_ci return rpc_success; 2198c2ecf20Sopenharmony_ci } 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci /* Obtain client and file */ 2228c2ecf20Sopenharmony_ci if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 2238c2ecf20Sopenharmony_ci return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci /* Now try to remove the lock */ 2268c2ecf20Sopenharmony_ci resp->status = nlmsvc_unlock(SVC_NET(rqstp), file, &argp->lock); 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci dprintk("lockd: UNLOCK status %d\n", ntohl(resp->status)); 2298c2ecf20Sopenharmony_ci nlmsvc_release_lockowner(&argp->lock); 2308c2ecf20Sopenharmony_ci nlmsvc_release_host(host); 2318c2ecf20Sopenharmony_ci nlm_release_file(file); 2328c2ecf20Sopenharmony_ci return rpc_success; 2338c2ecf20Sopenharmony_ci} 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_cistatic __be32 2368c2ecf20Sopenharmony_cinlm4svc_proc_unlock(struct svc_rqst *rqstp) 2378c2ecf20Sopenharmony_ci{ 2388c2ecf20Sopenharmony_ci return __nlm4svc_proc_unlock(rqstp, rqstp->rq_resp); 2398c2ecf20Sopenharmony_ci} 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ci/* 2428c2ecf20Sopenharmony_ci * GRANTED: A server calls us to tell that a process' lock request 2438c2ecf20Sopenharmony_ci * was granted 2448c2ecf20Sopenharmony_ci */ 2458c2ecf20Sopenharmony_cistatic __be32 2468c2ecf20Sopenharmony_ci__nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_res *resp) 2478c2ecf20Sopenharmony_ci{ 2488c2ecf20Sopenharmony_ci struct nlm_args *argp = rqstp->rq_argp; 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci resp->cookie = argp->cookie; 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci dprintk("lockd: GRANTED called\n"); 2538c2ecf20Sopenharmony_ci resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock); 2548c2ecf20Sopenharmony_ci dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); 2558c2ecf20Sopenharmony_ci return rpc_success; 2568c2ecf20Sopenharmony_ci} 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_cistatic __be32 2598c2ecf20Sopenharmony_cinlm4svc_proc_granted(struct svc_rqst *rqstp) 2608c2ecf20Sopenharmony_ci{ 2618c2ecf20Sopenharmony_ci return __nlm4svc_proc_granted(rqstp, rqstp->rq_resp); 2628c2ecf20Sopenharmony_ci} 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci/* 2658c2ecf20Sopenharmony_ci * This is the generic lockd callback for async RPC calls 2668c2ecf20Sopenharmony_ci */ 2678c2ecf20Sopenharmony_cistatic void nlm4svc_callback_exit(struct rpc_task *task, void *data) 2688c2ecf20Sopenharmony_ci{ 2698c2ecf20Sopenharmony_ci dprintk("lockd: %5u callback returned %d\n", task->tk_pid, 2708c2ecf20Sopenharmony_ci -task->tk_status); 2718c2ecf20Sopenharmony_ci} 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_cistatic void nlm4svc_callback_release(void *data) 2748c2ecf20Sopenharmony_ci{ 2758c2ecf20Sopenharmony_ci nlmsvc_release_call(data); 2768c2ecf20Sopenharmony_ci} 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_cistatic const struct rpc_call_ops nlm4svc_callback_ops = { 2798c2ecf20Sopenharmony_ci .rpc_call_done = nlm4svc_callback_exit, 2808c2ecf20Sopenharmony_ci .rpc_release = nlm4svc_callback_release, 2818c2ecf20Sopenharmony_ci}; 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci/* 2848c2ecf20Sopenharmony_ci * `Async' versions of the above service routines. They aren't really, 2858c2ecf20Sopenharmony_ci * because we send the callback before the reply proper. I hope this 2868c2ecf20Sopenharmony_ci * doesn't break any clients. 2878c2ecf20Sopenharmony_ci */ 2888c2ecf20Sopenharmony_cistatic __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc, 2898c2ecf20Sopenharmony_ci __be32 (*func)(struct svc_rqst *, struct nlm_res *)) 2908c2ecf20Sopenharmony_ci{ 2918c2ecf20Sopenharmony_ci struct nlm_args *argp = rqstp->rq_argp; 2928c2ecf20Sopenharmony_ci struct nlm_host *host; 2938c2ecf20Sopenharmony_ci struct nlm_rqst *call; 2948c2ecf20Sopenharmony_ci __be32 stat; 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci host = nlmsvc_lookup_host(rqstp, 2978c2ecf20Sopenharmony_ci argp->lock.caller, 2988c2ecf20Sopenharmony_ci argp->lock.len); 2998c2ecf20Sopenharmony_ci if (host == NULL) 3008c2ecf20Sopenharmony_ci return rpc_system_err; 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_ci call = nlm_alloc_call(host); 3038c2ecf20Sopenharmony_ci nlmsvc_release_host(host); 3048c2ecf20Sopenharmony_ci if (call == NULL) 3058c2ecf20Sopenharmony_ci return rpc_system_err; 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci stat = func(rqstp, &call->a_res); 3088c2ecf20Sopenharmony_ci if (stat != 0) { 3098c2ecf20Sopenharmony_ci nlmsvc_release_call(call); 3108c2ecf20Sopenharmony_ci return stat; 3118c2ecf20Sopenharmony_ci } 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci call->a_flags = RPC_TASK_ASYNC; 3148c2ecf20Sopenharmony_ci if (nlm_async_reply(call, proc, &nlm4svc_callback_ops) < 0) 3158c2ecf20Sopenharmony_ci return rpc_system_err; 3168c2ecf20Sopenharmony_ci return rpc_success; 3178c2ecf20Sopenharmony_ci} 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_cistatic __be32 nlm4svc_proc_test_msg(struct svc_rqst *rqstp) 3208c2ecf20Sopenharmony_ci{ 3218c2ecf20Sopenharmony_ci dprintk("lockd: TEST_MSG called\n"); 3228c2ecf20Sopenharmony_ci return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, __nlm4svc_proc_test); 3238c2ecf20Sopenharmony_ci} 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_cistatic __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp) 3268c2ecf20Sopenharmony_ci{ 3278c2ecf20Sopenharmony_ci dprintk("lockd: LOCK_MSG called\n"); 3288c2ecf20Sopenharmony_ci return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, __nlm4svc_proc_lock); 3298c2ecf20Sopenharmony_ci} 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_cistatic __be32 nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp) 3328c2ecf20Sopenharmony_ci{ 3338c2ecf20Sopenharmony_ci dprintk("lockd: CANCEL_MSG called\n"); 3348c2ecf20Sopenharmony_ci return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, __nlm4svc_proc_cancel); 3358c2ecf20Sopenharmony_ci} 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_cistatic __be32 nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp) 3388c2ecf20Sopenharmony_ci{ 3398c2ecf20Sopenharmony_ci dprintk("lockd: UNLOCK_MSG called\n"); 3408c2ecf20Sopenharmony_ci return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, __nlm4svc_proc_unlock); 3418c2ecf20Sopenharmony_ci} 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_cistatic __be32 nlm4svc_proc_granted_msg(struct svc_rqst *rqstp) 3448c2ecf20Sopenharmony_ci{ 3458c2ecf20Sopenharmony_ci dprintk("lockd: GRANTED_MSG called\n"); 3468c2ecf20Sopenharmony_ci return nlm4svc_callback(rqstp, NLMPROC_GRANTED_RES, __nlm4svc_proc_granted); 3478c2ecf20Sopenharmony_ci} 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci/* 3508c2ecf20Sopenharmony_ci * SHARE: create a DOS share or alter existing share. 3518c2ecf20Sopenharmony_ci */ 3528c2ecf20Sopenharmony_cistatic __be32 3538c2ecf20Sopenharmony_cinlm4svc_proc_share(struct svc_rqst *rqstp) 3548c2ecf20Sopenharmony_ci{ 3558c2ecf20Sopenharmony_ci struct nlm_args *argp = rqstp->rq_argp; 3568c2ecf20Sopenharmony_ci struct nlm_res *resp = rqstp->rq_resp; 3578c2ecf20Sopenharmony_ci struct nlm_host *host; 3588c2ecf20Sopenharmony_ci struct nlm_file *file; 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_ci dprintk("lockd: SHARE called\n"); 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci resp->cookie = argp->cookie; 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_ci /* Don't accept new lock requests during grace period */ 3658c2ecf20Sopenharmony_ci if (locks_in_grace(SVC_NET(rqstp)) && !argp->reclaim) { 3668c2ecf20Sopenharmony_ci resp->status = nlm_lck_denied_grace_period; 3678c2ecf20Sopenharmony_ci return rpc_success; 3688c2ecf20Sopenharmony_ci } 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_ci /* Obtain client and file */ 3718c2ecf20Sopenharmony_ci if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 3728c2ecf20Sopenharmony_ci return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ci /* Now try to create the share */ 3758c2ecf20Sopenharmony_ci resp->status = nlmsvc_share_file(host, file, argp); 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci dprintk("lockd: SHARE status %d\n", ntohl(resp->status)); 3788c2ecf20Sopenharmony_ci nlmsvc_release_lockowner(&argp->lock); 3798c2ecf20Sopenharmony_ci nlmsvc_release_host(host); 3808c2ecf20Sopenharmony_ci nlm_release_file(file); 3818c2ecf20Sopenharmony_ci return rpc_success; 3828c2ecf20Sopenharmony_ci} 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci/* 3858c2ecf20Sopenharmony_ci * UNSHARE: Release a DOS share. 3868c2ecf20Sopenharmony_ci */ 3878c2ecf20Sopenharmony_cistatic __be32 3888c2ecf20Sopenharmony_cinlm4svc_proc_unshare(struct svc_rqst *rqstp) 3898c2ecf20Sopenharmony_ci{ 3908c2ecf20Sopenharmony_ci struct nlm_args *argp = rqstp->rq_argp; 3918c2ecf20Sopenharmony_ci struct nlm_res *resp = rqstp->rq_resp; 3928c2ecf20Sopenharmony_ci struct nlm_host *host; 3938c2ecf20Sopenharmony_ci struct nlm_file *file; 3948c2ecf20Sopenharmony_ci 3958c2ecf20Sopenharmony_ci dprintk("lockd: UNSHARE called\n"); 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_ci resp->cookie = argp->cookie; 3988c2ecf20Sopenharmony_ci 3998c2ecf20Sopenharmony_ci /* Don't accept requests during grace period */ 4008c2ecf20Sopenharmony_ci if (locks_in_grace(SVC_NET(rqstp))) { 4018c2ecf20Sopenharmony_ci resp->status = nlm_lck_denied_grace_period; 4028c2ecf20Sopenharmony_ci return rpc_success; 4038c2ecf20Sopenharmony_ci } 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ci /* Obtain client and file */ 4068c2ecf20Sopenharmony_ci if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) 4078c2ecf20Sopenharmony_ci return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_ci /* Now try to lock the file */ 4108c2ecf20Sopenharmony_ci resp->status = nlmsvc_unshare_file(host, file, argp); 4118c2ecf20Sopenharmony_ci 4128c2ecf20Sopenharmony_ci dprintk("lockd: UNSHARE status %d\n", ntohl(resp->status)); 4138c2ecf20Sopenharmony_ci nlmsvc_release_lockowner(&argp->lock); 4148c2ecf20Sopenharmony_ci nlmsvc_release_host(host); 4158c2ecf20Sopenharmony_ci nlm_release_file(file); 4168c2ecf20Sopenharmony_ci return rpc_success; 4178c2ecf20Sopenharmony_ci} 4188c2ecf20Sopenharmony_ci 4198c2ecf20Sopenharmony_ci/* 4208c2ecf20Sopenharmony_ci * NM_LOCK: Create an unmonitored lock 4218c2ecf20Sopenharmony_ci */ 4228c2ecf20Sopenharmony_cistatic __be32 4238c2ecf20Sopenharmony_cinlm4svc_proc_nm_lock(struct svc_rqst *rqstp) 4248c2ecf20Sopenharmony_ci{ 4258c2ecf20Sopenharmony_ci struct nlm_args *argp = rqstp->rq_argp; 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_ci dprintk("lockd: NM_LOCK called\n"); 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_ci argp->monitor = 0; /* just clean the monitor flag */ 4308c2ecf20Sopenharmony_ci return nlm4svc_proc_lock(rqstp); 4318c2ecf20Sopenharmony_ci} 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_ci/* 4348c2ecf20Sopenharmony_ci * FREE_ALL: Release all locks and shares held by client 4358c2ecf20Sopenharmony_ci */ 4368c2ecf20Sopenharmony_cistatic __be32 4378c2ecf20Sopenharmony_cinlm4svc_proc_free_all(struct svc_rqst *rqstp) 4388c2ecf20Sopenharmony_ci{ 4398c2ecf20Sopenharmony_ci struct nlm_args *argp = rqstp->rq_argp; 4408c2ecf20Sopenharmony_ci struct nlm_host *host; 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_ci /* Obtain client */ 4438c2ecf20Sopenharmony_ci if (nlm4svc_retrieve_args(rqstp, argp, &host, NULL)) 4448c2ecf20Sopenharmony_ci return rpc_success; 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_ci nlmsvc_free_host_resources(host); 4478c2ecf20Sopenharmony_ci nlmsvc_release_host(host); 4488c2ecf20Sopenharmony_ci return rpc_success; 4498c2ecf20Sopenharmony_ci} 4508c2ecf20Sopenharmony_ci 4518c2ecf20Sopenharmony_ci/* 4528c2ecf20Sopenharmony_ci * SM_NOTIFY: private callback from statd (not part of official NLM proto) 4538c2ecf20Sopenharmony_ci */ 4548c2ecf20Sopenharmony_cistatic __be32 4558c2ecf20Sopenharmony_cinlm4svc_proc_sm_notify(struct svc_rqst *rqstp) 4568c2ecf20Sopenharmony_ci{ 4578c2ecf20Sopenharmony_ci struct nlm_reboot *argp = rqstp->rq_argp; 4588c2ecf20Sopenharmony_ci 4598c2ecf20Sopenharmony_ci dprintk("lockd: SM_NOTIFY called\n"); 4608c2ecf20Sopenharmony_ci 4618c2ecf20Sopenharmony_ci if (!nlm_privileged_requester(rqstp)) { 4628c2ecf20Sopenharmony_ci char buf[RPC_MAX_ADDRBUFLEN]; 4638c2ecf20Sopenharmony_ci printk(KERN_WARNING "lockd: rejected NSM callback from %s\n", 4648c2ecf20Sopenharmony_ci svc_print_addr(rqstp, buf, sizeof(buf))); 4658c2ecf20Sopenharmony_ci return rpc_system_err; 4668c2ecf20Sopenharmony_ci } 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_ci nlm_host_rebooted(SVC_NET(rqstp), argp); 4698c2ecf20Sopenharmony_ci return rpc_success; 4708c2ecf20Sopenharmony_ci} 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ci/* 4738c2ecf20Sopenharmony_ci * client sent a GRANTED_RES, let's remove the associated block 4748c2ecf20Sopenharmony_ci */ 4758c2ecf20Sopenharmony_cistatic __be32 4768c2ecf20Sopenharmony_cinlm4svc_proc_granted_res(struct svc_rqst *rqstp) 4778c2ecf20Sopenharmony_ci{ 4788c2ecf20Sopenharmony_ci struct nlm_res *argp = rqstp->rq_argp; 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_ci if (!nlmsvc_ops) 4818c2ecf20Sopenharmony_ci return rpc_success; 4828c2ecf20Sopenharmony_ci 4838c2ecf20Sopenharmony_ci dprintk("lockd: GRANTED_RES called\n"); 4848c2ecf20Sopenharmony_ci 4858c2ecf20Sopenharmony_ci nlmsvc_grant_reply(&argp->cookie, argp->status); 4868c2ecf20Sopenharmony_ci return rpc_success; 4878c2ecf20Sopenharmony_ci} 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_cistatic __be32 4908c2ecf20Sopenharmony_cinlm4svc_proc_unused(struct svc_rqst *rqstp) 4918c2ecf20Sopenharmony_ci{ 4928c2ecf20Sopenharmony_ci return rpc_proc_unavail; 4938c2ecf20Sopenharmony_ci} 4948c2ecf20Sopenharmony_ci 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_ci/* 4978c2ecf20Sopenharmony_ci * NLM Server procedures. 4988c2ecf20Sopenharmony_ci */ 4998c2ecf20Sopenharmony_ci 5008c2ecf20Sopenharmony_cistruct nlm_void { int dummy; }; 5018c2ecf20Sopenharmony_ci 5028c2ecf20Sopenharmony_ci#define Ck (1+XDR_QUADLEN(NLM_MAXCOOKIELEN)) /* cookie */ 5038c2ecf20Sopenharmony_ci#define No (1+1024/4) /* netobj */ 5048c2ecf20Sopenharmony_ci#define St 1 /* status */ 5058c2ecf20Sopenharmony_ci#define Rg 4 /* range (offset + length) */ 5068c2ecf20Sopenharmony_ci 5078c2ecf20Sopenharmony_ciconst struct svc_procedure nlmsvc_procedures4[24] = { 5088c2ecf20Sopenharmony_ci [NLMPROC_NULL] = { 5098c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_null, 5108c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_void, 5118c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 5128c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_void), 5138c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 5148c2ecf20Sopenharmony_ci .pc_xdrressize = St, 5158c2ecf20Sopenharmony_ci }, 5168c2ecf20Sopenharmony_ci [NLMPROC_TEST] = { 5178c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_test, 5188c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_testargs, 5198c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_testres, 5208c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 5218c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_res), 5228c2ecf20Sopenharmony_ci .pc_xdrressize = Ck+St+2+No+Rg, 5238c2ecf20Sopenharmony_ci }, 5248c2ecf20Sopenharmony_ci [NLMPROC_LOCK] = { 5258c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_lock, 5268c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_lockargs, 5278c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_res, 5288c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 5298c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_res), 5308c2ecf20Sopenharmony_ci .pc_xdrressize = Ck+St, 5318c2ecf20Sopenharmony_ci }, 5328c2ecf20Sopenharmony_ci [NLMPROC_CANCEL] = { 5338c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_cancel, 5348c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_cancargs, 5358c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_res, 5368c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 5378c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_res), 5388c2ecf20Sopenharmony_ci .pc_xdrressize = Ck+St, 5398c2ecf20Sopenharmony_ci }, 5408c2ecf20Sopenharmony_ci [NLMPROC_UNLOCK] = { 5418c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_unlock, 5428c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_unlockargs, 5438c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_res, 5448c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 5458c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_res), 5468c2ecf20Sopenharmony_ci .pc_xdrressize = Ck+St, 5478c2ecf20Sopenharmony_ci }, 5488c2ecf20Sopenharmony_ci [NLMPROC_GRANTED] = { 5498c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_granted, 5508c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_testargs, 5518c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_res, 5528c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 5538c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_res), 5548c2ecf20Sopenharmony_ci .pc_xdrressize = Ck+St, 5558c2ecf20Sopenharmony_ci }, 5568c2ecf20Sopenharmony_ci [NLMPROC_TEST_MSG] = { 5578c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_test_msg, 5588c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_testargs, 5598c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 5608c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 5618c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 5628c2ecf20Sopenharmony_ci .pc_xdrressize = St, 5638c2ecf20Sopenharmony_ci }, 5648c2ecf20Sopenharmony_ci [NLMPROC_LOCK_MSG] = { 5658c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_lock_msg, 5668c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_lockargs, 5678c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 5688c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 5698c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 5708c2ecf20Sopenharmony_ci .pc_xdrressize = St, 5718c2ecf20Sopenharmony_ci }, 5728c2ecf20Sopenharmony_ci [NLMPROC_CANCEL_MSG] = { 5738c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_cancel_msg, 5748c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_cancargs, 5758c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 5768c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 5778c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 5788c2ecf20Sopenharmony_ci .pc_xdrressize = St, 5798c2ecf20Sopenharmony_ci }, 5808c2ecf20Sopenharmony_ci [NLMPROC_UNLOCK_MSG] = { 5818c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_unlock_msg, 5828c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_unlockargs, 5838c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 5848c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 5858c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 5868c2ecf20Sopenharmony_ci .pc_xdrressize = St, 5878c2ecf20Sopenharmony_ci }, 5888c2ecf20Sopenharmony_ci [NLMPROC_GRANTED_MSG] = { 5898c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_granted_msg, 5908c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_testargs, 5918c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 5928c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 5938c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 5948c2ecf20Sopenharmony_ci .pc_xdrressize = St, 5958c2ecf20Sopenharmony_ci }, 5968c2ecf20Sopenharmony_ci [NLMPROC_TEST_RES] = { 5978c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_null, 5988c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_void, 5998c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 6008c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_res), 6018c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 6028c2ecf20Sopenharmony_ci .pc_xdrressize = St, 6038c2ecf20Sopenharmony_ci }, 6048c2ecf20Sopenharmony_ci [NLMPROC_LOCK_RES] = { 6058c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_null, 6068c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_void, 6078c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 6088c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_res), 6098c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 6108c2ecf20Sopenharmony_ci .pc_xdrressize = St, 6118c2ecf20Sopenharmony_ci }, 6128c2ecf20Sopenharmony_ci [NLMPROC_CANCEL_RES] = { 6138c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_null, 6148c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_void, 6158c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 6168c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_res), 6178c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 6188c2ecf20Sopenharmony_ci .pc_xdrressize = St, 6198c2ecf20Sopenharmony_ci }, 6208c2ecf20Sopenharmony_ci [NLMPROC_UNLOCK_RES] = { 6218c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_null, 6228c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_void, 6238c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 6248c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_res), 6258c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 6268c2ecf20Sopenharmony_ci .pc_xdrressize = St, 6278c2ecf20Sopenharmony_ci }, 6288c2ecf20Sopenharmony_ci [NLMPROC_GRANTED_RES] = { 6298c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_granted_res, 6308c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_res, 6318c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 6328c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_res), 6338c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 6348c2ecf20Sopenharmony_ci .pc_xdrressize = St, 6358c2ecf20Sopenharmony_ci }, 6368c2ecf20Sopenharmony_ci [NLMPROC_NSM_NOTIFY] = { 6378c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_sm_notify, 6388c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_reboot, 6398c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 6408c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_reboot), 6418c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 6428c2ecf20Sopenharmony_ci .pc_xdrressize = St, 6438c2ecf20Sopenharmony_ci }, 6448c2ecf20Sopenharmony_ci [17] = { 6458c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_unused, 6468c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_void, 6478c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 6488c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_void), 6498c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 6508c2ecf20Sopenharmony_ci .pc_xdrressize = 0, 6518c2ecf20Sopenharmony_ci }, 6528c2ecf20Sopenharmony_ci [18] = { 6538c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_unused, 6548c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_void, 6558c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 6568c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_void), 6578c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 6588c2ecf20Sopenharmony_ci .pc_xdrressize = 0, 6598c2ecf20Sopenharmony_ci }, 6608c2ecf20Sopenharmony_ci [19] = { 6618c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_unused, 6628c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_void, 6638c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 6648c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_void), 6658c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 6668c2ecf20Sopenharmony_ci .pc_xdrressize = 0, 6678c2ecf20Sopenharmony_ci }, 6688c2ecf20Sopenharmony_ci [NLMPROC_SHARE] = { 6698c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_share, 6708c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_shareargs, 6718c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_shareres, 6728c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 6738c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_res), 6748c2ecf20Sopenharmony_ci .pc_xdrressize = Ck+St+1, 6758c2ecf20Sopenharmony_ci }, 6768c2ecf20Sopenharmony_ci [NLMPROC_UNSHARE] = { 6778c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_unshare, 6788c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_shareargs, 6798c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_shareres, 6808c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 6818c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_res), 6828c2ecf20Sopenharmony_ci .pc_xdrressize = Ck+St+1, 6838c2ecf20Sopenharmony_ci }, 6848c2ecf20Sopenharmony_ci [NLMPROC_NM_LOCK] = { 6858c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_nm_lock, 6868c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_lockargs, 6878c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_res, 6888c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 6898c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_res), 6908c2ecf20Sopenharmony_ci .pc_xdrressize = Ck+St, 6918c2ecf20Sopenharmony_ci }, 6928c2ecf20Sopenharmony_ci [NLMPROC_FREE_ALL] = { 6938c2ecf20Sopenharmony_ci .pc_func = nlm4svc_proc_free_all, 6948c2ecf20Sopenharmony_ci .pc_decode = nlm4svc_decode_notify, 6958c2ecf20Sopenharmony_ci .pc_encode = nlm4svc_encode_void, 6968c2ecf20Sopenharmony_ci .pc_argsize = sizeof(struct nlm_args), 6978c2ecf20Sopenharmony_ci .pc_ressize = sizeof(struct nlm_void), 6988c2ecf20Sopenharmony_ci .pc_xdrressize = St, 6998c2ecf20Sopenharmony_ci }, 7008c2ecf20Sopenharmony_ci}; 701