From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com [209.85.128.176]) by dpdk.org (Postfix) with ESMTP id 7D38B7CB1 for ; Wed, 21 Jun 2017 01:30:52 +0200 (CEST) Received: by mail-wr0-f176.google.com with SMTP id r103so111494419wrb.0 for ; Tue, 20 Jun 2017 16:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=AkN3YJnQtwHz3759H6JZctNkB2XUJcYfSjyOvAvwuZg=; b=BJQ3gcbCsZRj06XOaHOyYgdoIOcaCU2d8eD21NIakorFJPPB6uATq36fQW+Dh3iCyb nAUYwPQ8+QpCFH6IMHRgayLMr1wOPMWsc/oj/RzMSEP4YdZdFMI3pLeSoF15nSwJAy0W Jv4bc3m8hqW7fRRrwUnUQ/SUocjMKcw8pZVruqim8d5AViagesimblvJYiPnxaTgm7Y8 Z0UKAwzetvjoJNemWQ+b9p+v2O0kdMYfIiLnOVOGwYTcXnQHr+D99pbEV8P9MreZ/GpG DuxrkxrkkEHWf2jb/bTUKRZGKXinVXIABeUX3PyhaFYazEo4AK9qaR00Td1pwaqJjdSO RIqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=AkN3YJnQtwHz3759H6JZctNkB2XUJcYfSjyOvAvwuZg=; b=odbnKEOJ8G0FRj4wTGly+2OYUAE1rOWU2TLfFCN++pVyyuyjvIrXX8Qh0iVXo5qGkY 5vA6+8hSur5vzhAYUQTH8RA2yZE/QvPkbeT3VoSdAe3KOyAYkWA023w0p/mapAJMAEi7 osFCL690OjuKZghHS9cg9jcgsZxEZCHbaapixZj2iJM3UpX906jYucK9LUYYUKbUDFQ6 klI+WwzgeKlSx7sXL+6Ck9b0vjScsSYgeJniaz7fTytCZMb/uwnVqxkfncssXrbghOEk QtKNJetHV78oID7cy/TDsv1xYaTE4xUJUdJyq0BCCHQB9jkNIi96kKD9CbC1gYvvcQ30 NFSg== X-Gm-Message-State: AKS2vOxqQF42GngZ6A4fnuJCJLz3RV1GqjujpaG9taHQ9Ae5TfvVXmbo ecw3Cc13a6lW3P52MQc= X-Received: by 10.223.142.80 with SMTP id n74mr25297387wrb.131.1498001451896; Tue, 20 Jun 2017 16:30:51 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id w30sm17593338wrb.49.2017.06.20.16.30.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 16:30:51 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 21 Jun 2017 01:30:31 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v5 2/7] bus: introduce parsing functionality X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jun 2017 23:30:53 -0000 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 b220299..05503ea 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -117,6 +117,26 @@ typedef struct rte_device * (*rte_bus_plug_t)(struct rte_devargs *da); 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. + * + * @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 { @@ -127,6 +147,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