hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/include/linux/string_helpers.h
....@@ -2,6 +2,7 @@
22 #ifndef _LINUX_STRING_HELPERS_H_
33 #define _LINUX_STRING_HELPERS_H_
44
5
+#include <linux/ctype.h>
56 #include <linux/types.h>
67
78 struct file;
....@@ -54,6 +55,9 @@
5455 int string_escape_mem(const char *src, size_t isz, char *dst, size_t osz,
5556 unsigned int flags, const char *only);
5657
58
+int string_escape_mem_ascii(const char *src, size_t isz, char *dst,
59
+ size_t osz);
60
+
5761 static inline int string_escape_mem_any_np(const char *src, size_t isz,
5862 char *dst, size_t osz, const char *only)
5963 {
....@@ -72,8 +76,24 @@
7276 return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, only);
7377 }
7478
79
+static inline void string_upper(char *dst, const char *src)
80
+{
81
+ do {
82
+ *dst++ = toupper(*src);
83
+ } while (*src++);
84
+}
85
+
86
+static inline void string_lower(char *dst, const char *src)
87
+{
88
+ do {
89
+ *dst++ = tolower(*src);
90
+ } while (*src++);
91
+}
92
+
7593 char *kstrdup_quotable(const char *src, gfp_t gfp);
7694 char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp);
7795 char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
7896
97
+void kfree_strarray(char **array, size_t n);
98
+
7999 #endif