summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-05-08 03:34:04 -0400
committerChristoph Hellwig <hch@lst.de>2017-05-15 11:42:09 -0400
commitbf96391e7b59a994c8aa72f5c425e3897ee799fa (patch)
tree8d9c18080cef2cf4c569ff50dddbe23fc07e58ac
parent7d55f7febab6af865630ccb3a0fac9a144c459df (diff)
lockd: fix encoder callback prototypes
Declare the p_encode callbacks with the proper prototype instead of casting to kxdreproc_t and losing all type safety. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jeff Layton <jlayton@redhat.com> Acked-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/lockd/clnt4xdr.c22
-rw-r--r--fs/lockd/clntxdr.c22
-rw-r--r--fs/lockd/mon.c8
3 files changed, 34 insertions, 18 deletions
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index d3e40db28930..3cbad662120a 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -381,8 +381,9 @@ static void encode_nlm4_lock(struct xdr_stream *xdr,
381 */ 381 */
382static void nlm4_xdr_enc_testargs(struct rpc_rqst *req, 382static void nlm4_xdr_enc_testargs(struct rpc_rqst *req,
383 struct xdr_stream *xdr, 383 struct xdr_stream *xdr,
384 const struct nlm_args *args) 384 const void *data)
385{ 385{
386 const struct nlm_args *args = data;
386 const struct nlm_lock *lock = &args->lock; 387 const struct nlm_lock *lock = &args->lock;
387 388
388 encode_cookie(xdr, &args->cookie); 389 encode_cookie(xdr, &args->cookie);
@@ -402,8 +403,9 @@ static void nlm4_xdr_enc_testargs(struct rpc_rqst *req,
402 */ 403 */
403static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req, 404static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req,
404 struct xdr_stream *xdr, 405 struct xdr_stream *xdr,
405 const struct nlm_args *args) 406 const void *data)
406{ 407{
408 const struct nlm_args *args = data;
407 const struct nlm_lock *lock = &args->lock; 409 const struct nlm_lock *lock = &args->lock;
408 410
409 encode_cookie(xdr, &args->cookie); 411 encode_cookie(xdr, &args->cookie);
@@ -424,8 +426,9 @@ static void nlm4_xdr_enc_lockargs(struct rpc_rqst *req,
424 */ 426 */
425static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req, 427static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req,
426 struct xdr_stream *xdr, 428 struct xdr_stream *xdr,
427 const struct nlm_args *args) 429 const void *data)
428{ 430{
431 const struct nlm_args *args = data;
429 const struct nlm_lock *lock = &args->lock; 432 const struct nlm_lock *lock = &args->lock;
430 433
431 encode_cookie(xdr, &args->cookie); 434 encode_cookie(xdr, &args->cookie);
@@ -442,8 +445,9 @@ static void nlm4_xdr_enc_cancargs(struct rpc_rqst *req,
442 */ 445 */
443static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req, 446static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req,
444 struct xdr_stream *xdr, 447 struct xdr_stream *xdr,
445 const struct nlm_args *args) 448 const void *data)
446{ 449{
450 const struct nlm_args *args = data;
447 const struct nlm_lock *lock = &args->lock; 451 const struct nlm_lock *lock = &args->lock;
448 452
449 encode_cookie(xdr, &args->cookie); 453 encode_cookie(xdr, &args->cookie);
@@ -458,8 +462,10 @@ static void nlm4_xdr_enc_unlockargs(struct rpc_rqst *req,
458 */ 462 */
459static void nlm4_xdr_enc_res(struct rpc_rqst *req, 463static void nlm4_xdr_enc_res(struct rpc_rqst *req,
460 struct xdr_stream *xdr, 464 struct xdr_stream *xdr,
461 const struct nlm_res *result) 465 const void *data)
462{ 466{
467 const struct nlm_res *result = data;
468
463 encode_cookie(xdr, &result->cookie); 469 encode_cookie(xdr, &result->cookie);
464 encode_nlm4_stat(xdr, result->status); 470 encode_nlm4_stat(xdr, result->status);
465} 471}
@@ -479,8 +485,10 @@ static void nlm4_xdr_enc_res(struct rpc_rqst *req,
479 */ 485 */
480static void nlm4_xdr_enc_testres(struct rpc_rqst *req, 486static void nlm4_xdr_enc_testres(struct rpc_rqst *req,
481 struct xdr_stream *xdr, 487 struct xdr_stream *xdr,
482 const struct nlm_res *result) 488 const void *data)
483{ 489{
490 const struct nlm_res *result = data;
491
484 encode_cookie(xdr, &result->cookie); 492 encode_cookie(xdr, &result->cookie);
485 encode_nlm4_stat(xdr, result->status); 493 encode_nlm4_stat(xdr, result->status);
486 if (result->status == nlm_lck_denied) 494 if (result->status == nlm_lck_denied)
@@ -566,7 +574,7 @@ out:
566#define PROC(proc, argtype, restype) \ 574#define PROC(proc, argtype, restype) \
567[NLMPROC_##proc] = { \ 575[NLMPROC_##proc] = { \
568 .p_proc = NLMPROC_##proc, \ 576 .p_proc = NLMPROC_##proc, \
569 .p_encode = (kxdreproc_t)nlm4_xdr_enc_##argtype, \ 577 .p_encode = nlm4_xdr_enc_##argtype, \
570 .p_decode = (kxdrdproc_t)nlm4_xdr_dec_##restype, \ 578 .p_decode = (kxdrdproc_t)nlm4_xdr_dec_##restype, \
571 .p_arglen = NLM4_##argtype##_sz, \ 579 .p_arglen = NLM4_##argtype##_sz, \
572 .p_replen = NLM4_##restype##_sz, \ 580 .p_replen = NLM4_##restype##_sz, \
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index 3e9f7874b975..825c0fde8c80 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -374,8 +374,9 @@ static void encode_nlm_lock(struct xdr_stream *xdr,
374 */ 374 */
375static void nlm_xdr_enc_testargs(struct rpc_rqst *req, 375static void nlm_xdr_enc_testargs(struct rpc_rqst *req,
376 struct xdr_stream *xdr, 376 struct xdr_stream *xdr,
377 const struct nlm_args *args) 377 const void *data)
378{ 378{
379 const struct nlm_args *args = data;
379 const struct nlm_lock *lock = &args->lock; 380 const struct nlm_lock *lock = &args->lock;
380 381
381 encode_cookie(xdr, &args->cookie); 382 encode_cookie(xdr, &args->cookie);
@@ -395,8 +396,9 @@ static void nlm_xdr_enc_testargs(struct rpc_rqst *req,
395 */ 396 */
396static void nlm_xdr_enc_lockargs(struct rpc_rqst *req, 397static void nlm_xdr_enc_lockargs(struct rpc_rqst *req,
397 struct xdr_stream *xdr, 398 struct xdr_stream *xdr,
398 const struct nlm_args *args) 399 const void *data)
399{ 400{
401 const struct nlm_args *args = data;
400 const struct nlm_lock *lock = &args->lock; 402 const struct nlm_lock *lock = &args->lock;
401 403
402 encode_cookie(xdr, &args->cookie); 404 encode_cookie(xdr, &args->cookie);
@@ -417,8 +419,9 @@ static void nlm_xdr_enc_lockargs(struct rpc_rqst *req,
417 */ 419 */
418static void nlm_xdr_enc_cancargs(struct rpc_rqst *req, 420static void nlm_xdr_enc_cancargs(struct rpc_rqst *req,
419 struct xdr_stream *xdr, 421 struct xdr_stream *xdr,
420 const struct nlm_args *args) 422 const void *data)
421{ 423{
424 const struct nlm_args *args = data;
422 const struct nlm_lock *lock = &args->lock; 425 const struct nlm_lock *lock = &args->lock;
423 426
424 encode_cookie(xdr, &args->cookie); 427 encode_cookie(xdr, &args->cookie);
@@ -435,8 +438,9 @@ static void nlm_xdr_enc_cancargs(struct rpc_rqst *req,
435 */ 438 */
436static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req, 439static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req,
437 struct xdr_stream *xdr, 440 struct xdr_stream *xdr,
438 const struct nlm_args *args) 441 const void *data)
439{ 442{
443 const struct nlm_args *args = data;
440 const struct nlm_lock *lock = &args->lock; 444 const struct nlm_lock *lock = &args->lock;
441 445
442 encode_cookie(xdr, &args->cookie); 446 encode_cookie(xdr, &args->cookie);
@@ -451,8 +455,10 @@ static void nlm_xdr_enc_unlockargs(struct rpc_rqst *req,
451 */ 455 */
452static void nlm_xdr_enc_res(struct rpc_rqst *req, 456static void nlm_xdr_enc_res(struct rpc_rqst *req,
453 struct xdr_stream *xdr, 457 struct xdr_stream *xdr,
454 const struct nlm_res *result) 458 const void *data)
455{ 459{
460 const struct nlm_res *result = data;
461
456 encode_cookie(xdr, &result->cookie); 462 encode_cookie(xdr, &result->cookie);
457 encode_nlm_stat(xdr, result->status); 463 encode_nlm_stat(xdr, result->status);
458} 464}
@@ -479,8 +485,10 @@ static void encode_nlm_testrply(struct xdr_stream *xdr,
479 485
480static void nlm_xdr_enc_testres(struct rpc_rqst *req, 486static void nlm_xdr_enc_testres(struct rpc_rqst *req,
481 struct xdr_stream *xdr, 487 struct xdr_stream *xdr,
482 const struct nlm_res *result) 488 const void *data)
483{ 489{
490 const struct nlm_res *result = data;
491
484 encode_cookie(xdr, &result->cookie); 492 encode_cookie(xdr, &result->cookie);
485 encode_nlm_stat(xdr, result->status); 493 encode_nlm_stat(xdr, result->status);
486 encode_nlm_testrply(xdr, result); 494 encode_nlm_testrply(xdr, result);
@@ -564,7 +572,7 @@ out:
564#define PROC(proc, argtype, restype) \ 572#define PROC(proc, argtype, restype) \
565[NLMPROC_##proc] = { \ 573[NLMPROC_##proc] = { \
566 .p_proc = NLMPROC_##proc, \ 574 .p_proc = NLMPROC_##proc, \
567 .p_encode = (kxdreproc_t)nlm_xdr_enc_##argtype, \ 575 .p_encode = nlm_xdr_enc_##argtype, \
568 .p_decode = (kxdrdproc_t)nlm_xdr_dec_##restype, \ 576 .p_decode = (kxdrdproc_t)nlm_xdr_dec_##restype, \
569 .p_arglen = NLM_##argtype##_sz, \ 577 .p_arglen = NLM_##argtype##_sz, \
570 .p_replen = NLM_##restype##_sz, \ 578 .p_replen = NLM_##restype##_sz, \
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index 19166d4a8d31..8043fd4b8a5c 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -476,14 +476,14 @@ static void encode_priv(struct xdr_stream *xdr, const struct nsm_args *argp)
476} 476}
477 477
478static void nsm_xdr_enc_mon(struct rpc_rqst *req, struct xdr_stream *xdr, 478static void nsm_xdr_enc_mon(struct rpc_rqst *req, struct xdr_stream *xdr,
479 const struct nsm_args *argp) 479 const void *argp)
480{ 480{
481 encode_mon_id(xdr, argp); 481 encode_mon_id(xdr, argp);
482 encode_priv(xdr, argp); 482 encode_priv(xdr, argp);
483} 483}
484 484
485static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr, 485static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr,
486 const struct nsm_args *argp) 486 const void *argp)
487{ 487{
488 encode_mon_id(xdr, argp); 488 encode_mon_id(xdr, argp);
489} 489}
@@ -532,7 +532,7 @@ static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp,
532static struct rpc_procinfo nsm_procedures[] = { 532static struct rpc_procinfo nsm_procedures[] = {
533[NSMPROC_MON] = { 533[NSMPROC_MON] = {
534 .p_proc = NSMPROC_MON, 534 .p_proc = NSMPROC_MON,
535 .p_encode = (kxdreproc_t)nsm_xdr_enc_mon, 535 .p_encode = nsm_xdr_enc_mon,
536 .p_decode = (kxdrdproc_t)nsm_xdr_dec_stat_res, 536 .p_decode = (kxdrdproc_t)nsm_xdr_dec_stat_res,
537 .p_arglen = SM_mon_sz, 537 .p_arglen = SM_mon_sz,
538 .p_replen = SM_monres_sz, 538 .p_replen = SM_monres_sz,
@@ -541,7 +541,7 @@ static struct rpc_procinfo nsm_procedures[] = {
541 }, 541 },
542[NSMPROC_UNMON] = { 542[NSMPROC_UNMON] = {
543 .p_proc = NSMPROC_UNMON, 543 .p_proc = NSMPROC_UNMON,
544 .p_encode = (kxdreproc_t)nsm_xdr_enc_unmon, 544 .p_encode = nsm_xdr_enc_unmon,
545 .p_decode = (kxdrdproc_t)nsm_xdr_dec_stat, 545 .p_decode = (kxdrdproc_t)nsm_xdr_dec_stat,
546 .p_arglen = SM_mon_id_sz, 546 .p_arglen = SM_mon_id_sz,
547 .p_replen = SM_unmonres_sz, 547 .p_replen = SM_unmonres_sz,