From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id DF9565A6E for ; Fri, 30 Jun 2017 20:20:10 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id y5so9305694wmh.3 for ; Fri, 30 Jun 2017 11:20:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=LpVditm4RlCGX/yENu2VunIEHuUqUWpLp6mXgwNyn+U=; b=MORdwv0tHEUJ6ac4kb3L5YgG7yf6ohuMfhlFbcbWN8gA3lvlPQ40ES8FQaHzwt7Zzw wCDYflYl5eOvoGT1YElsFKFzieyQ89tI/DPDqbXzjR0Zz9DSKv9PWPP8pyYyROVoRcDX ahzT/vPvbmZBgOTMmhLzAxI58gOcwirZGL8G2tM6wcHkklP33+5q45V26Qd6EAh23swu HOqe4b+85YBU4BDZqnjsTu5KoWHEAflrHPBZADpPIx3yH3BVI37vL68PRGvY05VhEM2Q C3oLZUrt7LQ3pjt/d1ihJLQfs66Q0S9yoB2t8QK37L0BCdfYhESYD+fYblPnmdRPMpaE FGgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=LpVditm4RlCGX/yENu2VunIEHuUqUWpLp6mXgwNyn+U=; b=PHBegH50/3CpGv3y5Y1MXdKLRsE0nv1X3PPUF04dX893VzJMGpTEeP57gqm0Mstwni X2koXvsNMpvcpilc4w6FOeCILqCA3/8jUYBLNgt27Vxex2byhmuTewiP1U7wQUyp36AD bOQxNcMWCcEl7Auit4GFnl1BVtkfAJV4ER9HxgvjgB/MsYmXk/9ClRWJctKjQCOXBYYY YlNu+0nFYlSN7Liaohojd10BULK3Pi/rOzCQTTIzyKZFL5Uf30wVChyP7TTnlV1qSEY3 oN9s3QDt84epTs9nqYfEvhVr7VOf9Zbt48jpzo19n0eL5TRdcdQEDFBCiHtoQxw0C0v9 s7Cg== X-Gm-Message-State: AKS2vOxQ9ygbIm2os+Lc9BnkCY4RO8QrqXfqaPFKtvi1/pvbb+0UgSp+ ZsQIju8TjezTEFXx X-Received: by 10.80.169.193 with SMTP id n59mr6182354edc.181.1498846810547; Fri, 30 Jun 2017 11:20:10 -0700 (PDT) Received: from weierstrass.local ([91.200.110.13]) by smtp.gmail.com with ESMTPSA id r28sm2826940edd.33.2017.06.30.11.20.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 11:20:09 -0700 (PDT) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Cc: gaetan.rivet@6wind.com, shreyansh.jain@nxp.com Date: Fri, 30 Jun 2017 20:19:37 +0200 Message-Id: <20170630181943.23929-9-jblunck@infradead.org> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170630181943.23929-1-jblunck@infradead.org> References: <20170629182206.1072-1-jblunck@infradead.org> <20170630181943.23929-1-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH v8 08/14] bus: add rte_bus_find_by_name 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: Fri, 30 Jun 2017 18:20:11 -0000 Signed-off-by: Jan Blunck --- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 + lib/librte_eal/common/eal_common_bus.c | 14 ++++++++++++++ lib/librte_eal/common/include/rte_bus.h | 5 +++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 + 4 files changed, 21 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 458e3a6..d138a96 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -199,5 +199,6 @@ DPDK_17.08 { rte_bus_find; rte_bus_find_by_device; + rte_bus_find_by_name; } DPDK_17.05; diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index b8a9e30..bf2b138 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -188,3 +188,17 @@ rte_bus_find_by_device(const struct rte_device *dev) { return rte_bus_find(NULL, bus_find_device, (const void *)dev); } + +static int +cmp_bus_name(const struct rte_bus *bus, const void *_name) +{ + const char *name = _name; + + return strcmp(bus->name, name); +} + +struct rte_bus * +rte_bus_find_by_name(const char *busname) +{ + return rte_bus_find(NULL, cmp_bus_name, (const void *)busname); +} diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h index f8b3215..509292d 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -215,6 +215,11 @@ struct rte_bus *rte_bus_find(const struct rte_bus *start, rte_bus_cmp_t cmp, struct rte_bus *rte_bus_find_by_device(const struct rte_device *dev); /** + * Find the registered bus for a given name. + */ +struct rte_bus *rte_bus_find_by_name(const char *busname); + +/** * Helper for Bus registration. * The constructor has higher priority than PMD constructors. */ diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 3c193e4..643ec1c 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -204,5 +204,6 @@ DPDK_17.08 { rte_bus_find; rte_bus_find_by_device; + rte_bus_find_by_name; } DPDK_17.05; -- 2.9.4