From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet Subject: Re: [PATCH v7 2/6] bus: introduce parsing functionality Date: Thu, 6 Jul 2017 14:30:12 +0200 Message-ID: <20170706123012.GL11154@bidouze.vm.6wind.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: dev@dpdk.org To: santosh Return-path: Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by dpdk.org (Postfix) with ESMTP id A88642A58 for ; Thu, 6 Jul 2017 14:30:21 +0200 (CEST) Received: by mail-wr0-f178.google.com with SMTP id c11so848538wrc.3 for ; Thu, 06 Jul 2017 05:30:21 -0700 (PDT) Content-Disposition: inline In-Reply-To: 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 Thu, Jul 06, 2017 at 02:49:41PM +0530, santosh wrote: > Hi Gaetan, > > On Wednesday 05 July 2017 05:25 AM, Gaetan Rivet wrote: > > > This operation can be used either to validate that a device > > representation can be understood by a bus, as well as store the resulting > > specialized device representation in any format determined by the bus. > > > > Signed-off-by: Gaetan Rivet > > --- > > lib/librte_eal/common/include/rte_bus.h | 21 +++++++++++++++++++++ > > 1 file changed, 21 insertions(+) > > > > diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h > > index 773b0d7..aebf57e 100644 > > --- a/lib/librte_eal/common/include/rte_bus.h > > +++ b/lib/librte_eal/common/include/rte_bus.h > > @@ -138,6 +138,26 @@ typedef int (*rte_bus_plug_t)(struct rte_device *dev, > > typedef int (*rte_bus_unplug_t)(struct rte_device *dev); > > > > /** > > + * Bus specific parsing function. > > + * Validates the syntax used in the textual representation of a device, > > + * If the syntax is valid and ``addr`` is not NULL, writes the bus-specific > > + * device representation to ``addr``. > > + * > > + * @param[in] name > > + * device textual description > > + * > > + * @param[out] addr > > + * device information location address, into which parsed info > > + * should be written. If NULL, nothing should be written, which > > + * is not an error. > > + * > > r / is not a error/ is valid? > I'm partial to "is not an error" here, but it doesn't matter that much and I can change it if you prefer. > > + * @return > > + * 0 if parsing was successful. > > + * !0 for any error. > > + */ > > +typedef int (*rte_bus_parse_t)(const char *name, void *addr); > > + > > _parse handler in _common_vdev or common_pci file return boolean value > i.e..0 for success and 1 for error, right? if so then > !0 for any error would be like '1' for error case.. make sense? > I thought of that yes, and actually your suggestion was the first version I used. Ultimately however, this function is not only saying "can parse": it is not merely a test of being able to process the input, but also the process itself. The test value is then a byproduct. As such, I decided to settle on the standard "0 means nothing of note happened, carry on". -- Gaëtan Rivet 6WIND