git: 5b4f2e816298 - stable/13 - LinuxKPI: add sizeof_field()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 20 Feb 2022 18:15:36 UTC
The branch stable/13 has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=5b4f2e8162987fa966b8ef0a537f49ae0caea286
commit 5b4f2e8162987fa966b8ef0a537f49ae0caea286
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-02-09 11:46:15 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-02-20 16:24:22 +0000
LinuxKPI: add sizeof_field()
Add sizeof_field() to linux/compiler.h needed by a driver.
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34226
(cherry picked from commit e5b95b220135bba90154c9c27803f54bf1a75548)
---
sys/compat/linuxkpi/common/include/linux/compiler.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h
index 1f2edecbaee7..87a37228736f 100644
--- a/sys/compat/linuxkpi/common/include/linux/compiler.h
+++ b/sys/compat/linuxkpi/common/include/linux/compiler.h
@@ -111,4 +111,6 @@
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
#define __must_be_array(a) __same_type(a, &(a)[0])
+#define sizeof_field(_s, _m) sizeof(((_s *)0)->_m)
+
#endif /* _LINUXKPI_LINUX_COMPILER_H_ */