All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Meyer <thomas@m3y3r.de>
To: bfields@fieldses.org, jlayton@poochiereds.net,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] nfsd: Fix bool initialization/comparison
Date: Sat, 07 Oct 2017 16:02:21 +0200	[thread overview]
Message-ID: <1507383097084-1148425660-11-diffsplit-thomas@m3y3r.de> (raw)
In-Reply-To: <1507383097081-778026979-0-diffsplit-thomas@m3y3r.de>

Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -230,7 +230,7 @@ do_open_lookup(struct svc_rqst *rqstp, s
 	if (!*resfh)
 		return nfserr_jukebox;
 	fh_init(*resfh, NFS4_FHSIZE);
-	open->op_truncate = 0;
+	open->op_truncate = false;
 
 	if (open->op_create) {
 		/* FIXME: check session persistence and pnfs flags.
@@ -360,7 +360,7 @@ nfsd4_open(struct svc_rqst *rqstp, struc
 	if (open->op_create && open->op_claim_type != NFS4_OPEN_CLAIM_NULL)
 		return nfserr_inval;
 
-	open->op_created = 0;
+	open->op_created = false;
 	/*
 	 * RFC5661 18.51.3
 	 * Before RECLAIM_COMPLETE done, server should deny new lock
@@ -1108,8 +1108,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struc
 	else {
 		copy->cp_res.wr_bytes_written = bytes;
 		copy->cp_res.wr_stable_how = NFS_UNSTABLE;
-		copy->cp_consecutive = 1;
-		copy->cp_synchronous = 1;
+		copy->cp_consecutive = true;
+		copy->cp_synchronous = true;
 		gen_boot_verifier(&copy->cp_res.wr_verifier, SVC_NET(rqstp));
 		status = nfs_ok;
 	}
@@ -2476,7 +2476,7 @@ bool nfsd4_spo_must_allow(struct svc_rqs
 	if (!cstate->minorversion)
 		return false;
 
-	if (cstate->spo_must_allowed == true)
+	if (cstate->spo_must_allowed)
 		return true;
 
 	opiter = resp->opcnt;
diff -u -p a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -292,7 +292,7 @@ static int nfsd_startup_net(int nrservs,
 		ret = lockd_up(net);
 		if (ret)
 			goto out_socks;
-		nn->lockd_up = 1;
+		nn->lockd_up = true;
 	}
 
 	ret = nfs4_state_start_net(net);
@@ -305,7 +305,7 @@ static int nfsd_startup_net(int nrservs,
 out_lockd:
 	if (nn->lockd_up) {
 		lockd_down(net);
-		nn->lockd_up = 0;
+		nn->lockd_up = false;
 	}
 out_socks:
 	nfsd_shutdown_generic();
@@ -319,7 +319,7 @@ static void nfsd_shutdown_net(struct net
 	nfs4_state_shutdown_net(net);
 	if (nn->lockd_up) {
 		lockd_down(net);
-		nn->lockd_up = 0;
+		nn->lockd_up = false;
 	}
 	nn->nfsd_net_up = false;
 	nfsd_shutdown_generic();
diff -u -p a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1379,7 +1379,7 @@ do_nfsd_create(struct svc_rqst *rqstp, s
 			    && d_inode(dchild)->i_atime.tv_sec == v_atime
 			    && d_inode(dchild)->i_size  == 0 ) {
 				if (created)
-					*created = 1;
+					*created = true;
 				break;
 			}
 		case NFS4_CREATE_EXCLUSIVE4_1:
@@ -1387,7 +1387,7 @@ do_nfsd_create(struct svc_rqst *rqstp, s
 			    && d_inode(dchild)->i_atime.tv_sec == v_atime
 			    && d_inode(dchild)->i_size  == 0 ) {
 				if (created)
-					*created = 1;
+					*created = true;
 				goto set_attr;
 			}
 			 /* fallthru */
@@ -1404,7 +1404,7 @@ do_nfsd_create(struct svc_rqst *rqstp, s
 		goto out_nfserr;
 	}
 	if (created)
-		*created = 1;
+		*created = true;
 
 	nfsd_check_ignore_resizing(iap);
 

  parent reply	other threads:[~2017-10-07 14:26 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-07 14:02 Cocci spatch "boolinit" - v4.14-rc1 Thomas Meyer
2017-10-07 14:02 ` [PATCH] f2fs: Fix bool initialization/comparison Thomas Meyer
2017-10-07 14:02   ` Thomas Meyer
2017-10-07 14:33   ` [f2fs-dev] " Ju Hyung Park
2017-10-07 19:30     ` Joe Perches
2017-10-09  1:48       ` Chao Yu
2017-10-09  1:48         ` Chao Yu
2017-10-10 17:41         ` Jaegeuk Kim
2017-10-07 14:02 ` [PATCH] cifs: " Thomas Meyer
     [not found]   ` <1507383097083-1243109004-5-diffsplit-thomas-VsYtu1Qij5c@public.gmane.org>
2017-10-10  1:14     ` Nico Kadel-Garcia
2017-10-10  1:14       ` Nico Kadel-Garcia
2017-10-07 14:02 ` [PATCH] ima: " Thomas Meyer
2017-10-07 14:02   ` Thomas Meyer
2017-10-07 14:02 ` Thomas Meyer [this message]
2017-10-07 14:02 ` [PATCH] NFS: " Thomas Meyer
2017-10-07 14:02 ` [PATCH] pstore: " Thomas Meyer
2018-11-29 23:21   ` Kees Cook
2017-10-07 14:02 ` [PATCH] afs: " Thomas Meyer
2017-10-07 14:02 ` [PATCH] xfs: " Thomas Meyer
2017-10-09 14:24   ` Brian Foster
2017-10-07 14:02 ` [PATCH] ceph: " Thomas Meyer
2017-10-09  1:52   ` Yan, Zheng
2017-10-07 14:02 ` [PATCH] bfq: " Thomas Meyer
2017-10-07 14:02 ` [PATCH] proc: " Thomas Meyer
2017-10-07 14:02 ` [PATCH] exofs: " Thomas Meyer
2017-10-07 14:02 ` [PATCH] apparmor: " Thomas Meyer
2017-10-07 14:02   ` Thomas Meyer
2017-10-07 17:18   ` John Johansen
2017-10-07 17:18     ` John Johansen
2017-10-07 14:02 ` [PATCH] ext4: " Thomas Meyer
2017-10-07 14:02 ` [PATCH] btrfs: " Thomas Meyer
2017-10-09 16:05   ` David Sterba
2017-10-07 14:02 ` [PATCH] selinux: " Thomas Meyer
2017-10-07 14:02   ` Thomas Meyer
2017-10-10 23:17   ` Casey Schaufler
2017-10-10 23:17     ` Casey Schaufler
2017-10-10 23:19   ` Casey Schaufler
2017-10-10 23:19     ` Casey Schaufler
2017-10-13 22:40     ` Paul Moore
2017-10-13 22:40       ` Paul Moore
2017-10-07 14:02 ` [PATCH] configfs: " Thomas Meyer
2017-10-19 14:08   ` Christoph Hellwig
2017-10-10 15:19 ` [PATCH] afs: " David Howells

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=1507383097084-1148425660-11-diffsplit-thomas@m3y3r.de \
    --to=thomas@m3y3r.de \
    --cc=bfields@fieldses.org \
    --cc=jlayton@poochiereds.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.