From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id ED0D0A00C5;
	Sat,  9 Jul 2022 10:30:08 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D2CCD42B72;
	Sat,  9 Jul 2022 10:30:07 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.133.124])
 by mails.dpdk.org (Postfix) with ESMTP id A203F42826
 for <dev@dpdk.org>; Sat,  9 Jul 2022 10:30:05 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1657355405;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=muSipBFPyyTOtNoWWK/ZNnZ0z2UovzWWmCpBKcvHndo=;
 b=fZ2fkPJ2SyNH3R3w4F4cD7dt0EWSSRKlyICkZzeRpQad+TcAjSSmx5NbsTuhvvjc8FrcOc
 Xl6g3oI54o4or2/FBAse2rNcOKE3/YhOOgPeTMwofXgvTf1j11n3cIqUQt1mLrNTh+N7j2
 +WcyBIe10CZcQx6QIfZLuPctFPHrYhU=
Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com
 [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-668-casbJu92N8a6SbhqzTxW-Q-1; Sat, 09 Jul 2022 04:29:56 -0400
X-MC-Unique: casbJu92N8a6SbhqzTxW-Q-1
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
 [10.11.54.4])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3218C811E80;
 Sat,  9 Jul 2022 08:29:56 +0000 (UTC)
Received: from localhost.localdomain (unknown [10.40.192.194])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 6933C2026D2D;
 Sat,  9 Jul 2022 08:29:55 +0000 (UTC)
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>,
 Chenbo Xia <chenbo.xia@intel.com>
Subject: [RFC v2 v2 29/29] dev: hide device object
Date: Sat,  9 Jul 2022 10:26:44 +0200
Message-Id: <20220709082644.664675-30-david.marchand@redhat.com>
In-Reply-To: <20220709082644.664675-1-david.marchand@redhat.com>
References: <20220628144643.1213026-1-david.marchand@redhat.com>
 <20220709082644.664675-1-david.marchand@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
Authentication-Results: relay.mimecast.com;
 auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="US-ASCII"; x-default=true
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

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@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