2019-05-27 08:55:05 +02:00
/* SPDX-License-Identifier: GPL-2.0-or-later */
2005-04-16 15:20:36 -07:00
/*
* cifs_unicode : Unicode kernel case support
*
* Function :
* Convert a unicode character to upper or lower case using
* compressed tables .
*
2009-04-30 17:45:10 +00:00
* Copyright ( c ) International Business Machines Corp . , 2000 , 2009
2005-04-16 15:20:36 -07:00
*
* Notes :
* These APIs are based on the C library functions . The semantics
* should match the C functions but with expanded size operands .
*
* The upper / lower functions are based on a table created by mkupr .
* This is a compressed table of upper and lower case conversion .
*/
2010-08-20 00:27:12 +04:00
# ifndef _CIFS_UNICODE_H
# define _CIFS_UNICODE_H
2005-04-16 15:20:36 -07:00
# include <asm/byteorder.h>
# include <linux/types.h>
# include <linux/nls.h>
2023-08-17 01:22:31 +01:00
# include "../../nls/nls_ucs2_utils.h"
2009-04-30 06:45:08 -04:00
2014-09-25 13:20:05 -05:00
/*
* Macs use an older " SFM " mapping of the symbols above . Fortunately it does
* not conflict ( although almost does ) with the mapping above .
*/
2017-05-05 04:36:16 +02:00
# define SFM_DOUBLEQUOTE ((__u16) 0xF020)
2014-09-25 13:20:05 -05:00
# define SFM_ASTERISK ((__u16) 0xF021)
# define SFM_QUESTION ((__u16) 0xF025)
# define SFM_COLON ((__u16) 0xF022)
# define SFM_GRTRTHAN ((__u16) 0xF024)
# define SFM_LESSTHAN ((__u16) 0xF023)
# define SFM_PIPE ((__u16) 0xF027)
# define SFM_SLASH ((__u16) 0xF026)
2017-05-03 23:47:44 +02:00
# define SFM_SPACE ((__u16) 0xF028)
# define SFM_PERIOD ((__u16) 0xF029)
2014-09-25 13:20:05 -05:00
/*
* Mapping mechanism to use when one of the seven reserved characters is
* encountered . We can only map using one of the mechanisms at a time
* since otherwise readdir could return directory entries which we would
* not be able to open
*
* NO_MAP_UNI_RSVD = do not perform any remapping of the character
* SFM_MAP_UNI_RSVD = map reserved characters using SFM scheme ( MAC compatible )
* SFU_MAP_UNI_RSVD = map reserved characters ala SFU ( " mapchars " option )
*
*/
# define NO_MAP_UNI_RSVD 0
# define SFM_MAP_UNI_RSVD 1
# define SFU_MAP_UNI_RSVD 2
2005-04-16 15:20:36 -07:00
# ifdef __KERNEL__
2012-01-18 22:32:33 -06:00
int cifs_from_utf16 ( char * to , const __le16 * from , int tolen , int fromlen ,
2014-09-25 13:20:05 -05:00
const struct nls_table * cp , int map_type ) ;
2012-01-18 22:32:33 -06:00
int cifs_utf16_bytes ( const __le16 * from , int maxbytes ,
const struct nls_table * codepage ) ;
int cifs_strtoUTF16 ( __le16 * , const char * , int , const struct nls_table * ) ;
char * cifs_strndup_from_utf16 ( const char * src , const int maxlen ,
const bool is_unicode ,
const struct nls_table * codepage ) ;
extern int cifsConvertToUTF16 ( __le16 * target , const char * source , int maxlen ,
const struct nls_table * cp , int mapChars ) ;
2014-09-27 02:19:01 -05:00
extern int cifs_remap ( struct cifs_sb_info * cifs_sb ) ;
2011-12-26 22:58:46 +04:00
extern __le16 * cifs_strndup_to_utf16 ( const char * src , const int maxlen ,
int * utf16_len , const struct nls_table * cp ,
int remap ) ;
2005-04-16 15:20:36 -07:00
# endif
2013-09-05 08:38:11 -04:00
wchar_t cifs_toupper ( wchar_t in ) ;
2010-08-20 00:27:12 +04:00
# endif /* _CIFS_UNICODE_H */