aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2024-01-29 14:19:59 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2024-02-03 13:50:32 +0000
commit2d9d35837d8ea3ee7d7447d63a8755d45ec2fd96 (patch)
tree43cbeb6bb39709f84215e20a5d87994d46bec01e
parent8f7c32a41a6a6d88e36ce2f588489274193c2c9a (diff)
downloadsrc-2d9d35837d8ea3ee7d7447d63a8755d45ec2fd96.tar.gz
src-2d9d35837d8ea3ee7d7447d63a8755d45ec2fd96.zip
LinuxKPI: implement memset_after()
memset_after() is needed by iwlwifi d3.c. MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D43644
-rw-r--r--sys/compat/linuxkpi/common/include/linux/string.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h
index 1d9b7af5d9d5..f745c2f6d343 100644
--- a/sys/compat/linuxkpi/common/include/linux/string.h
+++ b/sys/compat/linuxkpi/common/include/linux/string.h
@@ -265,4 +265,12 @@ memcpy_and_pad(void *dst, size_t dstlen, const void *src, size_t len, int ch)
memset(_ptr + _o, _c, sizeof(*(ptr)) - _o); \
})
+#define memset_after(ptr, bytepat, smember) \
+({ \
+ uint8_t *_ptr = (uint8_t *)(ptr); \
+ int _c = (int)(bytepat); \
+ size_t _o = offsetofend(typeof(*(ptr)), smember); \
+ memset(_ptr + _o, _c, sizeof(*(ptr)) - _o); \
+})
+
#endif /* _LINUXKPI_LINUX_STRING_H_ */