Skip to contentSkip to conversation

uapi: script and header update

PATCH New Stephen Hemminger 1 participant 3 messages Jun 10, 2025

lore
Share & tools
lore
#0 lore raw

cover uapi: script and header update

Make the script do what "make headers install" does and update existing headers.

Stephen Hemminger (2):
devtools/linux-uapi: conform to kernel headers install
uapi: update headers to 6.15 kernel

 devtools/linux-uapi.sh          | 16 ++++++++++++++--
 kernel/linux/uapi/linux/vduse.h |  6 +++---
 kernel/linux/uapi/version       |  2 +-
 3 files changed, 18 insertions(+), 6 deletions(-)
Signature · 1 line
2.47.2
#1 lore raw

PATCH 1/2 devtools/linux-uapi: conform to kernel headers install

The Linux kernel has an existing script to sanitize headers which uses more steps to clean up the header file. Make the DPDK header import script use the same regular expression. The kernel script is GPL-2.0 so ok.

Not necessary for current vduse.h header only but useful if more headers are added later. Want the distro and DPDK header to be exact match.

---
 devtools/linux-uapi.sh | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
devtools/linux-uapi.sh +14 -2
index ccd8b6816e..e739bdb1f4 100755
@@ -79,9 +79,21 @@ import_header()
 fixup_includes()
 {
 	local path=$1
+	local tmpfile=$path.tmp
 
-	sed -i "s|^#include <linux/compiler.h>||g" $path
-	sed -i "s|\<__user[[:space:]]||" $path
+	# script to sanitize see kernel script
+	# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/headers_install.sh
+
+	sed -E -e '
+	     s/([[:space:](])(__user|__force|__iomem)[[:space:]]/\1/g
+	     s/__attribute_const__([[:space:]]|$)/\1/g
+	     s@^#include <linux/compiler(|_types).h>@@
+	     s/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g
+	     s/(^|[[:space:](])(inline|asm|volatile)([[:space:](]|$)/\1__\2__\3/g
+	    s@#(ifndef|define|endif[[:space:]]*/[*])[[:space:]]*_UAPI@#\1 @' $path >$tmpfile
+
+	unifdef -U__KERNEL__ -D__EXPORTED_HEADERS $tmpfile >$path
+	rm $tmpfile
 
 	# Prepend include path with "uapi/" if the header is imported
 	for include in $(sed -ne 's/^#include <\(.*\)>$/\1/p' $path); do
Signature · 1 line
2.47.2
#2 lore raw

PATCH 2/2 uapi: update headers to 6.15 kernel

In reply to Stephen Hemminger

The header contents does not change, but version and wrapper ifdef does change.

---
 kernel/linux/uapi/linux/vduse.h | 6 +++---
 kernel/linux/uapi/version       | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
kernel/linux/uapi/linux/vduse.h +3 -3
index 68a627d04a..f46269af34 100644
@@ -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_ */
kernel/linux/uapi/version +1 -1
index 3c68968f92..ca6d638260 100644
@@ -1 +1 @@
-v6.14
+v6.15
Signature · 1 line
2.47.2