summaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux/string.h
AgeCommit message (Collapse)Author
2025-03-20linuxkpi: Add `strim()`Jean-Sébastien Pédron
This function trims whitespaces at the end of a string and returns a pointer to the first non-whitespace character. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49374
2024-05-21LinuxKPI: add kvmemdup()Bjoern A. Zeeb
Add kvmemdup() as a variant of kmemdup(). While currently it could just call kmemdup() we duplicate the code and use kvmalloc() in case someone will change the implementation of kvmalloc/kvfree in slab.h. This is used by an updated wireless driver. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D45181
2024-04-12LinuxKPI: implement memzero_explicit()Bjoern A. Zeeb
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D44586
2024-04-08LinuxKPI: Import vanilla linux/overflow.hVladimir Kondratyev
It is dual-licensed (GPLv2 & MIT) and self-contained header file. No need to reimplement it. Sponsored by: Serenity CyberSecurity, LLC Reviewed by: emaste MFC after: 1 week
2024-04-08LinuxKPI: Add strnchr functionVladimir Kondratyev
strnchr() finds a character in a length limited string. Sponsored by: Serenity CyberSecurity, LLC Reviewed by: emaste MFC after: 1 month
2024-02-03LinuxKPI: implement memset_after()Bjoern A. Zeeb
memset_after() is needed by iwlwifi d3.c. MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D43644
2023-08-16sys: Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-02-15linuxkpi: Add `strscpy_pad()` to <linux/string.h>Jean-Sébastien Pédron
It's the same as `strscpy()` except that it fills the rest of the destination buffer with zeroes if the source buffer is shorter. Reviewed by: manu Approved by: manu
2023-02-13linuxkpi: Add <linux/stdarg.h> + include it from <linux/string.h>Jean-Sébastien Pédron
The <stdarg.h> header was moved in Linux 5.15. Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D38540
2022-11-15LinuxKPI: add memset_startat macroBjoern A. Zeeb
Add a memset_startat() macro which sets a pattern from a struct member to the end of the struct. Needed by a wireless driver. MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D37389
2022-11-07LinuxKPI: string.h implement memcpy_and_pad()Bjoern A. Zeeb
Add a memcpy variant which takes length of source and destination buffers and a padding character in case there is free space in the destination. This is used by a wireless driver. MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D37226
2022-09-20linuxkpi: Add strndup_userJake Freeland
Reviewed by: hselasky, markj Differential Revision: https://reviews.freebsd.org/D36350 Sponsored by: Google, Inc. (GSoC 2022)
2022-08-08linuxkpi: Add some memset functionsEmmanuel Vadot
Needed by drm-kmod Obtained from: OpenBSD Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D35943
2022-01-10LinuxKPI: Constantly use _LINUXKPI_ prefix in include guardsVladimir Kondratyev
MFC after: 1 week Reviewed by: bz, emaste, hselasky, manu Differential Revision: https://reviews.freebsd.org/D33562
2021-10-25LinuxKPI: add strreplace() to string.hBjoern A. Zeeb
Add strreplace() needed by a driver. MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D32597
2021-07-05LinuxKPI: Implement strscpyVladimir Kondratyev
strscpy copies the src string, or as much of it as fits, into the dst buffer. The dst buffer is always NUL terminated, unless it's zero-sized. strscpy returns the number of characters copied (not including the trailing NUL) or -E2BIG if len is 0 or src was truncated. Currently drm-kmod replaces strscpy with strncpy that is not quite correct as strncpy does not NUL-terminate truncated strings and returns different values on exit. Reviewed by: hselasky, imp, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D31005
2020-07-14linuxkpi: Ignore NULL pointers passed to string parameter of kstr(n)dupVladimir Kondratyev
That follows Linux and fixes related drm-kmod-5.3 panic. Reviewed by: imp, hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25657 Notes: svn path=/head/; revision=363205
2020-02-20linuxkpi: Add str_has_prefixEmmanuel Vadot
This function test if the string str begins with the string pointed at by prefix. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D23767 Notes: svn path=/head/; revision=358177
2018-02-16Implement memdup_user_nul() in the LinuxKPI.Hans Petter Selasky
MFC after: 1 week Submitted by: Johannes Lundberg <johalun0@gmail.com> Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=329377
2017-02-24Implement more string functions in the LinuxKPI.Hans Petter Selasky
MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=314215
2016-03-03Add more functions to the LinuxKPI.Hans Petter Selasky
Define strnicmp as a function macro instead of a regular macro while at it. MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=296344
2015-10-29Finish process of moving the LinuxKPI module into the default kernel build.Hans Petter Selasky
- Move all files related to the LinuxKPI into sys/compat/linuxkpi and its subfolders. - Update sys/conf/files and some Makefiles to use new file locations. - Added description of COMPAT_LINUXKPI to sys/conf/NOTES which in turn adds the LinuxKPI to all LINT builds. - The LinuxKPI can be added to the kernel by setting the COMPAT_LINUXKPI option. The OFED kernel option no longer builds the LinuxKPI into the kernel. This was done to keep the build rules for the LinuxKPI in sys/conf/files simple. - Extend the LinuxKPI module to include support for USB by moving the Linux USB compat from usb.ko to linuxkpi.ko. - Bump the FreeBSD_version. - A universe kernel build has been done. Reviewed by: np @ (cxgb and cxgbe related changes only) Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=290135