aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/clnt4xdr.c92
-rw-r--r--fs/lockd/clntxdr.c92
-rw-r--r--fs/lockd/mon.c26
3 files changed, 87 insertions, 123 deletions
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index 1a1c3e21ed2c..974f1d9cd323 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -385,17 +385,15 @@ static void encode_nlm4_lock(struct xdr_stream *xdr,
385 * struct nlm4_lock alock; 385 * struct nlm4_lock alock;
386 * }; 386 * };
387 */ 387 */
388static int nlm4_xdr_enc_testargs(struct rpc_rqst *req, __be32 *p, 388static void nlm4_xdr_enc_testargs(struct rpc_rqst *req,
389 const struct nlm_args *args) 389 struct xdr_stream *xdr,
390 const struct nlm_args *args)
390{ 391{
391 const struct nlm_lock *lock = &args->lock; 392 const struct nlm_lock *lock = &args->lock;
392 struct xdr_stream xdr;
393 393
394 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 394 encode_cookie(xdr, &args->cookie);
395 encode_cookie(&xdr, &args->cookie); 395 encode_bool(xdr, lock->fl.fl_type == F_WRLCK);
396 encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); 396 encode_nlm4_lock(xdr, lock);
397 encode_nlm4_lock(&xdr, lock);
398 return 0;
399} 397}
400 398
401/* 399/*
@@ -408,20 +406,18 @@ static int nlm4_xdr_enc_testargs(struct rpc_rqst *req, __be32 *p,
408 * int state; 406 * int state;
409 * }; 407 * };
410 */ 408 */
411static int nlm4_xdr_enc_lockargs(struct rpc_rqst *req, __be32 *p, 409static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req,
412 const struct nlm_args *args) 410 struct xdr_stream *xdr,
411 const struct nlm_args *args)
413{ 412{
414 const struct nlm_lock *lock = &args->lock; 413 const struct nlm_lock *lock = &args->lock;
415 struct xdr_stream xdr;
416 414
417 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 415 encode_cookie(xdr, &args->cookie);
418 encode_cookie(&xdr, &args->cookie); 416 encode_bool(xdr, args->block);
419 encode_bool(&xdr, args->block); 417 encode_bool(xdr, lock->fl.fl_type == F_WRLCK);
420 encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); 418 encode_nlm4_lock(xdr, lock);
421 encode_nlm4_lock(&xdr, lock); 419 encode_bool(xdr, args->reclaim);
422 encode_bool(&xdr, args->reclaim); 420 encode_int32(xdr, args->state);
423 encode_int32(&xdr, args->state);
424 return 0;
425} 421}
426 422
427/* 423/*
@@ -432,18 +428,16 @@ static int nlm4_xdr_enc_lockargs(struct rpc_rqst *req, __be32 *p,
432 * struct nlm4_lock alock; 428 * struct nlm4_lock alock;
433 * }; 429 * };
434 */ 430 */
435static int nlm4_xdr_enc_cancargs(struct rpc_rqst *req, __be32 *p, 431static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req,
436 const struct nlm_args *args) 432 struct xdr_stream *xdr,
433 const struct nlm_args *args)
437{ 434{
438 const struct nlm_lock *lock = &args->lock; 435 const struct nlm_lock *lock = &args->lock;
439 struct xdr_stream xdr;
440 436
441 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 437 encode_cookie(xdr, &args->cookie);
442 encode_cookie(&xdr, &args->cookie); 438 encode_bool(xdr, args->block);
443 encode_bool(&xdr, args->block); 439 encode_bool(xdr, lock->fl.fl_type == F_WRLCK);
444 encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); 440 encode_nlm4_lock(xdr, lock);
445 encode_nlm4_lock(&xdr, lock);
446 return 0;
447} 441}
448 442
449/* 443/*
@@ -452,16 +446,14 @@ static int nlm4_xdr_enc_cancargs(struct rpc_rqst *req, __be32 *p,
452 * struct nlm4_lock alock; 446 * struct nlm4_lock alock;
453 * }; 447 * };
454 */ 448 */
455static int nlm4_xdr_enc_unlockargs(struct rpc_rqst *req, __be32 *p, 449static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req,
456 const struct nlm_args *args) 450 struct xdr_stream *xdr,
451 const struct nlm_args *args)
457{ 452{
458 const struct nlm_lock *lock = &args->lock; 453 const struct nlm_lock *lock = &args->lock;
459 struct xdr_stream xdr;
460 454
461 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 455 encode_cookie(xdr, &args->cookie);
462 encode_cookie(&xdr, &args->cookie); 456 encode_nlm4_lock(xdr, lock);
463 encode_nlm4_lock(&xdr, lock);
464 return 0;
465} 457}
466 458
467/* 459/*
@@ -470,15 +462,12 @@ static int nlm4_xdr_enc_unlockargs(struct rpc_rqst *req, __be32 *p,
470 * nlm4_stat stat; 462 * nlm4_stat stat;
471 * }; 463 * };
472 */ 464 */
473static int nlm4_xdr_enc_res(struct rpc_rqst *req, __be32 *p, 465static void nlm4_xdr_enc_res(struct rpc_rqst *req,
474 const struct nlm_res *result) 466 struct xdr_stream *xdr,
467 const struct nlm_res *result)
475{ 468{
476 struct xdr_stream xdr; 469 encode_cookie(xdr, &result->cookie);
477 470 encode_nlm4_stat(xdr, result->status);
478 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
479 encode_cookie(&xdr, &result->cookie);
480 encode_nlm4_stat(&xdr, result->status);
481 return 0;
482} 471}
483 472
484/* 473/*
@@ -494,17 +483,14 @@ static int nlm4_xdr_enc_res(struct rpc_rqst *req, __be32 *p,
494 * nlm4_testrply test_stat; 483 * nlm4_testrply test_stat;
495 * }; 484 * };
496 */ 485 */
497static int nlm4_xdr_enc_testres(struct rpc_rqst *req, __be32 *p, 486static void nlm4_xdr_enc_testres(struct rpc_rqst *req,
498 const struct nlm_res *result) 487 struct xdr_stream *xdr,
488 const struct nlm_res *result)
499{ 489{
500 struct xdr_stream xdr; 490 encode_cookie(xdr, &result->cookie);
501 491 encode_nlm4_stat(xdr, result->status);
502 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
503 encode_cookie(&xdr, &result->cookie);
504 encode_nlm4_stat(&xdr, result->status);
505 if (result->status == nlm_lck_denied) 492 if (result->status == nlm_lck_denied)
506 encode_nlm4_holder(&xdr, result); 493 encode_nlm4_holder(xdr, result);
507 return 0;
508} 494}
509 495
510 496
@@ -588,7 +574,7 @@ out:
588#define PROC(proc, argtype, restype) \ 574#define PROC(proc, argtype, restype) \
589[NLMPROC_##proc] = { \ 575[NLMPROC_##proc] = { \
590 .p_proc = NLMPROC_##proc, \ 576 .p_proc = NLMPROC_##proc, \
591 .p_encode = (kxdrproc_t)nlm4_xdr_enc_##argtype, \ 577 .p_encode = (kxdreproc_t)nlm4_xdr_enc_##argtype, \
592 .p_decode = (kxdrproc_t)nlm4_xdr_dec_##restype, \ 578 .p_decode = (kxdrproc_t)nlm4_xdr_dec_##restype, \
593 .p_arglen = NLM4_##argtype##_sz, \ 579 .p_arglen = NLM4_##argtype##_sz, \
594 .p_replen = NLM4_##restype##_sz, \ 580 .p_replen = NLM4_##restype##_sz, \
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index 0472f2aff509..c6fda8fb1c5b 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -378,17 +378,15 @@ static void encode_nlm_lock(struct xdr_stream *xdr,
378 * struct nlm_lock alock; 378 * struct nlm_lock alock;
379 * }; 379 * };
380 */ 380 */
381static int nlm_xdr_enc_testargs(struct rpc_rqst *req, __be32 *p, 381static void nlm_xdr_enc_testargs(struct rpc_rqst *req,
382 const struct nlm_args *args) 382 struct xdr_stream *xdr,
383 const struct nlm_args *args)
383{ 384{
384 const struct nlm_lock *lock = &args->lock; 385 const struct nlm_lock *lock = &args->lock;
385 struct xdr_stream xdr;
386 386
387 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 387 encode_cookie(xdr, &args->cookie);
388 encode_cookie(&xdr, &args->cookie); 388 encode_bool(xdr, lock->fl.fl_type == F_WRLCK);
389 encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); 389 encode_nlm_lock(xdr, lock);
390 encode_nlm_lock(&xdr, lock);
391 return 0;
392} 390}
393 391
394/* 392/*
@@ -401,20 +399,18 @@ static int nlm_xdr_enc_testargs(struct rpc_rqst *req, __be32 *p,
401 * int state; 399 * int state;
402 * }; 400 * };
403 */ 401 */
404static int nlm_xdr_enc_lockargs(struct rpc_rqst *req, __be32 *p, 402static void nlm_xdr_enc_lockargs(struct rpc_rqst *req,
405 const struct nlm_args *args) 403 struct xdr_stream *xdr,
404 const struct nlm_args *args)
406{ 405{
407 const struct nlm_lock *lock = &args->lock; 406 const struct nlm_lock *lock = &args->lock;
408 struct xdr_stream xdr;
409 407
410 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 408 encode_cookie(xdr, &args->cookie);
411 encode_cookie(&xdr, &args->cookie); 409 encode_bool(xdr, args->block);
412 encode_bool(&xdr, args->block); 410 encode_bool(xdr, lock->fl.fl_type == F_WRLCK);
413 encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); 411 encode_nlm_lock(xdr, lock);
414 encode_nlm_lock(&xdr, lock); 412 encode_bool(xdr, args->reclaim);
415 encode_bool(&xdr, args->reclaim); 413 encode_int32(xdr, args->state);
416 encode_int32(&xdr, args->state);
417 return 0;
418} 414}
419 415
420/* 416/*
@@ -425,18 +421,16 @@ static int nlm_xdr_enc_lockargs(struct rpc_rqst *req, __be32 *p,
425 * struct nlm_lock alock; 421 * struct nlm_lock alock;
426 * }; 422 * };
427 */ 423 */
428static int nlm_xdr_enc_cancargs(struct rpc_rqst *req, __be32 *p, 424static void nlm_xdr_enc_cancargs(struct rpc_rqst *req,
429 const struct nlm_args *args) 425 struct xdr_stream *xdr,
426 const struct nlm_args *args)
430{ 427{
431 const struct nlm_lock *lock = &args->lock; 428 const struct nlm_lock *lock = &args->lock;
432 struct xdr_stream xdr;
433 429
434 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 430 encode_cookie(xdr, &args->cookie);
435 encode_cookie(&xdr, &args->cookie); 431 encode_bool(xdr, args->block);
436 encode_bool(&xdr, args->block); 432 encode_bool(xdr, lock->fl.fl_type == F_WRLCK);
437 encode_bool(&xdr, lock->fl.fl_type == F_WRLCK); 433 encode_nlm_lock(xdr, lock);
438 encode_nlm_lock(&xdr, lock);
439 return 0;
440} 434}
441 435
442/* 436/*
@@ -445,16 +439,14 @@ static int nlm_xdr_enc_cancargs(struct rpc_rqst *req, __be32 *p,
445 * struct nlm_lock alock; 439 * struct nlm_lock alock;
446 * }; 440 * };
447 */ 441 */
448static int nlm_xdr_enc_unlockargs(struct rpc_rqst *req, __be32 *p, 442static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req,
449 const struct nlm_args *args) 443 struct xdr_stream *xdr,
444 const struct nlm_args *args)
450{ 445{
451 const struct nlm_lock *lock = &args->lock; 446 const struct nlm_lock *lock = &args->lock;
452 struct xdr_stream xdr;
453 447
454 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 448 encode_cookie(xdr, &args->cookie);
455 encode_cookie(&xdr, &args->cookie); 449 encode_nlm_lock(xdr, lock);
456 encode_nlm_lock(&xdr, lock);
457 return 0;
458} 450}
459 451
460/* 452/*
@@ -463,15 +455,12 @@ static int nlm_xdr_enc_unlockargs(struct rpc_rqst *req, __be32 *p,
463 * nlm_stat stat; 455 * nlm_stat stat;
464 * }; 456 * };
465 */ 457 */
466static int nlm_xdr_enc_res(struct rpc_rqst *req, __be32 *p, 458static void nlm_xdr_enc_res(struct rpc_rqst *req,
467 const struct nlm_res *result) 459 struct xdr_stream *xdr,
460 const struct nlm_res *result)
468{ 461{
469 struct xdr_stream xdr; 462 encode_cookie(xdr, &result->cookie);
470 463 encode_nlm_stat(xdr, result->status);
471 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
472 encode_cookie(&xdr, &result->cookie);
473 encode_nlm_stat(&xdr, result->status);
474 return 0;
475} 464}
476 465
477/* 466/*
@@ -494,16 +483,13 @@ static void encode_nlm_testrply(struct xdr_stream *xdr,
494 encode_nlm_holder(xdr, result); 483 encode_nlm_holder(xdr, result);
495} 484}
496 485
497static int nlm_xdr_enc_testres(struct rpc_rqst *req, __be32 *p, 486static void nlm_xdr_enc_testres(struct rpc_rqst *req,
498 const struct nlm_res *result) 487 struct xdr_stream *xdr,
488 const struct nlm_res *result)
499{ 489{
500 struct xdr_stream xdr; 490 encode_cookie(xdr, &result->cookie);
501 491 encode_nlm_stat(xdr, result->status);
502 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 492 encode_nlm_testrply(xdr, result);
503 encode_cookie(&xdr, &result->cookie);
504 encode_nlm_stat(&xdr, result->status);
505 encode_nlm_testrply(&xdr, result);
506 return 0;
507} 493}
508 494
509 495
@@ -586,7 +572,7 @@ out:
586#define PROC(proc, argtype, restype) \ 572#define PROC(proc, argtype, restype) \
587[NLMPROC_##proc] = { \ 573[NLMPROC_##proc] = { \
588 .p_proc = NLMPROC_##proc, \ 574 .p_proc = NLMPROC_##proc, \
589 .p_encode = (kxdrproc_t)nlm_xdr_enc_##argtype, \ 575 .p_encode = (kxdreproc_t)nlm_xdr_enc_##argtype, \
590 .p_decode = (kxdrproc_t)nlm_xdr_dec_##restype, \ 576 .p_decode = (kxdrproc_t)nlm_xdr_dec_##restype, \
591 .p_arglen = NLM_##argtype##_sz, \ 577 .p_arglen = NLM_##argtype##_sz, \
592 .p_replen = NLM_##restype##_sz, \ 578 .p_replen = NLM_##restype##_sz, \
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index d812818d0258..baa77bc9d825 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -459,25 +459,17 @@ static void encode_priv(struct xdr_stream *xdr, const struct nsm_args *argp)
459 xdr_encode_opaque_fixed(p, argp->priv->data, SM_PRIV_SIZE); 459 xdr_encode_opaque_fixed(p, argp->priv->data, SM_PRIV_SIZE);
460} 460}
461 461
462static int xdr_enc_mon(struct rpc_rqst *req, __be32 *p, 462static void nsm_xdr_enc_mon(struct rpc_rqst *req, struct xdr_stream *xdr,
463 const struct nsm_args *argp) 463 const struct nsm_args *argp)
464{ 464{
465 struct xdr_stream xdr; 465 encode_mon_id(xdr, argp);
466 466 encode_priv(xdr, argp);
467 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
468 encode_mon_id(&xdr, argp);
469 encode_priv(&xdr, argp);
470 return 0;
471} 467}
472 468
473static int xdr_enc_unmon(struct rpc_rqst *req, __be32 *p, 469static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr,
474 const struct nsm_args *argp) 470 const struct nsm_args *argp)
475{ 471{
476 struct xdr_stream xdr; 472 encode_mon_id(xdr, argp);
477
478 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
479 encode_mon_id(&xdr, argp);
480 return 0;
481} 473}
482 474
483static int xdr_dec_stat_res(struct rpc_rqst *rqstp, __be32 *p, 475static int xdr_dec_stat_res(struct rpc_rqst *rqstp, __be32 *p,
@@ -524,7 +516,7 @@ static int xdr_dec_stat(struct rpc_rqst *rqstp, __be32 *p,
524static struct rpc_procinfo nsm_procedures[] = { 516static struct rpc_procinfo nsm_procedures[] = {
525[NSMPROC_MON] = { 517[NSMPROC_MON] = {
526 .p_proc = NSMPROC_MON, 518 .p_proc = NSMPROC_MON,
527 .p_encode = (kxdrproc_t)xdr_enc_mon, 519 .p_encode = (kxdreproc_t)nsm_xdr_enc_mon,
528 .p_decode = (kxdrproc_t)xdr_dec_stat_res, 520 .p_decode = (kxdrproc_t)xdr_dec_stat_res,
529 .p_arglen = SM_mon_sz, 521 .p_arglen = SM_mon_sz,
530 .p_replen = SM_monres_sz, 522 .p_replen = SM_monres_sz,
@@ -533,7 +525,7 @@ static struct rpc_procinfo nsm_procedures[] = {
533 }, 525 },
534[NSMPROC_UNMON] = { 526[NSMPROC_UNMON] = {
535 .p_proc = NSMPROC_UNMON, 527 .p_proc = NSMPROC_UNMON,
536 .p_encode = (kxdrproc_t)xdr_enc_unmon, 528 .p_encode = (kxdreproc_t)nsm_xdr_enc_unmon,
537 .p_decode = (kxdrproc_t)xdr_dec_stat, 529 .p_decode = (kxdrproc_t)xdr_dec_stat,
538 .p_arglen = SM_mon_id_sz, 530 .p_arglen = SM_mon_id_sz,
539 .p_replen = SM_unmonres_sz, 531 .p_replen = SM_unmonres_sz,