[RFC v2 v2 29/29] dev: hide device object
David Marchand
david.marchand at redhat.com
Sat Jul 9 10:26:44 CEST 2022
Make rte_device opaque for non internal users.
This will make extending this object possible without breaking the ABI.
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
lib/eal/common/eal_private.h | 2 +-
lib/eal/include/dev_driver.h | 14 ++++++++++++++
lib/eal/include/rte_dev.h | 13 +------------
lib/vhost/vdpa.c | 1 +
4 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
index 44d14241f0..3ca9ce2ffc 100644
--- a/lib/eal/common/eal_private.h
+++ b/lib/eal/common/eal_private.h
@@ -10,7 +10,7 @@
#include <stdio.h>
#include <sys/queue.h>
-#include <rte_dev.h>
+#include <dev_driver.h>
#include <rte_lcore.h>
#include <rte_memory.h>
diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
index 015188abd5..01c3e30994 100644
--- a/lib/eal/include/dev_driver.h
+++ b/lib/eal/include/dev_driver.h
@@ -12,6 +12,8 @@ extern "C" {
#include <rte_common.h>
#include <rte_dev.h>
+struct rte_devargs;
+
/**
* A structure describing a device driver.
*/
@@ -21,6 +23,18 @@ struct rte_driver {
const char *alias; /**< Driver alias. */
};
+/**
+ * A structure describing a generic device.
+ */
+struct rte_device {
+ RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
+ const char *name; /**< Device name */
+ const struct rte_driver *driver; /**< Driver assigned after probing */
+ const struct rte_bus *bus; /**< Bus handle assigned on scan */
+ int numa_node; /**< NUMA node connection */
+ struct rte_devargs *devargs; /**< Arguments for latest probing */
+};
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index a80447a645..3077cf3f0f 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -25,6 +25,7 @@ extern "C" {
struct rte_bus;
struct rte_driver;
+struct rte_device;
/**
* The device event type.
@@ -127,18 +128,6 @@ __rte_experimental
int
rte_dev_numa_node(const struct rte_device *dev);
-/**
- * A structure describing a generic device.
- */
-struct rte_device {
- RTE_TAILQ_ENTRY(rte_device) next; /**< Next device */
- const char *name; /**< Device name */
- const struct rte_driver *driver; /**< Driver assigned after probing */
- const struct rte_bus *bus; /**< Bus handle assigned on scan */
- int numa_node; /**< NUMA node connection */
- struct rte_devargs *devargs; /**< Arguments for latest probing */
-};
-
/**
* Query status of a device.
*
diff --git a/lib/vhost/vdpa.c b/lib/vhost/vdpa.c
index bdebcbe565..aaf3f267e9 100644
--- a/lib/vhost/vdpa.c
+++ b/lib/vhost/vdpa.c
@@ -10,6 +10,7 @@
#include <sys/queue.h>
+#include <dev_driver.h>
#include <rte_common.h>
#include <rte_class.h>
#include <rte_malloc.h>
--
2.36.1
More information about the dev
mailing list