diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-05-11 09:45:11 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-05-31 20:29:46 -0400 |
commit | 5ae037e599de5a97eb6ae1054db2fdfbfbac65b5 (patch) | |
tree | a8fd1d7db096c4479e5582b64a0227c56751ce4b /fs/nfsd | |
parent | f07ea10dc8f20dfc215b15b012741fcf9f5aa17b (diff) |
nfsd: consolidate set_access and set_deny
These functions are identical. Also, rename them to bmap_to_share_mode
to better reflect what they do, and have them just return the result
instead of passing in a pointer to the storage location.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 91aec738e8fd..8034c2b67a2a 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -448,34 +448,24 @@ static struct list_head close_lru; | |||
448 | * | 448 | * |
449 | * which we should reject. | 449 | * which we should reject. |
450 | */ | 450 | */ |
451 | static void | 451 | static unsigned int |
452 | set_access(unsigned int *access, unsigned long bmap) { | 452 | bmap_to_share_mode(unsigned long bmap) { |
453 | int i; | 453 | int i; |
454 | unsigned int access = 0; | ||
454 | 455 | ||
455 | *access = 0; | ||
456 | for (i = 1; i < 4; i++) { | 456 | for (i = 1; i < 4; i++) { |
457 | if (test_bit(i, &bmap)) | 457 | if (test_bit(i, &bmap)) |
458 | *access |= i; | 458 | access |= i; |
459 | } | ||
460 | } | ||
461 | |||
462 | static void | ||
463 | set_deny(unsigned int *deny, unsigned long bmap) { | ||
464 | int i; | ||
465 | |||
466 | *deny = 0; | ||
467 | for (i = 0; i < 4; i++) { | ||
468 | if (test_bit(i, &bmap)) | ||
469 | *deny |= i ; | ||
470 | } | 459 | } |
460 | return access; | ||
471 | } | 461 | } |
472 | 462 | ||
473 | static int | 463 | static int |
474 | test_share(struct nfs4_ol_stateid *stp, struct nfsd4_open *open) { | 464 | test_share(struct nfs4_ol_stateid *stp, struct nfsd4_open *open) { |
475 | unsigned int access, deny; | 465 | unsigned int access, deny; |
476 | 466 | ||
477 | set_access(&access, stp->st_access_bmap); | 467 | access = bmap_to_share_mode(stp->st_access_bmap); |
478 | set_deny(&deny, stp->st_deny_bmap); | 468 | deny = bmap_to_share_mode(stp->st_deny_bmap); |
479 | if ((access & open->op_share_deny) || (deny & open->op_share_access)) | 469 | if ((access & open->op_share_deny) || (deny & open->op_share_access)) |
480 | return 0; | 470 | return 0; |
481 | return 1; | 471 | return 1; |