From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id ADAE42C72 for ; Tue, 4 Jul 2017 02:58:49 +0200 (CEST) Received: by mail-wm0-f49.google.com with SMTP id i127so122876137wma.0 for ; Mon, 03 Jul 2017 17:58:49 -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=56nNmNp6kjKVL0bAuf9jrTLXSI1NXHFvn+LL3n+mv8o=; b=w/Y8GIzcQLbESJvQqkdF9CWuwr40uABC0WzH3YOenQc3eerSV9mAIZiw81AOq3xGz6 kZ1KYZh4lCW+ljVhYc7pGLWiDiMc0hwF2qD8WOq5aL0bSVP4TuGrX+BZ8K0s4ezZnqPL ntcjtyUGBOzeZgwJD6dPP+A/lv/SGrw6stMmmc0kjQVXduKwcAshuznzLNxLh0LO6ARq e78AkdL26M1WGTgxbS/svQNRX3E1bCbq0EbWOZjXkBG3aPUNCp/clzKAjDduWwCMNUIc CFDgiU01l5eaL48C0GOxrhT9lu4HUNVVemdzLhVWL3Wktymk4SUmJTjRHU4k/lYH/1SY ozjQ== 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=56nNmNp6kjKVL0bAuf9jrTLXSI1NXHFvn+LL3n+mv8o=; b=qexnpG6i78//q2takwcGW7bsAfRmOgLjQ/djpXLeVPSVVDr96/KT3l9w6WxWmCSUG8 JWk9ZmHczYgzKJdn72mkKdwhuQADJCnoTphNQ6RP/3ApIuEk75ZQSCnHlw3yabwV0+uZ 3Q6wKzjFBRom8RoT7uxfCr9HqMM7AvhN+AY/4E8rWrqv70XILKaQiHUYgYIlCaOyhIQF QNucscD7aFjtjmWuQRPYrdn+XNxw4V1U368CHKlCVZQJfmMFO5Ghkt8MIdSTFIovtShj Wti0mD1ja5FYLm9NOLdzmokMU9nGXjGpkRCsjDQIFT096XutSB1v9gtvDvasls6TYPeo d4Pg== X-Gm-Message-State: AKS2vOzdKXajcVrY/5TfNAiZRG3Rk4rVkBHhzqOK1TJ1gvv8Ne37HkSF 5p9csmvg1C1QbRExoF4= X-Received: by 10.28.220.212 with SMTP id t203mr17462896wmg.13.1499129928993; Mon, 03 Jul 2017 17:58:48 -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 n189sm15162731wmd.0.2017.07.03.17.58.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Jul 2017 17:58:48 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 4 Jul 2017 02:58:29 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v6 2/6] 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, 04 Jul 2017 00:58:50 -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 c1c8fa5..31995c7 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. + * + * @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 { @@ -148,6 +168,7 @@ struct rte_bus { rte_bus_find_device_t find_device; /**< Find a device on the 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