git: 257376b32b82 - releng/15.0 - LinuxKPI: add __counted_by_le() and __counted_by_be()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Oct 2025 23:37:07 UTC
The branch releng/15.0 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=257376b32b827dc433e84dd643a8b4d1cc213570
commit 257376b32b827dc433e84dd643a8b4d1cc213570
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-10-11 09:22:26 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-23 23:31:50 +0000
LinuxKPI: add __counted_by_le() and __counted_by_be()
The former is needed by a wireless driver at v6.17.
Approved by: re (cperciva)
Reviewed by: dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D53203
(cherry picked from commit 0a4b11ddb298fa08e1a81af7337995a3769552bf)
(cherry picked from commit 0e30cab0f32ee40e89f59b3a287ae96c084e1e7a)
---
sys/compat/linuxkpi/common/include/linux/compiler.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h
index 948396144ad6..4146c829b936 100644
--- a/sys/compat/linuxkpi/common/include/linux/compiler.h
+++ b/sys/compat/linuxkpi/common/include/linux/compiler.h
@@ -31,6 +31,7 @@
#define _LINUXKPI_LINUX_COMPILER_H_
#include <sys/cdefs.h>
+#include <sys/endian.h>
#define __user
#define __kernel
@@ -79,6 +80,13 @@
#else
#define __counted_by(_x)
#endif
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define __counted_by_le(_x) __counted_by(_x)
+#define __counted_by_be(_x)
+#else
+#define __counted_by_le(_x)
+#define __counted_by_be(_x) __counted_by(_x)
+#endif
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)