linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhilong Liu <zlliu@suse.com>
To: Jes.Sorensen@gmail.com
Cc: linux-raid@vger.kernel.org, Zhilong Liu <zlliu@suse.com>
Subject: [PATCH 2/3] mdadm/mdstat: fixup a number of '==' broken formatting
Date: Mon,  9 Oct 2017 16:21:13 +0800	[thread overview]
Message-ID: <1507537274-29350-3-git-send-email-zlliu@suse.com> (raw)
In-Reply-To: <1507537274-29350-1-git-send-email-zlliu@suse.com>

This commit doesn't change any codes, just tidy up the
code formatting.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
---
 mdstat.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/mdstat.c b/mdstat.c
index 0d44050..6c906a7 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -158,11 +158,11 @@ struct mdstat_ent *mdstat_read(int hold, int start)
 		char devnm[32];
 		int in_devs = 0;
 
-		if (strcmp(line, "Personalities")==0)
+		if (strcmp(line, "Personalities") == 0)
 			continue;
-		if (strcmp(line, "read_ahead")==0)
+		if (strcmp(line, "read_ahead") == 0)
 			continue;
-		if (strcmp(line, "unused")==0)
+		if (strcmp(line, "unused") == 0)
 			continue;
 		insert_here = NULL;
 		/* Better be an md line.. */
@@ -187,9 +187,9 @@ struct mdstat_ent *mdstat_read(int hold, int start)
 		for (w=dl_next(line); w!= line ; w=dl_next(w)) {
 			int l = strlen(w);
 			char *eq;
-			if (strcmp(w, "active")==0)
+			if (strcmp(w, "active") == 0)
 				ent->active = 1;
-			else if (strcmp(w, "inactive")==0) {
+			else if (strcmp(w, "inactive") == 0) {
 				ent->active = 0;
 				in_devs = 1;
 			} else if (ent->active > 0 &&
@@ -197,13 +197,13 @@ struct mdstat_ent *mdstat_read(int hold, int start)
 				 w[0] != '(' /*readonly*/) {
 				ent->level = xstrdup(w);
 				in_devs = 1;
-			} else if (in_devs && strcmp(w, "blocks")==0)
+			} else if (in_devs && strcmp(w, "blocks") == 0)
 				in_devs = 0;
 			else if (in_devs) {
 				char *ep = strchr(w, '[');
 				ent->devcnt +=
 					add_member_devname(&ent->members, w);
-				if (ep && strncmp(w, "md", 2)==0) {
+				if (ep && strncmp(w, "md", 2) == 0) {
 					/* This has an md device as a component.
 					 * If that device is already in the
 					 * list, make sure we insert before
@@ -226,31 +226,31 @@ struct mdstat_ent *mdstat_read(int hold, int start)
 			} else if (w[0] == '[' && isdigit(w[1])) {
 				ent->raid_disks = atoi(w+1);
 			} else if (!ent->pattern &&
-				 w[0] == '[' &&
-				 (w[1] == 'U' || w[1] == '_')) {
+				   w[0] == '[' &&
+				   (w[1] == 'U' || w[1] == '_')) {
 				ent->pattern = xstrdup(w+1);
-				if (ent->pattern[l-2]==']')
+				if (ent->pattern[l-2] == ']')
 					ent->pattern[l-2] = '\0';
 			} else if (ent->percent == RESYNC_NONE &&
-				   strncmp(w, "re", 2)== 0 &&
+				   strncmp(w, "re", 2) == 0 &&
 				   w[l-1] == '%' &&
-				   (eq=strchr(w, '=')) != NULL ) {
+				   (eq = strchr(w, '=')) != NULL ) {
 				ent->percent = atoi(eq+1);
-				if (strncmp(w,"resync", 6)==0)
+				if (strncmp(w,"resync", 6) == 0)
 					ent->resync = 1;
-				else if (strncmp(w, "reshape", 7)==0)
+				else if (strncmp(w, "reshape", 7) == 0)
 					ent->resync = 2;
 				else
 					ent->resync = 0;
 			} else if (ent->percent == RESYNC_NONE &&
 				   (w[0] == 'r' || w[0] == 'c')) {
-				if (strncmp(w, "resync", 4)==0)
+				if (strncmp(w, "resync", 4) == 0)
 					ent->resync = 1;
-				if (strncmp(w, "reshape", 7)==0)
+				if (strncmp(w, "reshape", 7) == 0)
 					ent->resync = 2;
-				if (strncmp(w, "recovery", 8)==0)
+				if (strncmp(w, "recovery", 8) == 0)
 					ent->resync = 0;
-				if (strncmp(w, "check", 5)==0)
+				if (strncmp(w, "check", 5) == 0)
 					ent->resync = 3;
 
 				if (l > 8 && strcmp(w+l-8, "=DELAYED") == 0)
@@ -289,7 +289,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
 			e->next = rv;
 			rv = e;
 		}
-	} else rv = all;
+	} else
+		rv = all;
 	return rv;
 }
 
-- 
2.6.6


  parent reply	other threads:[~2017-10-09  8:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09  8:21 [mdadm PATCH 0/3] fixed broken level conversion and one strncmp issue Zhilong Liu
2017-10-09  8:21 ` [PATCH 1/3] mdadm/Grow: fix the broken raid level conversion Zhilong Liu
2017-10-09 10:49   ` NeilBrown
2017-10-10  8:46     ` Zhilong Liu
2017-10-10 20:31       ` NeilBrown
2017-10-11  8:53   ` [PATCH v2] mdadm/grow: adding a test to ensure resize was required Zhilong Liu
2017-10-11 17:31     ` Jes Sorensen
2017-10-12 10:55       ` Majchrzak, Tomasz
2017-10-23 16:43         ` Jes Sorensen
2017-10-24  6:21           ` Zhilong Liu
2017-11-22 10:07             ` Tomasz Majchrzak
2017-10-18  8:01       ` Zhilong Liu
2017-10-11 19:44     ` John Stoffel
2017-10-12  3:25       ` Zhilong Liu
2017-10-23  9:13     ` [PATCH v3] " Zhilong Liu
2017-10-09  8:21 ` Zhilong Liu [this message]
2017-10-10 20:37   ` [PATCH 2/3] mdadm/mdstat: fixup a number of '==' broken formatting Jes Sorensen
2017-10-09  8:21 ` [PATCH 3/3] mdadm/mdstat: correct the strncmp number 4 as 6 Zhilong Liu
2017-10-10 20:38   ` Jes Sorensen

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=1507537274-29350-3-git-send-email-zlliu@suse.com \
    --to=zlliu@suse.com \
    --cc=Jes.Sorensen@gmail.com \
    --cc=linux-raid@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;
as well as URLs for NNTP newsgroup(s).