aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2022-11-14 23:26:22 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2022-11-15 12:52:10 +0000
commit5d310ea8c5f98bbf53078ec632f6441f54dc9e44 (patch)
tree661177e05b9b12842a3596c054c705802d0d4d28 /sys
parent386a5e3ae63f1ce29ceac7dc8d717a9cabb1f878 (diff)
Diffstat (limited to 'sys')
-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 36f27a385d65..932bed81d034 100644
--- a/sys/compat/linuxkpi/common/include/linux/string.h
+++ b/sys/compat/linuxkpi/common/include/linux/string.h
@@ -249,4 +249,12 @@ memcpy_and_pad(void *dst, size_t dstlen, const void *src, size_t len, int ch)
}
}
+#define memset_startat(ptr, bytepat, smember) \
+({ \
+ uint8_t *_ptr = (uint8_t *)(ptr); \
+ int _c = (int)(bytepat); \
+ size_t _o = offsetof(typeof(*(ptr)), smember); \
+ memset(_ptr + _o, _c, sizeof(*(ptr)) - _o); \
+})
+
#endif /* _LINUXKPI_LINUX_STRING_H_ */