From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v2 08/15] devargs: use existing functions in rte_eal_devargs_parse() Date: Mon, 4 Sep 2017 17:24:23 +0100 Message-ID: <0e436d4d-d9d7-cc53-12e3-c78e56626db9@intel.com> References: <20170711232512.54641-1-jblunck@infradead.org> <20170714211213.34436-1-jblunck@infradead.org> <20170714211213.34436-9-jblunck@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit To: Jan Blunck , dev@dpdk.org Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 64AD47D31 for ; Mon, 4 Sep 2017 18:24:27 +0200 (CEST) In-Reply-To: <20170714211213.34436-9-jblunck@infradead.org> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 7/14/2017 10:12 PM, Jan Blunck wrote: > This fixes the newly introduces rte_eal_devargs_parse() to make use of: > - snprintf() instead of open coding a while() loop > - rte_eal_parse_devargs_str() instead of duplicating parsing code > - RTE_LOG() instead of direct output to stderr > > Signed-off-by: Jan Blunck > --- > lib/librte_eal/common/eal_common_devargs.c | 57 +++++++++++++++--------------- > 1 file changed, 28 insertions(+), 29 deletions(-) > > diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c > index 205fabb95..b5273287e 100644 > --- a/lib/librte_eal/common/eal_common_devargs.c > +++ b/lib/librte_eal/common/eal_common_devargs.c > @@ -87,54 +87,53 @@ int > rte_eal_devargs_parse(const char *dev, struct rte_devargs *da) here "const char *dev" is devarg_str, it can be something like: "00:01.0,somekey=somevalue,keymore=valuemore" Calling this "dev" is confusing I think, since you are touching to the function does it make sense to rename this? > { > struct rte_bus *bus = NULL; > - const char *devname; > - const size_t maxlen = sizeof(da->name); > - size_t i; > + char *devname = NULL, *drvargs = NULL; > + int ret; > > if (dev == NULL || da == NULL) > return -EINVAL; > /* Retrieve eventual bus info */ > do { > - devname = dev; > bus = rte_bus_find(bus, bus_name_cmp, dev); > if (bus == NULL) > break; > - devname = dev + strlen(bus->name) + 1; > - if (rte_bus_find_by_device_name(devname) == bus) > + dev += strlen(bus->name) + 1; This deserves a comment I believe, what is done here? > + if (rte_bus_find_by_device_name(dev) == bus) > break; > } while (1); <...>