From mboxrd@z Thu Jan 1 00:00:00 1970 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 B84247CF8 for ; Wed, 24 May 2017 17:12:56 +0200 (CEST) Received: by mail-wr0-f178.google.com with SMTP id z52so56986948wrc.2 for ; Wed, 24 May 2017 08:12:56 -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=SYaP79kS5YpMIeapAjherPu7ShlE+bxek/ADTohChVBsDDdI+8Q8O6I1V3ViNdD0O9 +KUg9ZnFRgSIhEkb9kB52Z+CW9PC15tlNOnfEY6Fva6klakoKjodZtLHmeGlzBqiYDU6 Ofy4t6zOJlI/T9wCzzPhMGQvQeUKmeSCsCAkkLygDqszIgMeRVMSIcoZdrqiwPsXkxao va0HijPWemhaYjyXC1oJKnPRhCTPB1E+fvIrVQLsh/e5jjAW/ZVJ1jki/6YvR4tnSEcT NUqcTqZWrWD5NA3qOm3cwx1l1oKkJZsTFdFwTEC+DsdQaGgEJB8huXjE1J/tZMKuILXN pbzQ== 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=m4U3ywaLVJnoAkvHr/2rvRvjz4JiU7qQXeOR+0nVqQ7PKk2Q6+FwZylR6BsALIewZb 3cCDELBMXwvXLcIhgMkZ7B6vw9bObpe5ek3GqwdhdgznmgsbCruEn0d6K2dmwG5XAT0w hp8vq/3yO0SNnQqUGNJ1M6GG/VyO4MiGJqSWx56IgbBwV7NVeEevD42I6HaXXKS00KQy 6IhBQwpLITUmi1Ed8d/kEb75y93S/jKr5LdhAPRpTZ5IyRfJnJBRzznkqWSAOF2kSLYy MhjZl8lfSGazhbHd6dYI1gZa5pbrrkA79/6UgGESJMv09dL5z6IBgqiGe0iBZiXhqMkL 2mfQ== X-Gm-Message-State: AODbwcDLbwjMas+L0D5LacpvSoi1I84koGbARq25HlOTpAoh588DnUkp 3SnYAjrv2IzQ2pMt X-Received: by 10.223.175.46 with SMTP id z43mr24523078wrc.84.1495638775956; Wed, 24 May 2017 08:12:55 -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 9sm5633351wmh.17.2017.05.24.08.12.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 May 2017 08:12:55 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet , Jan Blunck , Stephen Hemminger , Maxime Coquelin , Jerin Jacob , David Marchand Date: Wed, 24 May 2017 17:12:35 +0200 Message-Id: <66005552266e0a09e083788d160972ffb37c7c03.1495629122.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 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 15:12:57 -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