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 | |
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')
-rw-r--r-- | fs/lockd/clntlock.c | 10 | ||||
-rw-r--r-- | fs/lockd/clntproc.c | 39 | ||||
-rw-r--r-- | fs/lockd/svclock.c | 4 | ||||
-rw-r--r-- | fs/lockd/xdr.c | 8 | ||||
-rw-r--r-- | fs/lockd/xdr4.c | 8 |
5 files changed, 35 insertions, 34 deletions
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index 92681c9e9b20..062707745162 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c | |||
@@ -36,7 +36,7 @@ struct nlm_wait { | |||
36 | struct nlm_host * b_host; | 36 | struct nlm_host * b_host; |
37 | struct file_lock * b_lock; /* local file lock */ | 37 | struct file_lock * b_lock; /* local file lock */ |
38 | unsigned short b_reclaim; /* got to reclaim lock */ | 38 | unsigned short b_reclaim; /* got to reclaim lock */ |
39 | u32 b_status; /* grant callback status */ | 39 | __be32 b_status; /* grant callback status */ |
40 | }; | 40 | }; |
41 | 41 | ||
42 | static LIST_HEAD(nlm_blocked); | 42 | static LIST_HEAD(nlm_blocked); |
@@ -53,7 +53,7 @@ struct nlm_wait *nlmclnt_prepare_block(struct nlm_host *host, struct file_lock * | |||
53 | block->b_host = host; | 53 | block->b_host = host; |
54 | block->b_lock = fl; | 54 | block->b_lock = fl; |
55 | init_waitqueue_head(&block->b_wait); | 55 | init_waitqueue_head(&block->b_wait); |
56 | block->b_status = NLM_LCK_BLOCKED; | 56 | block->b_status = nlm_lck_blocked; |
57 | list_add(&block->b_list, &nlm_blocked); | 57 | list_add(&block->b_list, &nlm_blocked); |
58 | } | 58 | } |
59 | return block; | 59 | return block; |
@@ -89,7 +89,7 @@ int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout) | |||
89 | * nlmclnt_lock for an explanation. | 89 | * nlmclnt_lock for an explanation. |
90 | */ | 90 | */ |
91 | ret = wait_event_interruptible_timeout(block->b_wait, | 91 | ret = wait_event_interruptible_timeout(block->b_wait, |
92 | block->b_status != NLM_LCK_BLOCKED, | 92 | block->b_status != nlm_lck_blocked, |
93 | timeout); | 93 | timeout); |
94 | if (ret < 0) | 94 | if (ret < 0) |
95 | return -ERESTARTSYS; | 95 | return -ERESTARTSYS; |
@@ -131,7 +131,7 @@ __be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock | |||
131 | /* Alright, we found a lock. Set the return status | 131 | /* Alright, we found a lock. Set the return status |
132 | * and wake up the caller | 132 | * and wake up the caller |
133 | */ | 133 | */ |
134 | block->b_status = NLM_LCK_GRANTED; | 134 | block->b_status = nlm_granted; |
135 | wake_up(&block->b_wait); | 135 | wake_up(&block->b_wait); |
136 | res = nlm_granted; | 136 | res = nlm_granted; |
137 | } | 137 | } |
@@ -211,7 +211,7 @@ restart: | |||
211 | /* Now, wake up all processes that sleep on a blocked lock */ | 211 | /* Now, wake up all processes that sleep on a blocked lock */ |
212 | list_for_each_entry(block, &nlm_blocked, b_list) { | 212 | list_for_each_entry(block, &nlm_blocked, b_list) { |
213 | if (block->b_host == host) { | 213 | if (block->b_host == host) { |
214 | block->b_status = NLM_LCK_DENIED_GRACE_PERIOD; | 214 | block->b_status = nlm_lck_denied_grace_period; |
215 | wake_up(&block->b_wait); | 215 | wake_up(&block->b_wait); |
216 | } | 216 | } |
217 | } | 217 | } |
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: |
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index 5c054b20fd5e..c7db0a5bccdc 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -645,7 +645,7 @@ static const struct rpc_call_ops nlmsvc_grant_ops = { | |||
645 | * block. | 645 | * block. |
646 | */ | 646 | */ |
647 | void | 647 | void |
648 | nlmsvc_grant_reply(struct nlm_cookie *cookie, u32 status) | 648 | nlmsvc_grant_reply(struct nlm_cookie *cookie, __be32 status) |
649 | { | 649 | { |
650 | struct nlm_block *block; | 650 | struct nlm_block *block; |
651 | 651 | ||
@@ -655,7 +655,7 @@ nlmsvc_grant_reply(struct nlm_cookie *cookie, u32 status) | |||
655 | return; | 655 | return; |
656 | 656 | ||
657 | if (block) { | 657 | if (block) { |
658 | if (status == NLM_LCK_DENIED_GRACE_PERIOD) { | 658 | if (status == nlm_lck_denied_grace_period) { |
659 | /* Try again in a couple of seconds */ | 659 | /* Try again in a couple of seconds */ |
660 | nlmsvc_insert_block(block, 10 * HZ); | 660 | nlmsvc_insert_block(block, 10 * HZ); |
661 | } else { | 661 | } else { |
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c index b7c949256e5a..34dae5d70738 100644 --- a/fs/lockd/xdr.c +++ b/fs/lockd/xdr.c | |||
@@ -361,7 +361,7 @@ nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) | |||
361 | { | 361 | { |
362 | if (!(p = nlm_decode_cookie(p, &resp->cookie))) | 362 | if (!(p = nlm_decode_cookie(p, &resp->cookie))) |
363 | return 0; | 363 | return 0; |
364 | resp->status = ntohl(*p++); | 364 | resp->status = *p++; |
365 | return xdr_argsize_check(rqstp, p); | 365 | return xdr_argsize_check(rqstp, p); |
366 | } | 366 | } |
367 | 367 | ||
@@ -407,8 +407,8 @@ nlmclt_decode_testres(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp) | |||
407 | { | 407 | { |
408 | if (!(p = nlm_decode_cookie(p, &resp->cookie))) | 408 | if (!(p = nlm_decode_cookie(p, &resp->cookie))) |
409 | return -EIO; | 409 | return -EIO; |
410 | resp->status = ntohl(*p++); | 410 | resp->status = *p++; |
411 | if (resp->status == NLM_LCK_DENIED) { | 411 | if (resp->status == nlm_lck_denied) { |
412 | struct file_lock *fl = &resp->lock.fl; | 412 | struct file_lock *fl = &resp->lock.fl; |
413 | u32 excl; | 413 | u32 excl; |
414 | s32 start, len, end; | 414 | s32 start, len, end; |
@@ -506,7 +506,7 @@ nlmclt_decode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp) | |||
506 | { | 506 | { |
507 | if (!(p = nlm_decode_cookie(p, &resp->cookie))) | 507 | if (!(p = nlm_decode_cookie(p, &resp->cookie))) |
508 | return -EIO; | 508 | return -EIO; |
509 | resp->status = ntohl(*p++); | 509 | resp->status = *p++; |
510 | return 0; | 510 | return 0; |
511 | } | 511 | } |
512 | 512 | ||
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c index f4c0b2b9f75a..a78240551219 100644 --- a/fs/lockd/xdr4.c +++ b/fs/lockd/xdr4.c | |||
@@ -367,7 +367,7 @@ nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp) | |||
367 | { | 367 | { |
368 | if (!(p = nlm4_decode_cookie(p, &resp->cookie))) | 368 | if (!(p = nlm4_decode_cookie(p, &resp->cookie))) |
369 | return 0; | 369 | return 0; |
370 | resp->status = ntohl(*p++); | 370 | resp->status = *p++; |
371 | return xdr_argsize_check(rqstp, p); | 371 | return xdr_argsize_check(rqstp, p); |
372 | } | 372 | } |
373 | 373 | ||
@@ -413,8 +413,8 @@ nlm4clt_decode_testres(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp) | |||
413 | { | 413 | { |
414 | if (!(p = nlm4_decode_cookie(p, &resp->cookie))) | 414 | if (!(p = nlm4_decode_cookie(p, &resp->cookie))) |
415 | return -EIO; | 415 | return -EIO; |
416 | resp->status = ntohl(*p++); | 416 | resp->status = *p++; |
417 | if (resp->status == NLM_LCK_DENIED) { | 417 | if (resp->status == nlm_lck_denied) { |
418 | struct file_lock *fl = &resp->lock.fl; | 418 | struct file_lock *fl = &resp->lock.fl; |
419 | u32 excl; | 419 | u32 excl; |
420 | s64 start, end, len; | 420 | s64 start, end, len; |
@@ -512,7 +512,7 @@ nlm4clt_decode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp) | |||
512 | { | 512 | { |
513 | if (!(p = nlm4_decode_cookie(p, &resp->cookie))) | 513 | if (!(p = nlm4_decode_cookie(p, &resp->cookie))) |
514 | return -EIO; | 514 | return -EIO; |
515 | resp->status = ntohl(*p++); | 515 | resp->status = *p++; |
516 | return 0; | 516 | return 0; |
517 | } | 517 | } |
518 | 518 | ||