10 #include <linux/types.h>
11 #include <linux/time.h>
16 #define NLMDBG_FACILITY NLMDBG_CLIENT
23 struct nlm_host **hostp,
struct nlm_file **filp)
47 lock->
fl.fl_file = file->f_file;
67 dprintk(
"lockd: NULL called\n");
78 struct nlm_host *
host;
79 struct nlm_file *
file;
82 dprintk(
"lockd: TEST4 called\n");
86 if ((resp->
status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
105 struct nlm_host *host;
106 struct nlm_file *
file;
109 dprintk(
"lockd: LOCK called\n");
114 if ((resp->
status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
124 if (host->h_nsmstate && host->h_nsmstate != argp->
state) {
147 struct nlm_host *host;
148 struct nlm_file *
file;
150 dprintk(
"lockd: CANCEL called\n");
161 if ((resp->
status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
180 struct nlm_host *host;
181 struct nlm_file *
file;
183 dprintk(
"lockd: UNLOCK called\n");
194 if ((resp->
status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
216 dprintk(
"lockd: GRANTED called\n");
227 dprintk(
"lockd: %5u callback returned %d\n", task->tk_pid,
231 static void nlm4svc_callback_release(
void *
data)
236 static const struct rpc_call_ops nlm4svc_callback_ops = {
237 .rpc_call_done = nlm4svc_callback_exit,
238 .rpc_release = nlm4svc_callback_release,
249 struct nlm_host *host;
250 struct nlm_rqst *call;
257 return rpc_system_err;
262 return rpc_system_err;
264 stat =
func(rqstp, argp, &call->a_res);
272 return rpc_system_err;
279 dprintk(
"lockd: TEST_MSG called\n");
286 dprintk(
"lockd: LOCK_MSG called\n");
293 dprintk(
"lockd: CANCEL_MSG called\n");
300 dprintk(
"lockd: UNLOCK_MSG called\n");
307 dprintk(
"lockd: GRANTED_MSG called\n");
318 struct nlm_host *host;
319 struct nlm_file *
file;
321 dprintk(
"lockd: SHARE called\n");
332 if ((resp->
status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
351 struct nlm_host *host;
352 struct nlm_file *
file;
354 dprintk(
"lockd: UNSHARE called\n");
365 if ((resp->
status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
384 dprintk(
"lockd: NM_LOCK called\n");
387 return nlm4svc_proc_lock(rqstp, argp, resp);
397 struct nlm_host *host;
400 if (nlm4svc_retrieve_args(rqstp, argp, &host,
NULL))
415 dprintk(
"lockd: SM_NOTIFY called\n");
417 if (!nlm_privileged_requester(rqstp)) {
421 return rpc_system_err;
438 dprintk(
"lockd: GRANTED_RES called\n");
449 #define nlm4svc_encode_norep nlm4svc_encode_void
450 #define nlm4svc_decode_norep nlm4svc_decode_void
451 #define nlm4svc_decode_testres nlm4svc_decode_void
452 #define nlm4svc_decode_lockres nlm4svc_decode_void
453 #define nlm4svc_decode_unlockres nlm4svc_decode_void
454 #define nlm4svc_decode_cancelres nlm4svc_decode_void
455 #define nlm4svc_decode_grantedres nlm4svc_decode_void
457 #define nlm4svc_proc_none nlm4svc_proc_null
458 #define nlm4svc_proc_test_res nlm4svc_proc_null
459 #define nlm4svc_proc_lock_res nlm4svc_proc_null
460 #define nlm4svc_proc_cancel_res nlm4svc_proc_null
461 #define nlm4svc_proc_unlock_res nlm4svc_proc_null
465 #define PROC(name, xargt, xrest, argt, rest, respsize) \
466 { .pc_func = (svc_procfunc) nlm4svc_proc_##name, \
467 .pc_decode = (kxdrproc_t) nlm4svc_decode_##xargt, \
468 .pc_encode = (kxdrproc_t) nlm4svc_encode_##xrest, \
469 .pc_release = NULL, \
470 .pc_argsize = sizeof(struct nlm_##argt), \
471 .pc_ressize = sizeof(struct nlm_##rest), \
472 .pc_xdrressize = respsize, \
474 #define Ck (1+XDR_QUADLEN(NLM_MAXCOOKIELEN))
475 #define No (1+1024/4)
479 PROC(null,
void,
void,
void,
void, 1),
485 PROC(test_msg, testargs, norep,
args,
void, 1),
486 PROC(lock_msg, lockargs, norep,
args,
void, 1),
487 PROC(cancel_msg, cancargs, norep,
args,
void, 1),
488 PROC(unlock_msg, unlockargs, norep,
args,
void, 1),
489 PROC(granted_msg, testargs, norep,
args,
void, 1),
490 PROC(test_res, testres, norep,
res,
void, 1),
491 PROC(lock_res, lockres, norep,
res,
void, 1),
492 PROC(cancel_res, cancelres, norep,
res,
void, 1),
493 PROC(unlock_res, unlockres, norep,
res,
void, 1),
496 PROC(sm_notify, reboot,
void, reboot,
void, 1),
497 PROC(
none,
void,
void,
void,
void, 0),
498 PROC(
none,
void,
void,
void,
void, 0),
499 PROC(
none,
void,
void,
void,
void, 0),