From: Vadim Pasternak Date: Tue, 14 Jul 2020 12:01:53 +0000 (+0300) Subject: lib/string_helpers: Introduce string_upper() and string_lower() helpers X-Git-Tag: baikal/aarch64/sdk6.1~8738^2~20 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=100d9f0f963ebe32c8e144c493448da760c7320b;p=kernel.git lib/string_helpers: Introduce string_upper() and string_lower() helpers Provide the helpers for string conversions to upper and lower cases. Signed-off-by: Vadim Pasternak Signed-off-by: Andy Shevchenko --- diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index c289551322342..86f150c2a6b66 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -2,6 +2,7 @@ #ifndef _LINUX_STRING_HELPERS_H_ #define _LINUX_STRING_HELPERS_H_ +#include #include struct file; @@ -75,6 +76,20 @@ static inline int string_escape_str_any_np(const char *src, char *dst, return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, only); } +static inline void string_upper(char *dst, const char *src) +{ + do { + *dst++ = toupper(*src); + } while (*src++); +} + +static inline void string_lower(char *dst, const char *src) +{ + do { + *dst++ = tolower(*src); + } while (*src++); +} + char *kstrdup_quotable(const char *src, gfp_t gfp); char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp); char *kstrdup_quotable_file(struct file *file, gfp_t gfp);