Skip to content

Commit 8837abc

Browse files
Miklos SzerediJ. Bruce Fields
authored andcommitted
nfsd: rename MAY_ flags
Rename nfsd_permission() specific MAY_* flags to NFSD_MAY_* to make it clear, that these are not used outside nfsd, and to avoid name and number space conflicts with the VFS. [comment from hch: rename MAY_READ, MAY_WRITE and MAY_EXEC as well] Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
1 parent 599eb30 commit 8837abc

File tree

10 files changed

+105
-97
lines changed

10 files changed

+105
-97
lines changed

fs/nfsd/lockd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp)
3535
fh.fh_export = NULL;
3636

3737
exp_readlock();
38-
nfserr = nfsd_open(rqstp, &fh, S_IFREG, MAY_LOCK, filp);
38+
nfserr = nfsd_open(rqstp, &fh, S_IFREG, NFSD_MAY_LOCK, filp);
3939
fh_put(&fh);
4040
rqstp->rq_client = NULL;
4141
exp_readunlock();

fs/nfsd/nfs2acl.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp,
4040
dprintk("nfsd: GETACL(2acl) %s\n", SVCFH_fmt(&argp->fh));
4141

4242
fh = fh_copy(&resp->fh, &argp->fh);
43-
if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP)))
43+
nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
44+
if (nfserr)
4445
RETURN_STATUS(nfserr);
4546

4647
if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
@@ -107,7 +108,7 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp,
107108
dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh));
108109

109110
fh = fh_copy(&resp->fh, &argp->fh);
110-
nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR);
111+
nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR);
111112

112113
if (!nfserr) {
113114
nfserr = nfserrno( nfsd_set_posix_acl(
@@ -134,7 +135,7 @@ static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp,
134135
dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
135136

136137
fh_copy(&resp->fh, &argp->fh);
137-
return fh_verify(rqstp, &resp->fh, 0, MAY_NOP);
138+
return fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
138139
}
139140

140141
/*

fs/nfsd/nfs3acl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp,
3636
__be32 nfserr = 0;
3737

3838
fh = fh_copy(&resp->fh, &argp->fh);
39-
if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP)))
39+
nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
40+
if (nfserr)
4041
RETURN_STATUS(nfserr);
4142

4243
if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
@@ -101,7 +102,7 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp,
101102
__be32 nfserr = 0;
102103

103104
fh = fh_copy(&resp->fh, &argp->fh);
104-
nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR);
105+
nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR);
105106

106107
if (!nfserr) {
107108
nfserr = nfserrno( nfsd_set_posix_acl(

fs/nfsd/nfs3proc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
6363
SVCFH_fmt(&argp->fh));
6464

6565
fh_copy(&resp->fh, &argp->fh);
66-
nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP);
66+
nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
6767
if (nfserr)
6868
RETURN_STATUS(nfserr);
6969

@@ -242,7 +242,7 @@ nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
242242
attr = &argp->attrs;
243243

244244
/* Get the directory inode */
245-
nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, MAY_CREATE);
245+
nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, NFSD_MAY_CREATE);
246246
if (nfserr)
247247
RETURN_STATUS(nfserr);
248248

@@ -558,7 +558,7 @@ nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
558558
resp->f_maxfilesize = ~(u32) 0;
559559
resp->f_properties = NFS3_FSF_DEFAULT;
560560

561-
nfserr = fh_verify(rqstp, &argp->fh, 0, MAY_NOP);
561+
nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
562562

