Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8837abca authored by Miklos Szeredi's avatar Miklos Szeredi Committed by J. Bruce Fields
Browse files

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: default avatarMiklos Szeredi <mszeredi@suse.cz>
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 599eb304
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -35,7 +35,7 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp)
	fh.fh_export = NULL;
	fh.fh_export = NULL;


	exp_readlock();
	exp_readlock();
	nfserr = nfsd_open(rqstp, &fh, S_IFREG, MAY_LOCK, filp);
	nfserr = nfsd_open(rqstp, &fh, S_IFREG, NFSD_MAY_LOCK, filp);
	fh_put(&fh);
	fh_put(&fh);
	rqstp->rq_client = NULL;
	rqstp->rq_client = NULL;
	exp_readunlock();
	exp_readunlock();
+4 −3
Original line number Original line Diff line number Diff line
@@ -40,7 +40,8 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp,
	dprintk("nfsd: GETACL(2acl)   %s\n", SVCFH_fmt(&argp->fh));
	dprintk("nfsd: GETACL(2acl)   %s\n", SVCFH_fmt(&argp->fh));


	fh = fh_copy(&resp->fh, &argp->fh);
	fh = fh_copy(&resp->fh, &argp->fh);
	if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP)))
	nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
	if (nfserr)
		RETURN_STATUS(nfserr);
		RETURN_STATUS(nfserr);


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


	fh = fh_copy(&resp->fh, &argp->fh);
	fh = fh_copy(&resp->fh, &argp->fh);
	nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR);
	nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR);


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


	fh_copy(&resp->fh, &argp->fh);
	fh_copy(&resp->fh, &argp->fh);
	return fh_verify(rqstp, &resp->fh, 0, MAY_NOP);
	return fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
}
}


/*
/*
+3 −2
Original line number Original line Diff line number Diff line
@@ -36,7 +36,8 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp,
	__be32 nfserr = 0;
	__be32 nfserr = 0;


	fh = fh_copy(&resp->fh, &argp->fh);
	fh = fh_copy(&resp->fh, &argp->fh);
	if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP)))
	nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
	if (nfserr)
		RETURN_STATUS(nfserr);
		RETURN_STATUS(nfserr);


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


	fh = fh_copy(&resp->fh, &argp->fh);
	fh = fh_copy(&resp->fh, &argp->fh);
	nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR);
	nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR);


	if (!nfserr) {
	if (!nfserr) {
		nfserr = nfserrno( nfsd_set_posix_acl(
		nfserr = nfserrno( nfsd_set_posix_acl(
+4 −4
Original line number Original line Diff line number Diff line
@@ -63,7 +63,7 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
		SVCFH_fmt(&argp->fh));
		SVCFH_fmt(&argp->fh));


	fh_copy(&resp->fh, &argp->fh);
	fh_copy(&resp->fh, &argp->fh);
	nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP);
	nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
	if (nfserr)
	if (nfserr)
		RETURN_STATUS(nfserr);
		RETURN_STATUS(nfserr);


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


	/* Get the directory inode */
	/* Get the directory inode */
	nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, MAY_CREATE);
	nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, NFSD_MAY_CREATE);
	if (nfserr)
	if (nfserr)
		RETURN_STATUS(nfserr);
		RETURN_STATUS(nfserr);


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


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


	/* Check special features of the file system. May request
	/* Check special features of the file system. May request
	 * different read/write sizes for file systems known to have
	 * 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,
	resp->p_case_insensitive = 0;
	resp->p_case_insensitive = 0;
	resp->p_case_preserving = 1;
	resp->p_case_preserving = 1;


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


	if (nfserr == 0) {
	if (nfserr == 0) {
		struct super_block *sb = argp->fh.fh_dentry->d_inode->i_sb;
		struct super_block *sb = argp->fh.fh_dentry->d_inode->i_sb;
+13 −10
Original line number Original line Diff line number Diff line
@@ -71,11 +71,11 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs
		return nfserr_inval;
		return nfserr_inval;


	if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
	if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
		accmode |= MAY_READ;
		accmode |= NFSD_MAY_READ;
	if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
	if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
		accmode |= (MAY_WRITE | MAY_TRUNC);
		accmode |= (NFSD_MAY_WRITE | NFSD_MAY_TRUNC);
	if (open->op_share_deny & NFS4_SHARE_DENY_WRITE)
	if (open->op_share_deny & NFS4_SHARE_DENY_WRITE)
		accmode |= MAY_WRITE;
		accmode |= NFSD_MAY_WRITE;


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


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


	if (!created)
	if (!created)
		status = do_open_permission(rqstp, current_fh, open, MAY_NOP);
		status = do_open_permission(rqstp, current_fh, open,
					    NFSD_MAY_NOP);


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


	status = do_open_permission(rqstp, current_fh, open, MAY_OWNER_OVERRIDE);
	status = do_open_permission(rqstp, current_fh, open,
				    NFSD_MAY_OWNER_OVERRIDE);


	return status;
	return status;
}
}
@@ -186,7 +188,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
		cstate->current_fh.fh_handle.fh_size = rp->rp_openfh_len;
		cstate->current_fh.fh_handle.fh_size = rp->rp_openfh_len;
		memcpy(&cstate->current_fh.fh_handle.fh_base, rp->rp_openfh,
		memcpy(&cstate->current_fh.fh_handle.fh_base, rp->rp_openfh,
				rp->rp_openfh_len);
				rp->rp_openfh_len);
		status = fh_verify(rqstp, &cstate->current_fh, 0, MAY_NOP);
		status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
		if (status)
		if (status)
			dprintk("nfsd4_open: replay failed"
			dprintk("nfsd4_open: replay failed"
				" restoring previous filehandle\n");
				" restoring previous filehandle\n");
@@ -285,7 +287,7 @@ nfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
	cstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen;
	cstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen;
	memcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval,
	memcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval,
	       putfh->pf_fhlen);
	       putfh->pf_fhlen);
	return fh_verify(rqstp, &cstate->current_fh, 0, MAY_NOP);
	return fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
}
}


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


	fh_init(&resfh, NFS4_FHSIZE);
	fh_init(&resfh, NFS4_FHSIZE);


	status = fh_verify(rqstp, &cstate->current_fh, S_IFDIR, MAY_CREATE);
	status = fh_verify(rqstp, &cstate->current_fh, S_IFDIR,
			   NFSD_MAY_CREATE);
	if (status == nfserr_symlink)
	if (status == nfserr_symlink)
		status = nfserr_notdir;
		status = nfserr_notdir;
	if (status)
	if (status)
@@ -445,7 +448,7 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
{
{
	__be32 status;
	__be32 status;


	status = fh_verify(rqstp, &cstate->current_fh, 0, MAY_NOP);
	status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
	if (status)
	if (status)
		return status;
		return status;


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


	status = fh_verify(rqstp, &cstate->current_fh, 0, MAY_NOP);
	status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP);
	if (status)
	if (status)
		return status;
		return status;


Loading