mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chuck Lever III <chuck.lever@oracle.com>
To: Haowen Bai <baihaowen@meizu.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] SUNRPC: Return true/false (not 1/0) from bool functions
Date: Mon, 28 Mar 2022 14:14:20 +0000	[thread overview]
Message-ID: <53C50F72-581E-4BCE-8D86-9CD7DA7D2521@oracle.com> (raw)
In-Reply-To: <1648435739-3034-1-git-send-email-baihaowen@meizu.com>



> On Mar 27, 2022, at 10:48 PM, Haowen Bai <baihaowen@meizu.com> wrote:
> 
> Return boolean values ("true" or "false") instead of 1 or 0 from bool
> functions.  This fixes the following warnings from coccicheck:
> 
> ./fs/nfsd/nfs2acl.c:289:9-10: WARNING: return of 0/1 in function
> 'nfsaclsvc_encode_accessres' with return type bool
> ./fs/nfsd/nfs2acl.c:252:9-10: WARNING: return of 0/1 in function
> 'nfsaclsvc_encode_getaclres' with return type bool
> 
> Signed-off-by: Haowen Bai <baihaowen@meizu.com>
> ---
> fs/nfsd/nfs2acl.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)

Thank you, Haowen Bai. I've applied your patch to the for-rc
branch at

  https://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git

I thought I had a patch that converted the ACL XDR encoders to
return booleans, but it must have fallen through the cracks.


> diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
> index 367551b..b576080 100644
> --- a/fs/nfsd/nfs2acl.c
> +++ b/fs/nfsd/nfs2acl.c
> @@ -249,34 +249,34 @@ nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
> 	int w;
> 
> 	if (!svcxdr_encode_stat(xdr, resp->status))
> -		return 0;
> +		return false;
> 
> 	if (dentry == NULL || d_really_is_negative(dentry))
> -		return 1;
> +		return true;
> 	inode = d_inode(dentry);
> 
> 	if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
> -		return 0;
> +		return false;
> 	if (xdr_stream_encode_u32(xdr, resp->mask) < 0)
> -		return 0;
> +		return false;
> 
> 	rqstp->rq_res.page_len = w = nfsacl_size(
> 		(resp->mask & NFS_ACL)   ? resp->acl_access  : NULL,
> 		(resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
> 	while (w > 0) {
> 		if (!*(rqstp->rq_next_page++))
> -			return 1;
> +			return true;
> 		w -= PAGE_SIZE;
> 	}
> 
> 	if (!nfs_stream_encode_acl(xdr, inode, resp->acl_access,
> 				   resp->mask & NFS_ACL, 0))
> -		return 0;
> +		return false;
> 	if (!nfs_stream_encode_acl(xdr, inode, resp->acl_default,
> 				   resp->mask & NFS_DFACL, NFS_ACL_DEFAULT))
> -		return 0;
> +		return false;
> 
> -	return 1;
> +	return true;
> }
> 
> /* ACCESS */
> @@ -286,17 +286,17 @@ nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
> 	struct nfsd3_accessres *resp = rqstp->rq_resp;
> 
> 	if (!svcxdr_encode_stat(xdr, resp->status))
> -		return 0;
> +		return false;
> 	switch (resp->status) {
> 	case nfs_ok:
> 		if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat))
> -			return 0;
> +			return false;
> 		if (xdr_stream_encode_u32(xdr, resp->access) < 0)
> -			return 0;
> +			return false;
> 		break;
> 	}
> 
> -	return 1;
> +	return true;
> }
> 
> /*
> -- 
> 2.7.4
> 

--
Chuck Lever




      reply	other threads:[~2022-03-28 14:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28  2:48 Haowen Bai
2022-03-28 14:14 ` Chuck Lever III [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53C50F72-581E-4BCE-8D86-9CD7DA7D2521@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=baihaowen@meizu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®