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 99B8537A6 for ; Wed, 24 May 2017 18:16:07 +0200 (CEST) Received: by mail-wm0-f49.google.com with SMTP id b84so69567730wmh.0 for ; Wed, 24 May 2017 09:16:07 -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=vKS8NEP0CHC7wlkDecXPor3ZaCd4UuExeHOHjKmV5Ag=; b=u2a2DUg5b3XcDw1w5ClmtvIM/iXBCxoF1Tf//GrhjsXaQcGKHtDjSTMjZ7ijvI4uiQ NiKMDv6qx9XXnsom/xDm3uO3W9IUYY61EERp7fcxjJBS588fI3TATquct7XXQOy0BmbW y9fnS2qVFcNBvWiXGediFxMdimx9kso0YnlPPdDlVADYUl5rALe+mreWB2KxC3ybK+dn g3gTHNFVm7ThmcgDSTXVkgmqDi3VhtJuWOQcZMB9udimuKvNToBb8gPdQQOgudi3+dIe 90mLRJYiGeWGF1EzfrVLHOSiI0dxwUjqAtajS0RQNxrlfDjWrB4dEgeq/CpW/C8EvlVQ WEpw== 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=vKS8NEP0CHC7wlkDecXPor3ZaCd4UuExeHOHjKmV5Ag=; b=KH2bvby+Ew7gF+r4tglB4Z232EM0x6fo2g7x/0T9UxAU1Tz0YAaFHaBkf4PDmo0Wbk rJeF1X9TF22ME3G+sXKHN0r/JE5+EwBqeqs8oI/1mYYv3WAZklBwhgIzs63QD/Ux4mw+ NI6F/94FG9Kqr3UMspNCOZCkWK0O1+YAYnPDO0f8bRvzNLaWnMdVfNJ4UmKcP8eHpTnA mb6P0RBLH154E5dHdrMk6brUfv5vfL34x+XqdGS3WSVVKzfSQZk1i2DBBLSn3UKohuj6 GPPuoK2Gey1EAR3f1yCBshfefXmPCROEOeAf1BBpYqZataNl/G0K5Nr68ekNt2lOsoz/ s3Xg== X-Gm-Message-State: AODbwcBV4v/SzuSUkQiJyAQQe1K9io6zmWyAOeTfYAbgi32lou5hPeWB wRXuUtgPCf2FAXeFrxE= X-Received: by 10.28.94.78 with SMTP id s75mr6457915wmb.4.1495642566817; Wed, 24 May 2017 09:16:06 -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 l7sm7783055wrc.52.2017.05.24.09.16.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 May 2017 09:16:06 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 24 May 2017 18:15:46 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 3/9] 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: Wed, 24 May 2017 16:16:08 -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 3893ad6..00fc6d2 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -103,6 +103,26 @@ typedef int (*rte_bus_attach_t)(struct rte_device *dev); typedef int (*rte_bus_detach_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 { @@ -113,6 +133,7 @@ struct rte_bus { rte_bus_find_device_t find_device; /**< Find device on bus */ rte_bus_attach_t attach; /**< Probe single device for drivers */ rte_bus_detach_t detach; /**< Remove single device from driver */ + rte_bus_parse_t parse; /**< Parse a device name */ }; /** -- 2.1.4