33 #ifndef _CIFS_UNICODE_H
34 #define _CIFS_UNICODE_H
36 #include <asm/byteorder.h>
37 #include <linux/types.h>
40 #define UNIUPR_NOLOWER
47 #define UNI_ASTERISK (__u16) ('*' + 0xF000)
48 #define UNI_QUESTION (__u16) ('?' + 0xF000)
49 #define UNI_COLON (__u16) (':' + 0xF000)
50 #define UNI_GRTRTHAN (__u16) ('>' + 0xF000)
51 #define UNI_LESSTHAN (__u16) ('<' + 0xF000)
52 #define UNI_PIPE (__u16) ('|' + 0xF000)
53 #define UNI_SLASH (__u16) ('\\' + 0xF000)
58 #ifndef UNICASERANGE_DEFINED
66 #ifndef UNIUPR_NOUPPER
71 #ifndef UNIUPR_NOLOWER
78 const struct nls_table *codepage,
bool mapchar);
83 const bool is_unicode,
87 #ifdef CONFIG_CIFS_SMB2
88 extern __le16 *cifs_strndup_to_utf16(
const char *
src,
const int maxlen,
100 static inline wchar_t *
101 UniStrcat(
wchar_t *ucs1,
const wchar_t *ucs2)
107 while ((*ucs1++ = *ucs2++)) ;
118 static inline wchar_t *
119 UniStrchr(
const wchar_t *ucs,
wchar_t uc)
121 while ((*ucs != uc) && *ucs)
125 return (
wchar_t *) ucs;
138 UniStrcmp(
const wchar_t *ucs1,
const wchar_t *ucs2)
140 while ((*ucs1 == *ucs2) && *ucs1) {
144 return (
int) *ucs1 - (
int) *ucs2;
150 static inline wchar_t *
151 UniStrcpy(
wchar_t *ucs1,
const wchar_t *ucs2)
153 wchar_t *anchor = ucs1;
155 while ((*ucs1++ = *ucs2++)) ;
163 UniStrlen(
const wchar_t *ucs1)
177 UniStrnlen(
const wchar_t *ucs1,
int maxlen)
192 static inline wchar_t *
193 UniStrncat(
wchar_t *ucs1,
const wchar_t *ucs2,
size_t n)
195 wchar_t *anchor = ucs1;
199 while (n-- && (*ucs1 = *ucs2)) {
211 UniStrncmp(
const wchar_t *ucs1,
const wchar_t *ucs2,
size_t n)
215 while ((*ucs1 == *ucs2) && *ucs1 && --n) {
219 return (
int) *ucs1 - (
int) *ucs2;
226 UniStrncmp_le(
const wchar_t *ucs1,
const wchar_t *ucs2,
size_t n)
240 static inline wchar_t *
241 UniStrncpy(
wchar_t *ucs1,
const wchar_t *ucs2,
size_t n)
243 wchar_t *anchor = ucs1;
257 static inline wchar_t *
258 UniStrncpy_le(
wchar_t *ucs1,
const wchar_t *ucs2,
size_t n)
260 wchar_t *anchor = ucs1;
278 static inline wchar_t *
279 UniStrstr(
const wchar_t *ucs1,
const wchar_t *ucs2)
281 const wchar_t *anchor1 = ucs1;
282 const wchar_t *anchor2 = ucs2;
285 if (*ucs1 == *ucs2) {
291 return (
wchar_t *) anchor1;
298 return (
wchar_t *) anchor1;
302 #ifndef UNIUPR_NOUPPER
306 static inline wchar_t
307 UniToupper(
register wchar_t uc)
330 static inline wchar_t *
331 UniStrupr(
register wchar_t *upin)
333 register wchar_t *
up;
337 *up = UniToupper(*up);
344 #ifndef UNIUPR_NOLOWER
348 static inline wchar_t
349 UniTolower(
register wchar_t uc)
372 static inline wchar_t *
373 UniStrlwr(
register wchar_t *upin)
375 register wchar_t *
up;
379 *up = UniTolower(*up);