563563
/* Check special features of the file system. May request
564564
* different read/write sizes for file systems known to have
@@ -597,7 +597,7 @@ nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
597597
resp->p_case_insensitive = 0;
598598
resp->p_case_preserving = 1;
599599

600-
nfserr = fh_verify(rqstp, &argp->fh, 0, MAY_NOP);
600+
nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
601601

602602
if (nfserr == 0) {
603603
struct super_block *sb = argp->fh.fh_dentry->d_inode->i_sb;

fs/nfsd/nfs4proc.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs
7171
return nfserr_inval;
7272

7373
if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
74-
accmode |= MAY_READ;
74+
accmode |= NFSD_MAY_READ;
7575
if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
76-
accmode |= (MAY_WRITE | MAY_TRUNC);
76+
accmode |= (NFSD_MAY_WRITE | NFSD_MAY_TRUNC);
7777
if (open->op_share_deny & NFS4_SHARE_DENY_WRITE)
78-
accmode |= MAY_WRITE;
78+
accmode |= NFSD_MAY_WRITE;
7979

8080
status = fh_verify(rqstp, current_fh, S_IFREG, accmode);
8181

@@ -126,7 +126,8 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
126126
&resfh.fh_handle.fh_base, resfh.fh_handle.fh_size);
127127

128128
if (!created)
129-
status = do_open_permission(rqstp, current_fh, open, MAY_NOP);
129+
status = do_open_permission(rqstp, current_fh, open,
130+
NFSD_MAY_NOP);
130131

131132
out:
132133
fh_put(&resfh);
@@ -157,7 +158,8 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
157158
open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) &&
158159
(open->op_iattr.ia_size == 0);
159160

160-
status = do_open_permission(rqstp, current_fh, open, MAY_OWNER_OVERRIDE);
161+
status = do_open_permission(rqstp, current_fh, open,
162+
NFSD_MAY_OWNER_OVERRIDE);
161163

162164
return status;
163165
}
@@ -186,7 +188,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
186188
cstate->current_fh.fh_handle.fh_size = rp->rp_openfh_len;
187189
memcpy(&cstate->current_fh.fh_handle.fh_base, rp->rp_openfh,
188190
rp->rp_openfh_len);
189-
status = fh_verify(rqstp, &cstate->current_fh, 0, MAY_NOP);
191+
status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
190192
if (status)
191193
dprintk("nfsd4_open: replay failed"
192194
" restoring previous filehandle\n");
@@ -285,7 +287,7 @@ nfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
285287
cstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen;
286288
memcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval,
287289
putfh->pf_fhlen);
288-
return fh_verify(rqstp, &cstate->current_fh, 0, MAY_NOP);
290+
return fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
289291
}
290292

291293
static __be32
@@ -363,7 +365,8 @@ nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
363365

364366
fh_init(&resfh, NFS4_FHSIZE);
365367

366-
status = fh_verify(rqstp, &cstate->current_fh, S_IFDIR, MAY_CREATE);
368+
status = fh_verify(rqstp, &cstate->current_fh, S_IFDIR,
369+
NFSD_MAY_CREATE);
367370
if (status == nfserr_symlink)
368371
status = nfserr_notdir;
369372
if (status)
@@ -445,7 +448,7 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
445448
{
446449
__be32 status;
447450

448-
status = fh_verify(rqstp, &cstate->current_fh, 0, MAY_NOP);
451+
status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
449452
if (status)
450453
return status;
451454

@@ -730,7 +733,7 @@ _nfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
730733
int count;
731734
__be32 status;
732735

733-
status = fh_verify(rqstp, &cstate->current_fh, 0, MAY_NOP);
736+
status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
734737
if (status)
735738
return status;
736739

fs/nfsd/nfs4state.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,9 +1722,9 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
17221722
/* Stateid was not found, this is a new OPEN */
17231723
int flags = 0;
17241724
if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
1725-
flags |= MAY_READ;
1725+
flags |= NFSD_MAY_READ;
17261726
if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
1727-
flags |= MAY_WRITE;
1727+
flags |= NFSD_MAY_WRITE;
17281728
status = nfs4_new_open(rqstp, &stp, dp, current_fh, flags);
17291729
if (status)
17301730
goto out;
@@ -2610,7 +2610,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
26102610
return nfserr_inval;
26112611

26122612
if ((status = fh_verify(rqstp, &cstate->current_fh,
2613-
S_IFREG, MAY_LOCK))) {
2613+
S_IFREG, NFSD_MAY_LOCK))) {
26142614
dprintk("NFSD: nfsd4_lock: permission denied!\n");
26152615
return status;
26162616
}

fs/nfsd/nfsfh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
279279
if (error)
280280
goto out;
281281

282-
if (!(access & MAY_LOCK)) {
282+
if (!(access & NFSD_MAY_LOCK)) {
283283
/*
284284
* pseudoflavor restrictions are not enforced on NLM,
285285
* which clients virtually always use auth_sys for,

fs/nfsd/nfsproc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
6565
dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh));
6666

6767
fh_copy(&resp->fh, &argp->fh);
68-
nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP);
68+
nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
6969
return nfsd_return_attrs(nfserr, resp);
7070
}
7171

@@ -215,11 +215,11 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
215215
SVCFH_fmt(dirfhp), argp->len, argp->name);
216216

217217
/* First verify the parent file handle */
218-
nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, MAY_EXEC);
218+
nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, NFSD_MAY_EXEC);
219219
if (nfserr)
220220
goto done; /* must fh_put dirfhp even on error */
221221

222-
/* Check for MAY_WRITE in nfsd_create if necessary */
222+
/* Check for NFSD_MAY_WRITE in nfsd_create if necessary */
223223

224224
nfserr = nfserr_acces;
225225
if (!argp->len)
@@ -281,7 +281,7 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp,
281281
nfserr = nfsd_permission(rqstp,
282282
newfhp->fh_export,
283283
newfhp->fh_dentry,
284-
MAY_WRITE|MAY_LOCAL_ACCESS);
284+
NFSD_MAY_WRITE|NFSD_MAY_LOCAL_ACCESS);
285285
if (nfserr && nfserr != nfserr_rofs)
286286
goto out_unlock;
287287
}

0 commit comments

Comments
 (0)