Skip to content

Commit

Permalink
knfsd: clean up EX_RDONLY
Browse files Browse the repository at this point in the history
Share a little common code, reverse the arguments for consistency, drop the
unnecessary "inline", and lowercase the name.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Acked-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
J. Bruce Fields authored and Linus Torvalds committed Jul 19, 2007
1 parent e22841c commit c7d5140
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
3 changes: 2 additions & 1 deletion fs/nfsd/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
#include <linux/sunrpc/svc.h>
#include <linux/sunrpc/svcauth.h>
#include <linux/nfsd/nfsd.h>
#include <linux/nfsd/export.h>

#define CAP_NFSD_MASK (CAP_FS_MASK|CAP_TO_MASK(CAP_SYS_RESOURCE))

static int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp)
int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp)
{
struct exp_flavor_info *f;
struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors;
Expand Down
13 changes: 3 additions & 10 deletions fs/nfsd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1797,16 +1797,9 @@ nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat)
return err;
}

static inline int EX_RDONLY(struct svc_export *exp, struct svc_rqst *rqstp)
static int exp_rdonly(struct svc_rqst *rqstp, struct svc_export *exp)
{
struct exp_flavor_info *f;
struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors;

for (f = exp->ex_flavors; f < end; f++) {
if (f->pseudoflavor == rqstp->rq_flavor)
return f->flags & NFSEXP_READONLY;
}
return exp->ex_flags & NFSEXP_READONLY;
return nfsexp_flags(rqstp, exp) & NFSEXP_READONLY;
}

/*
Expand Down Expand Up @@ -1845,7 +1838,7 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp,
*/
if (!(acc & MAY_LOCAL_ACCESS))
if (acc & (MAY_WRITE | MAY_SATTR | MAY_TRUNC)) {
if (EX_RDONLY(exp, rqstp) || IS_RDONLY(inode))
if (exp_rdonly(rqstp, exp) || IS_RDONLY(inode))
return nfserr_rofs;
if (/* (acc & MAY_WRITE) && */ IS_IMMUTABLE(inode))
return nfserr_perm;
Expand Down
1 change: 1 addition & 0 deletions include/linux/nfsd/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ struct svc_expkey {
#define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE)
#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES)

int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp);
__be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);

/*
Expand Down

0 comments on commit c7d5140

Please sign in to comment.