From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 31838B3BF for ; Wed, 17 Sep 2014 16:40:07 +0200 (CEST) Received: from nat-pool-rdu-u.redhat.com ([66.187.233.203] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1XUGUE-0000xN-8b; Wed, 17 Sep 2014 10:45:46 -0400 Date: Wed, 17 Sep 2014 10:45:31 -0400 From: Neil Horman To: David Marchand Message-ID: <20140917144531.GB4213@localhost.localdomain> References: <1410961612-8571-1-git-send-email-david.marchand@6wind.com> <1410961612-8571-21-git-send-email-david.marchand@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1410961612-8571-21-git-send-email-david.marchand@6wind.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -2.9 (--) X-Spam-Status: No Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v3 20/20] eal: set log level from command line X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Sep 2014 14:40:07 -0000 On Wed, Sep 17, 2014 at 03:46:52PM +0200, David Marchand wrote: > Add a --log-level option to set the default eal log level. > > Signed-off-by: David Marchand > Acked-by: Bruce Richardson > --- > #else > @@ -652,6 +679,18 @@ eal_parse_args(int argc, char **argv) > eal_usage(prgname); > return -1; > } > + } else if (!strcmp(lgopts[option_index].name, > + OPT_LOG_LEVEL)) { > + uint32_t log; > + > + if (eal_parse_log_level(optarg, &log) < 0) { > + RTE_LOG(ERR, EAL, > + "invalid parameters for --" > + OPT_LOG_LEVEL "\n"); > + eal_usage(prgname); > + return -1; > + } > + internal_config.log_level = log; This is a nit, but since you're working in this code anyway, would you mind fixing the long options parsing please? Instead of having a single case statement that just does a never ending if..else..if series of strcmps that could possibly cause a stack overflow, you can set the val value in the lgopts array to a unique value for each option and just have a set of case statements. It would look a lot more readable and exeucte more safely. Thanks Neil