Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309836
b: refs/heads/master
c: 5ae037e
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Layton authored and J. Bruce Fields committed Jun 1, 2012
1 parent 01f3422 commit d66172d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f07ea10dc8f20dfc215b15b012741fcf9f5aa17b
refs/heads/master: 5ae037e599de5a97eb6ae1054db2fdfbfbac65b5
24 changes: 7 additions & 17 deletions trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,34 +448,24 @@ static struct list_head close_lru;
*
* which we should reject.
*/
static void
set_access(unsigned int *access, unsigned long bmap) {
static unsigned int
bmap_to_share_mode(unsigned long bmap) {
int i;
unsigned int access = 0;

*access = 0;
for (i = 1; i < 4; i++) {
if (test_bit(i, &bmap))
*access |= i;
}
}

static void
set_deny(unsigned int *deny, unsigned long bmap) {
int i;

*deny = 0;
for (i = 0; i < 4; i++) {
if (test_bit(i, &bmap))
*deny |= i ;
access |= i;
}
return access;
}

static int
test_share(struct nfs4_ol_stateid *stp, struct nfsd4_open *open) {
unsigned int access, deny;

set_access(&access, stp->st_access_bmap);
set_deny(&deny, stp->st_deny_bmap);
access = bmap_to_share_mode(stp->st_access_bmap);
deny = bmap_to_share_mode(stp->st_deny_bmap);
if ((access & open->op_share_deny) || (deny & open->op_share_access))
return 0;
return 1;
Expand Down

0 comments on commit d66172d

Please sign in to comment.