public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
To: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
Cc: OpenFabrics
	<general-ZwoEplunGu1OwGhvXhtEPSCwEArCW2h5@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH] infiniband-diags/ibqueryerrors: simplify node_type_to_print setup.
Date: Tue, 29 Sep 2009 17:49:58 +0200	[thread overview]
Message-ID: <20090929154958.GC9465@me> (raw)
In-Reply-To: <20090923150923.a5281107.weiny2-i2BcT+NCU+M@public.gmane.org>


Siplify node_type_to_print setup.

Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
 infiniband-diags/src/ibqueryerrors.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/infiniband-diags/src/ibqueryerrors.c b/infiniband-diags/src/ibqueryerrors.c
index 8a3c236..e67d338 100644
--- a/infiniband-diags/src/ibqueryerrors.c
+++ b/infiniband-diags/src/ibqueryerrors.c
@@ -64,12 +64,12 @@ char *node_guid_str = NULL;
 int sup_total = 0;
 enum MAD_FIELDS *suppressed_fields = NULL;
 char *dr_path = NULL;
+uint8_t node_type_to_print = 0;
 
-#define PRINT_ALL 0xFF /* all nodes default flag */
-uint8_t node_type_to_print = PRINT_ALL;
 #define PRINT_SWITCH 0x1
 #define PRINT_CA     0x2
 #define PRINT_ROUTER 0x4
+#define PRINT_ALL 0xFF /* all nodes default flag */
 
 static unsigned int get_max(unsigned int num)
 {
@@ -379,18 +379,12 @@ static int process_opt(void *context, int ch, char *optarg)
 		data_counters++;
 		break;
 	case 3:
-		if (node_type_to_print == PRINT_ALL)
-			node_type_to_print = 0;
 		node_type_to_print |= PRINT_SWITCH;
 		break;
 	case 4:
-		if (node_type_to_print == PRINT_ALL)
-			node_type_to_print = 0;
 		node_type_to_print |= PRINT_CA;
 		break;
 	case 5:
-		if (node_type_to_print == PRINT_ALL)
-			node_type_to_print = 0;
 		node_type_to_print |= PRINT_ROUTER;
 		break;
 	case 'G':
@@ -453,6 +447,9 @@ int main(int argc, char **argv)
 	argc -= optind;
 	argv += optind;
 
+	if (!node_type_to_print)
+		node_type_to_print = PRINT_ALL;
+
 	if (ibverbose)
 		ibnd_debug(1);
 
-- 
1.6.5.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2009-09-29 15:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-23 22:09 [PATCH] infiniband-diags/src/ibqueryerrors.c: Remove --all option and replace it with --switch, --ca, --router Ira Weiny
     [not found] ` <20090923150923.a5281107.weiny2-i2BcT+NCU+M@public.gmane.org>
2009-09-29 15:49   ` Sasha Khapyorsky
2009-09-29 17:46     ` Ira Weiny
2009-09-29 15:49   ` Sasha Khapyorsky [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=20090929154958.GC9465@me \
    --to=sashak-smomgflxvozwk0htik3j/w@public.gmane.org \
    --cc=general-ZwoEplunGu1OwGhvXhtEPSCwEArCW2h5@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=weiny2-i2BcT+NCU+M@public.gmane.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