diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2006-12-13 03:35:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-13 12:05:52 -0500 |
commit | e8c5c045d790e7018c56f1a998a2d240b732ea3c (patch) | |
tree | d64de6d21d715d163244a1caeedd617955eaad5e /fs/lockd/clntproc.c | |
parent | 905f3ed62515f233fea09dc5ad68bbcff4903520 (diff) |
[PATCH] lockd endianness annotations
Annotated, all places switched to keeping status net-endian.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/lockd/clntproc.c')
-rw-r--r-- | fs/lockd/clntproc.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 80a1a6dccc8f..0b4acc1c5e7d 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -27,7 +27,7 @@ | |||
27 | static int nlmclnt_test(struct nlm_rqst *, struct file_lock *); | 27 | static int nlmclnt_test(struct nlm_rqst *, struct file_lock *); |
28 | static int nlmclnt_lock(struct nlm_rqst *, struct file_lock *); | 28 | static int nlmclnt_lock(struct nlm_rqst *, struct file_lock *); |
29 | static int nlmclnt_unlock(struct nlm_rqst *, struct file_lock *); | 29 | static int nlmclnt_unlock(struct nlm_rqst *, struct file_lock *); |
30 | static int nlm_stat_to_errno(u32 stat); | 30 | static int nlm_stat_to_errno(__be32 stat); |
31 | static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host); | 31 | static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *host); |
32 | static int nlmclnt_cancel(struct nlm_host *, int , struct file_lock *); | 32 | static int nlmclnt_cancel(struct nlm_host *, int , struct file_lock *); |
33 | 33 | ||
@@ -325,7 +325,7 @@ nlmclnt_call(struct nlm_rqst *req, u32 proc) | |||
325 | } | 325 | } |
326 | break; | 326 | break; |
327 | } else | 327 | } else |
328 | if (resp->status == NLM_LCK_DENIED_GRACE_PERIOD) { | 328 | if (resp->status == nlm_lck_denied_grace_period) { |
329 | dprintk("lockd: server in grace period\n"); | 329 | dprintk("lockd: server in grace period\n"); |
330 | if (argp->reclaim) { | 330 | if (argp->reclaim) { |
331 | printk(KERN_WARNING | 331 | printk(KERN_WARNING |
@@ -411,10 +411,10 @@ nlmclnt_test(struct nlm_rqst *req, struct file_lock *fl) | |||
411 | goto out; | 411 | goto out; |
412 | 412 | ||
413 | switch (req->a_res.status) { | 413 | switch (req->a_res.status) { |
414 | case NLM_LCK_GRANTED: | 414 | case nlm_granted: |
415 | fl->fl_type = F_UNLCK; | 415 | fl->fl_type = F_UNLCK; |
416 | break; | 416 | break; |
417 | case NLM_LCK_DENIED: | 417 | case nlm_lck_denied: |
418 | /* | 418 | /* |
419 | * Report the conflicting lock back to the application. | 419 | * Report the conflicting lock back to the application. |
420 | */ | 420 | */ |
@@ -524,9 +524,9 @@ again: | |||
524 | if (!req->a_args.block) | 524 | if (!req->a_args.block) |
525 | break; | 525 | break; |
526 | /* Did a reclaimer thread notify us of a server reboot? */ | 526 | /* Did a reclaimer thread notify us of a server reboot? */ |
527 | if (resp->status == NLM_LCK_DENIED_GRACE_PERIOD) | 527 | if (resp->status == nlm_lck_denied_grace_period) |
528 | continue; | 528 | continue; |
529 | if (resp->status != NLM_LCK_BLOCKED) | 529 | if (resp->status != nlm_lck_blocked) |
530 | break; | 530 | break; |
531 | /* Wait on an NLM blocking lock */ | 531 | /* Wait on an NLM blocking lock */ |
532 | status = nlmclnt_block(block, req, NLMCLNT_POLL_TIMEOUT); | 532 | status = nlmclnt_block(block, req, NLMCLNT_POLL_TIMEOUT); |
@@ -535,11 +535,11 @@ again: | |||
535 | */ | 535 | */ |
536 | if (status < 0) | 536 | if (status < 0) |
537 | goto out_unblock; | 537 | goto out_unblock; |
538 | if (resp->status != NLM_LCK_BLOCKED) | 538 | if (resp->status != nlm_lck_blocked) |
539 | break; | 539 | break; |
540 | } | 540 | } |
541 | 541 | ||
542 | if (resp->status == NLM_LCK_GRANTED) { | 542 | if (resp->status == nlm_granted) { |
543 | down_read(&host->h_rwsem); | 543 | down_read(&host->h_rwsem); |
544 | /* Check whether or not the server has rebooted */ | 544 | /* Check whether or not the server has rebooted */ |
545 | if (fl->fl_u.nfs_fl.state != host->h_state) { | 545 | if (fl->fl_u.nfs_fl.state != host->h_state) { |
@@ -556,7 +556,7 @@ again: | |||
556 | out_unblock: | 556 | out_unblock: |
557 | nlmclnt_finish_block(block); | 557 | nlmclnt_finish_block(block); |
558 | /* Cancel the blocked request if it is still pending */ | 558 | /* Cancel the blocked request if it is still pending */ |
559 | if (resp->status == NLM_LCK_BLOCKED) | 559 | if (resp->status == nlm_lck_blocked) |
560 | nlmclnt_cancel(host, req->a_args.block, fl); | 560 | nlmclnt_cancel(host, req->a_args.block, fl); |
561 | out: | 561 | out: |
562 | nlm_release_call(req); | 562 | nlm_release_call(req); |
@@ -585,12 +585,12 @@ nlmclnt_reclaim(struct nlm_host *host, struct file_lock *fl) | |||
585 | req->a_args.reclaim = 1; | 585 | req->a_args.reclaim = 1; |
586 | 586 | ||
587 | if ((status = nlmclnt_call(req, NLMPROC_LOCK)) >= 0 | 587 | if ((status = nlmclnt_call(req, NLMPROC_LOCK)) >= 0 |
588 | && req->a_res.status == NLM_LCK_GRANTED) | 588 | && req->a_res.status == nlm_granted) |
589 | return 0; | 589 | return 0; |
590 | 590 | ||
591 | printk(KERN_WARNING "lockd: failed to reclaim lock for pid %d " | 591 | printk(KERN_WARNING "lockd: failed to reclaim lock for pid %d " |
592 | "(errno %d, status %d)\n", fl->fl_pid, | 592 | "(errno %d, status %d)\n", fl->fl_pid, |
593 | status, req->a_res.status); | 593 | status, ntohl(req->a_res.status)); |
594 | 594 | ||
595 | /* | 595 | /* |
596 | * FIXME: This is a serious failure. We can | 596 | * FIXME: This is a serious failure. We can |
@@ -637,10 +637,10 @@ nlmclnt_unlock(struct nlm_rqst *req, struct file_lock *fl) | |||
637 | if (status < 0) | 637 | if (status < 0) |
638 | goto out; | 638 | goto out; |
639 | 639 | ||
640 | if (resp->status == NLM_LCK_GRANTED) | 640 | if (resp->status == nlm_granted) |
641 | goto out; | 641 | goto out; |
642 | 642 | ||
643 | if (resp->status != NLM_LCK_DENIED_NOLOCKS) | 643 | if (resp->status != nlm_lck_denied_nolocks) |
644 | printk("lockd: unexpected unlock status: %d\n", resp->status); | 644 | printk("lockd: unexpected unlock status: %d\n", resp->status); |
645 | /* What to do now? I'm out of my depth... */ | 645 | /* What to do now? I'm out of my depth... */ |
646 | status = -ENOLCK; | 646 | status = -ENOLCK; |
@@ -652,7 +652,7 @@ out: | |||
652 | static void nlmclnt_unlock_callback(struct rpc_task *task, void *data) | 652 | static void nlmclnt_unlock_callback(struct rpc_task *task, void *data) |
653 | { | 653 | { |
654 | struct nlm_rqst *req = data; | 654 | struct nlm_rqst *req = data; |
655 | int status = req->a_res.status; | 655 | u32 status = ntohl(req->a_res.status); |
656 | 656 | ||
657 | if (RPC_ASSASSINATED(task)) | 657 | if (RPC_ASSASSINATED(task)) |
658 | goto die; | 658 | goto die; |
@@ -720,6 +720,7 @@ static int nlmclnt_cancel(struct nlm_host *host, int block, struct file_lock *fl | |||
720 | static void nlmclnt_cancel_callback(struct rpc_task *task, void *data) | 720 | static void nlmclnt_cancel_callback(struct rpc_task *task, void *data) |
721 | { | 721 | { |
722 | struct nlm_rqst *req = data; | 722 | struct nlm_rqst *req = data; |
723 | u32 status = ntohl(req->a_res.status); | ||
723 | 724 | ||
724 | if (RPC_ASSASSINATED(task)) | 725 | if (RPC_ASSASSINATED(task)) |
725 | goto die; | 726 | goto die; |
@@ -731,9 +732,9 @@ static void nlmclnt_cancel_callback(struct rpc_task *task, void *data) | |||
731 | } | 732 | } |
732 | 733 | ||
733 | dprintk("lockd: cancel status %u (task %u)\n", | 734 | dprintk("lockd: cancel status %u (task %u)\n", |
734 | req->a_res.status, task->tk_pid); | 735 | status, task->tk_pid); |
735 | 736 | ||
736 | switch (req->a_res.status) { | 737 | switch (status) { |
737 | case NLM_LCK_GRANTED: | 738 | case NLM_LCK_GRANTED: |
738 | case NLM_LCK_DENIED_GRACE_PERIOD: | 739 | case NLM_LCK_DENIED_GRACE_PERIOD: |
739 | case NLM_LCK_DENIED: | 740 | case NLM_LCK_DENIED: |
@@ -744,7 +745,7 @@ static void nlmclnt_cancel_callback(struct rpc_task *task, void *data) | |||
744 | goto retry_cancel; | 745 | goto retry_cancel; |
745 | default: | 746 | default: |
746 | printk(KERN_NOTICE "lockd: weird return %d for CANCEL call\n", | 747 | printk(KERN_NOTICE "lockd: weird return %d for CANCEL call\n", |
747 | req->a_res.status); | 748 | status); |
748 | } | 749 | } |
749 | 750 | ||
750 | die: | 751 | die: |
@@ -768,9 +769,9 @@ static const struct rpc_call_ops nlmclnt_cancel_ops = { | |||
768 | * Convert an NLM status code to a generic kernel errno | 769 | * Convert an NLM status code to a generic kernel errno |
769 | */ | 770 | */ |
770 | static int | 771 | static int |
771 | nlm_stat_to_errno(u32 status) | 772 | nlm_stat_to_errno(__be32 status) |
772 | { | 773 | { |
773 | switch(status) { | 774 | switch(ntohl(status)) { |
774 | case NLM_LCK_GRANTED: | 775 | case NLM_LCK_GRANTED: |
775 | return 0; | 776 | return 0; |
776 | case NLM_LCK_DENIED: | 777 | case NLM_LCK_DENIED: |