]> git.droids-corp.org - dpdk.git/commitdiff
bus: add helper to find bus by name
authorJan Blunck <jblunck@infradead.org>
Fri, 30 Jun 2017 18:19:37 +0000 (20:19 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 3 Jul 2017 23:08:36 +0000 (01:08 +0200)
Signed-off-by: Jan Blunck <jblunck@infradead.org>
lib/librte_eal/bsdapp/eal/rte_eal_version.map
lib/librte_eal/common/eal_common_bus.c
lib/librte_eal/common/include/rte_bus.h
lib/librte_eal/linuxapp/eal/rte_eal_version.map

index 458e3a6f5d78249c8d91aa2786baed82c613a13f..d138a96ea116293e7c1e1bf10352a18410d32694 100644 (file)
@@ -199,5 +199,6 @@ DPDK_17.08 {
 
        rte_bus_find;
        rte_bus_find_by_device;
+       rte_bus_find_by_name;
 
 } DPDK_17.05;
index b8a9e3072fbeb32f08006e200c936683ccb94bae..bf2b138a6e511d4a2bae680e72c3f9a1008a9a23 100644 (file)
@@ -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);
+}
index f8b321559ec466e4a96889ab051919e86eb97aab..509292d1342eaeacabfa04d0bd7bfe3689aeed9c 100644 (file)
@@ -214,6 +214,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.
index 3c193e492781ba80cdf8a7b0dfb8bc1395c64045..643ec1cc70f81a9c9b5d53869b562973f6ac7d7c 100644 (file)
@@ -204,5 +204,6 @@ DPDK_17.08 {
 
        rte_bus_find;
        rte_bus_find_by_device;
+       rte_bus_find_by_name;
 
 } DPDK_17.05;