From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gaetan Rivet Subject: [PATCH v3 3/9] bus: introduce parsing functionality Date: Thu, 1 Jun 2017 12:08:53 +0200 Message-ID: <3b3a0ba64346e9b424b3c67620c6e7ce1ed94de0.1496311609.git.gaetan.rivet@6wind.com> References: Cc: Gaetan Rivet To: dev@dpdk.org Return-path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id 279F36841 for ; Thu, 1 Jun 2017 12:09:12 +0200 (CEST) Received: by mail-wm0-f42.google.com with SMTP id d127so53521571wmf.0 for ; Thu, 01 Jun 2017 03:09:12 -0700 (PDT) In-Reply-To: In-Reply-To: References: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 3bc4e1c..7e73d62 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -106,6 +106,26 @@ typedef int (*rte_bus_plug_t)(struct rte_devargs *da); typedef int (*rte_bus_unplug_t)(struct rte_devargs *da); /** + * 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. + * + * @return + * 0 if parsing was successful. + * !0 for any error. + */ +typedef int (*rte_bus_parse_t)(const char *name, void *addr); + +/** * A structure describing a generic bus. */ struct rte_bus { @@ -116,6 +136,7 @@ struct rte_bus { rte_bus_find_device_t find_device; /**< Find device on bus */ rte_bus_plug_t plug; /**< Probe single device for drivers */ rte_bus_unplug_t unplug; /**< Remove single device from driver */ + rte_bus_parse_t parse; /**< Parse a device name */ }; /** -- 2.1.4