From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, maxime.coquelin@redhat.com,
anatoly.burakov@intel.com, stephen@networkplumber.org,
"Chenbo Xia" <chenbox@nvidia.com>,
"Morten Brørup" <mb@smartsharesystems.com>
Subject: [PATCH v3 01/10] uapi: fix include guards in VDUSE imported header
Date: Fri, 19 Sep 2025 10:37:58 +0200 [thread overview]
Message-ID: <20250919083808.1667491-2-david.marchand@redhat.com> (raw)
In-Reply-To: <20250919083808.1667491-1-david.marchand@redhat.com>
One issue with the currently imported header is that if a header
(external to DPDK) starts including the equivalent system installed uapi
header, then when DPDK code later includes its own uapi/ header,
the header guard won't match, which may result in DPDK build failure.
To address this issue, adjust the include guards in our imported uapi
header and make sure those headers are included first before any
external header.
Update the documentation accordingly.
Fixes: cf97dfd12eaf ("uapi: import Linux kernel uAPI headers")
Fixes: 67b79f6314ae ("vhost: use imported VDUSE uAPI header")
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
devtools/linux-uapi.sh | 3 +++
doc/guides/contributing/linux_uapi.rst | 6 ++++++
kernel/linux/uapi/linux/vduse.h | 6 +++---
lib/vhost/vduse.c | 4 ++--
4 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/devtools/linux-uapi.sh b/devtools/linux-uapi.sh
index c09c43ab6b..dbf3163bc8 100755
--- a/devtools/linux-uapi.sh
+++ b/devtools/linux-uapi.sh
@@ -81,6 +81,9 @@ fixup_includes()
sed -i "s|^#include <linux/compiler.h>||g" $path
sed -i "s|\<__user[[:space:]]||" $path
+ sed -i 's|#\(ifndef\)[[:space:]]*_UAPI|#\1 |' $path
+ sed -i 's|#\(define\)[[:space:]]*_UAPI|#\1 |' $path
+ sed -i 's|#\(endif[[:space:]]*/[*]\)[[:space:]]*_UAPI|#\1 |' $path
# Prepend include path with "uapi/" if the header is imported
for include in $(sed -ne 's/^#include <\(.*\)>$/\1/p' $path); do
diff --git a/doc/guides/contributing/linux_uapi.rst b/doc/guides/contributing/linux_uapi.rst
index 79bedb478e..a1bc0ba604 100644
--- a/doc/guides/contributing/linux_uapi.rst
+++ b/doc/guides/contributing/linux_uapi.rst
@@ -62,9 +62,15 @@ Header inclusion into library or driver
The library or driver willing to make use of imported uAPI headers needs to
explicitly include the header file with ``uapi/`` prefix in C files.
+
+This inclusion must be done before any header external to DPDK is included,
+to prevent inclusion of this system uAPI header in any of those external headers.
+
For example to include VDUSE uAPI:
.. code-block:: c
#include <uapi/linux/vduse.h>
+ #include <stdint.h>
+ ...
diff --git a/kernel/linux/uapi/linux/vduse.h b/kernel/linux/uapi/linux/vduse.h
index 68a627d04a..f46269af34 100644
--- a/kernel/linux/uapi/linux/vduse.h
+++ b/kernel/linux/uapi/linux/vduse.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
-#ifndef _UAPI_VDUSE_H_
-#define _UAPI_VDUSE_H_
+#ifndef _VDUSE_H_
+#define _VDUSE_H_
#include <linux/types.h>
@@ -350,4 +350,4 @@ struct vduse_dev_response {
};
};
-#endif /* _UAPI_VDUSE_H_ */
+#endif /* _VDUSE_H_ */
diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
index 9de7f04a4f..2015ae9f21 100644
--- a/lib/vhost/vduse.c
+++ b/lib/vhost/vduse.c
@@ -2,13 +2,13 @@
* Copyright (c) 2023 Red Hat, Inc.
*/
+#include <uapi/linux/vduse.h>
+
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
-
-#include <uapi/linux/vduse.h>
#include <linux/virtio_net.h>
#include <sys/ioctl.h>
--
2.51.0
next prev parent reply other threads:[~2025-09-19 8:38 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 7:28 [RFC 0/8] Cleanup VFIO API and import Linux uAPI header David Marchand
2025-09-03 7:28 ` [RFC 1/8] vfio: remove confusing check on VFIO presence David Marchand
2025-09-03 9:38 ` Xu, Rosen
2025-09-03 7:28 ` [RFC 2/8] vfio: assume VFIO is always and only present on Linux David Marchand
2025-09-03 7:28 ` [RFC 3/8] vfio: remove public wrappers David Marchand
2025-09-03 7:28 ` [RFC 4/8] eal/linux: remove more internal VFIO macros David Marchand
2025-09-03 7:28 ` [RFC 5/8] eal/linux: remove internal VFIO wrappers for old Linux David Marchand
2025-09-03 7:28 ` [RFC 6/8] vfio: stop including Linux kernel header in public and driver API David Marchand
2025-09-03 9:38 ` Xu, Rosen
2025-09-03 7:28 ` [RFC 7/8] uapi: import VFIO header David Marchand
2025-09-03 7:28 ` [RFC 8/8] vfio: use imported uAPI header David Marchand
2025-09-03 9:38 ` Xu, Rosen
2025-09-03 7:50 ` [RFC 0/8] Cleanup VFIO API and import Linux " David Marchand
2025-09-03 9:29 ` Burakov, Anatoly
2025-09-03 9:52 ` David Marchand
2025-09-03 14:25 ` Burakov, Anatoly
2025-09-03 15:13 ` [RFC v2 0/9] " David Marchand
2025-09-03 15:13 ` [RFC v2 1/9] drivers: remove unneeded VFIO header inclusion David Marchand
2025-09-03 15:13 ` [RFC v2 2/9] vfio: remove confusing check on VFIO presence David Marchand
2025-09-03 15:13 ` [RFC v2 3/9] vfio: assume VFIO is always and only present on Linux David Marchand
2025-09-03 15:13 ` [RFC v2 4/9] vfio: remove public wrappers David Marchand
2025-09-03 15:13 ` [RFC v2 5/9] eal/linux: remove more internal VFIO macros David Marchand
2025-09-03 15:13 ` [RFC v2 6/9] eal/linux: remove internal VFIO wrappers for old Linux David Marchand
2025-09-03 15:22 ` [RFC v2 0/9] Cleanup VFIO API and import Linux uAPI header David Marchand
2025-09-03 15:17 ` David Marchand
2025-09-03 15:17 ` [RFC v2 1/9] drivers: remove unneeded VFIO header inclusion David Marchand
2025-09-09 14:05 ` Burakov, Anatoly
2025-09-03 15:17 ` [RFC v2 2/9] vfio: remove confusing check on VFIO presence David Marchand
2025-09-03 15:17 ` [RFC v2 3/9] vfio: assume VFIO is always and only present on Linux David Marchand
2025-09-09 15:17 ` Burakov, Anatoly
2025-09-03 15:17 ` [RFC v2 4/9] vfio: remove public wrappers David Marchand
2025-09-09 15:37 ` Burakov, Anatoly
2025-09-18 8:38 ` David Marchand
2025-09-03 15:17 ` [RFC v2 5/9] eal/linux: remove more internal VFIO macros David Marchand
2025-09-10 12:15 ` Burakov, Anatoly
2025-09-03 15:17 ` [RFC v2 6/9] eal/linux: remove internal VFIO wrappers for old Linux David Marchand
2025-09-03 15:17 ` [RFC v2 7/9] vfio: stop including Linux kernel header in public and driver API David Marchand
2025-09-17 14:34 ` Burakov, Anatoly
2025-09-03 15:17 ` [RFC v2 8/9] uapi: import VFIO header David Marchand
2025-09-06 4:11 ` Stephen Hemminger
2025-09-18 8:48 ` Thomas Monjalon
2025-09-18 15:16 ` Stephen Hemminger
2025-09-19 8:28 ` David Marchand
2025-09-03 15:17 ` [RFC v2 9/9] vfio: use imported uAPI header David Marchand
2025-09-04 7:08 ` [RFC v2 0/9] Cleanup VFIO API and import Linux " David Marchand
2025-09-19 8:37 ` [PATCH v3 00/10] " David Marchand
2025-09-19 8:37 ` David Marchand [this message]
2025-09-19 8:37 ` [PATCH v3 02/10] drivers: remove unneeded VFIO header inclusion David Marchand
2025-09-19 8:38 ` [PATCH v3 03/10] vfio: remove confusing check on VFIO presence David Marchand
2025-09-19 8:38 ` [PATCH v3 04/10] vfio: assume VFIO is always and only present on Linux David Marchand
2025-09-19 8:38 ` [PATCH v3 05/10] vfio: remove public wrappers David Marchand
2025-09-19 8:38 ` [PATCH v3 06/10] eal/linux: remove more internal VFIO macros David Marchand
2025-09-19 8:38 ` [PATCH v3 07/10] eal/linux: remove internal VFIO wrappers for old Linux David Marchand
2025-09-19 8:38 ` [PATCH v3 08/10] vfio: stop including Linux kernel header in public and driver API David Marchand
2025-09-19 8:38 ` [PATCH v3 09/10] uapi: import VFIO header David Marchand
2025-09-19 8:38 ` [PATCH v3 10/10] vfio: use imported uAPI header David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250919083808.1667491-2-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=anatoly.burakov@intel.com \
--cc=chenbox@nvidia.com \
--cc=dev@dpdk.org \
--cc=maxime.coquelin@redhat.com \
--cc=mb@smartsharesystems.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).