// SPDX-License-Identifier: GPL-2.0 #include <linux/ucs2_string.h> #include <linux/module.h> /* Return the number of unicode characters in data */ unsigned long ucs2_strnlen(const ucs2_char_t *s, size_t maxlength) { … } EXPORT_SYMBOL(…); unsigned long ucs2_strlen(const ucs2_char_t *s) { … } EXPORT_SYMBOL(…); /* * Return the number of bytes is the length of this string * Note: this is NOT the same as the number of unicode characters */ unsigned long ucs2_strsize(const ucs2_char_t *data, unsigned long maxlength) { … } EXPORT_SYMBOL(…); /** * ucs2_strscpy() - Copy a UCS2 string into a sized buffer. * * @dst: Pointer to the destination buffer where to copy the string to. * @src: Pointer to the source buffer where to copy the string from. * @count: Size of the destination buffer, in UCS2 (16-bit) characters. * * Like strscpy(), only for UCS2 strings. * * Copy the source string @src, or as much of it as fits, into the destination * buffer @dst. The behavior is undefined if the string buffers overlap. The * destination buffer @dst is always NUL-terminated, unless it's zero-sized. * * Return: The number of characters copied into @dst (excluding the trailing * %NUL terminator) or -E2BIG if @count is 0 or @src was truncated due to the * destination buffer being too small. */ ssize_t ucs2_strscpy(ucs2_char_t *dst, const ucs2_char_t *src, size_t count) { … } EXPORT_SYMBOL(…); int ucs2_strncmp(const ucs2_char_t *a, const ucs2_char_t *b, size_t len) { … } EXPORT_SYMBOL(…); unsigned long ucs2_utf8size(const ucs2_char_t *src) { … } EXPORT_SYMBOL(…); /* * copy at most maxlength bytes of whole utf8 characters to dest from the * ucs2 string src. * * The return value is the number of characters copied, not including the * final NUL character. */ unsigned long ucs2_as_utf8(u8 *dest, const ucs2_char_t *src, unsigned long maxlength) { … } EXPORT_SYMBOL(…); MODULE_LICENSE(…) …;