提交 5ae037e5 编写于 作者: J Jeff Layton 提交者: J. Bruce Fields

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: NJeff Layton <jlayton@redhat.com>
Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
上级 f07ea10d
...@@ -448,34 +448,24 @@ static struct list_head close_lru; ...@@ -448,34 +448,24 @@ static struct list_head close_lru;
* *
* which we should reject. * which we should reject.
*/ */
static void static unsigned int
set_access(unsigned int *access, unsigned long bmap) { bmap_to_share_mode(unsigned long bmap) {
int i; int i;
unsigned int access = 0;
*access = 0;
for (i = 1; i < 4; i++) { for (i = 1; i < 4; i++) {
if (test_bit(i, &bmap)) if (test_bit(i, &bmap))
*access |= i; 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 ;
} }
return access;
} }
static int static int
test_share(struct nfs4_ol_stateid *stp, struct nfsd4_open *open) { test_share(struct nfs4_ol_stateid *stp, struct nfsd4_open *open) {
unsigned int access, deny; unsigned int access, deny;
set_access(&access, stp->st_access_bmap); access = bmap_to_share_mode(stp->st_access_bmap);
set_deny(&deny, stp->st_deny_bmap); deny = bmap_to_share_mode(stp->st_deny_bmap);
if ((access & open->op_share_deny) || (deny & open->op_share_access)) if ((access & open->op_share_deny) || (deny & open->op_share_access))
return 0; return 0;
return 1; return 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册