162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Some of the source code in this file came from fs/cifs/cifs_unicode.c 462306a36Sopenharmony_ci * cifs_unicode: Unicode kernel case support 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Function: 762306a36Sopenharmony_ci * Convert a unicode character to upper or lower case using 862306a36Sopenharmony_ci * compressed tables. 962306a36Sopenharmony_ci * 1062306a36Sopenharmony_ci * Copyright (c) International Business Machines Corp., 2000,2009 1162306a36Sopenharmony_ci * 1262306a36Sopenharmony_ci * 1362306a36Sopenharmony_ci * Notes: 1462306a36Sopenharmony_ci * These APIs are based on the C library functions. The semantics 1562306a36Sopenharmony_ci * should match the C functions but with expanded size operands. 1662306a36Sopenharmony_ci * 1762306a36Sopenharmony_ci * The upper/lower functions are based on a table created by mkupr. 1862306a36Sopenharmony_ci * This is a compressed table of upper and lower case conversion. 1962306a36Sopenharmony_ci * 2062306a36Sopenharmony_ci */ 2162306a36Sopenharmony_ci#ifndef _SMB_UNICODE_H 2262306a36Sopenharmony_ci#define _SMB_UNICODE_H 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#include <asm/byteorder.h> 2562306a36Sopenharmony_ci#include <linux/types.h> 2662306a36Sopenharmony_ci#include <linux/nls.h> 2762306a36Sopenharmony_ci#include <linux/unicode.h> 2862306a36Sopenharmony_ci#include "../../nls/nls_ucs2_utils.h" 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#ifdef __KERNEL__ 3162306a36Sopenharmony_ciint smb_strtoUTF16(__le16 *to, const char *from, int len, 3262306a36Sopenharmony_ci const struct nls_table *codepage); 3362306a36Sopenharmony_cichar *smb_strndup_from_utf16(const char *src, const int maxlen, 3462306a36Sopenharmony_ci const bool is_unicode, 3562306a36Sopenharmony_ci const struct nls_table *codepage); 3662306a36Sopenharmony_ciint smbConvertToUTF16(__le16 *target, const char *source, int srclen, 3762306a36Sopenharmony_ci const struct nls_table *cp, int mapchars); 3862306a36Sopenharmony_cichar *ksmbd_extract_sharename(struct unicode_map *um, const char *treename); 3962306a36Sopenharmony_ci#endif 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci#endif /* _SMB_UNICODE_H */ 42