138c8a9a5SSteve French /* SPDX-License-Identifier: GPL-2.0-or-later */ 238c8a9a5SSteve French /* 338c8a9a5SSteve French * Some of the source code in this file came from fs/cifs/cifs_unicode.c 438c8a9a5SSteve French * cifs_unicode: Unicode kernel case support 538c8a9a5SSteve French * 638c8a9a5SSteve French * Function: 738c8a9a5SSteve French * Convert a unicode character to upper or lower case using 838c8a9a5SSteve French * compressed tables. 938c8a9a5SSteve French * 1038c8a9a5SSteve French * Copyright (c) International Business Machines Corp., 2000,2009 1138c8a9a5SSteve French * 1238c8a9a5SSteve French * 1338c8a9a5SSteve French * Notes: 1438c8a9a5SSteve French * These APIs are based on the C library functions. The semantics 1538c8a9a5SSteve French * should match the C functions but with expanded size operands. 1638c8a9a5SSteve French * 1738c8a9a5SSteve French * The upper/lower functions are based on a table created by mkupr. 1838c8a9a5SSteve French * This is a compressed table of upper and lower case conversion. 1938c8a9a5SSteve French * 2038c8a9a5SSteve French */ 21*089f7f59SDr. David Alan Gilbert #ifndef _SMB_UNICODE_H 22*089f7f59SDr. David Alan Gilbert #define _SMB_UNICODE_H 2338c8a9a5SSteve French 2438c8a9a5SSteve French #include <asm/byteorder.h> 2538c8a9a5SSteve French #include <linux/types.h> 2638c8a9a5SSteve French #include <linux/nls.h> 2738c8a9a5SSteve French #include <linux/unicode.h> 28*089f7f59SDr. David Alan Gilbert #include "../../nls/nls_ucs2_utils.h" 2938c8a9a5SSteve French 3038c8a9a5SSteve French #ifdef __KERNEL__ 3138c8a9a5SSteve French int smb_strtoUTF16(__le16 *to, const char *from, int len, 3238c8a9a5SSteve French const struct nls_table *codepage); 3338c8a9a5SSteve French char *smb_strndup_from_utf16(const char *src, const int maxlen, 3438c8a9a5SSteve French const bool is_unicode, 3538c8a9a5SSteve French const struct nls_table *codepage); 3638c8a9a5SSteve French int smbConvertToUTF16(__le16 *target, const char *source, int srclen, 3738c8a9a5SSteve French const struct nls_table *cp, int mapchars); 3838c8a9a5SSteve French char *ksmbd_extract_sharename(struct unicode_map *um, const char *treename); 3938c8a9a5SSteve French #endif 4038c8a9a5SSteve French 41*089f7f59SDr. David Alan Gilbert #endif /* _SMB_UNICODE_H */ 42