aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2022-02-09 11:46:15 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2022-02-14 00:13:56 +0000
commite5b95b220135bba90154c9c27803f54bf1a75548 (patch)
tree15a86b2dc421852f8c669489242f4bda9b9d6b1d /sys/compat/linuxkpi
parentd17b78aa142d7c63490c7a2c3f202ef99fffad70 (diff)
downloadsrc-e5b95b220135bba90154c9c27803f54bf1a75548.tar.gz
src-e5b95b220135bba90154c9c27803f54bf1a75548.zip
LinuxKPI: add sizeof_field()
Add sizeof_field() to linux/compiler.h needed by a driver. MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D34226
Diffstat (limited to 'sys/compat/linuxkpi')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/compiler.h2
1 files changed, 2 insertions, 0 deletions
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_ */