From patchwork Tue Sep 29 15:49:58 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 50561 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8TFmC2T031585 for ; Tue, 29 Sep 2009 15:48:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752812AbZI2PsH (ORCPT ); Tue, 29 Sep 2009 11:48:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752837AbZI2PsH (ORCPT ); Tue, 29 Sep 2009 11:48:07 -0400 Received: from mail-fx0-f218.google.com ([209.85.220.218]:50528 "EHLO mail-fx0-f218.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752812AbZI2PsF (ORCPT ); Tue, 29 Sep 2009 11:48:05 -0400 Received: by fxm18 with SMTP id 18so4581632fxm.17 for ; Tue, 29 Sep 2009 08:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:date:from:to :cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=0Z1E58Bwt368PR2CVlBpC40vlxoY6yfcsB/g8wGF1Nc=; b=dCEOVWE682KLv32Ft+nHTga4A0y4Y9FkDXFLO4jlUAXV8k5n7W2oxfU9E+dfwFYmDl 07tryFUVUprkh6pE2Ayu4fVqa2XMw4wqclFjmbNIwFZYv6wHXnzO4SWCRPoHpQbCyPyc fh9+X146ne8R+Vi2Gia4rM2N0a4BuXJe5MZ0I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=GP/c1XBPGkIAtSNfZqa55cWq+7lQrmbibZWUylQ4vH6lpFbFRd+eBOo9w4CJ7n3yRC LSoTHzbrSL0JZBhWYgJ/NbC5sSXeb/fv/qQbM+D4h91kiBb0Okv7oMsaOXl5/pLHq92E FXnM/GoWBMqaOyQJgVpDbirTv8sz9ZDHmGgAo= Received: by 10.204.19.144 with SMTP id a16mr4442851bkb.9.1254239288570; Tue, 29 Sep 2009 08:48:08 -0700 (PDT) Received: from me.localdomain (bzq-79-179-57-218.red.bezeqint.net [79.179.57.218]) by mx.google.com with ESMTPS id 18sm6244930fks.40.2009.09.29.08.48.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 29 Sep 2009 08:48:08 -0700 (PDT) Received: by me.localdomain (Postfix, from userid 1000) id A4874418E8; Tue, 29 Sep 2009 17:49:58 +0200 (IST) Date: Tue, 29 Sep 2009 17:49:58 +0200 From: Sasha Khapyorsky To: Ira Weiny Cc: OpenFabrics , "linux-rdma@vger.kernel.org" Subject: [PATCH] infiniband-diags/ibqueryerrors: simplify node_type_to_print setup. Message-ID: <20090929154958.GC9465@me> References: <20090923150923.a5281107.weiny2@llnl.gov> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090923150923.a5281107.weiny2@llnl.gov> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Siplify node_type_to_print setup. Signed-off-by: Sasha Khapyorsky --- 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);