mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
Use atomic_t for cifs_sb_info::mnt_cifs_flags as it's currently accessed locklessly and may be changed concurrently in mount/remount and reconnect paths. Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org> Reviewed-by: David Howells <dhowells@redhat.com> Cc: linux-cifs@vger.kernel.org Signed-off-by: Steve French <stfrench@microsoft.com>
87 lines
2.9 KiB
C
87 lines
2.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* cifs_unicode: Unicode kernel case support
|
|
*
|
|
* Function:
|
|
* Convert a unicode character to upper or lower case using
|
|
* compressed tables.
|
|
*
|
|
* Copyright (c) International Business Machines Corp., 2000,2009
|
|
*
|
|
* 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.
|
|
*/
|
|
#ifndef _CIFS_UNICODE_H
|
|
#define _CIFS_UNICODE_H
|
|
|
|
#include <asm/byteorder.h>
|
|
#include <linux/types.h>
|
|
#include <linux/nls.h>
|
|
#include "../../nls/nls_ucs2_utils.h"
|
|
#include "cifsglob.h"
|
|
|
|
/*
|
|
* Macs use an older "SFM" mapping of the symbols above. Fortunately it does
|
|
* not conflict (although almost does) with the mapping above.
|
|
*/
|
|
|
|
#define SFM_DOUBLEQUOTE ((__u16) 0xF020)
|
|
#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)
|
|
#define SFM_SPACE ((__u16) 0xF028)
|
|
#define SFM_PERIOD ((__u16) 0xF029)
|
|
|
|
/*
|
|
* 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
|
|
|
|
int cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen,
|
|
const struct nls_table *codepage, int map_type);
|
|
int cifs_utf16_bytes(const __le16 *from, int maxbytes,
|
|
const struct nls_table *codepage);
|
|
int cifs_strtoUTF16(__le16 *to, const char *from, int len,
|
|
const struct nls_table *codepage);
|
|
char *cifs_strndup_from_utf16(const char *src, const int maxlen,
|
|
const bool is_unicode,
|
|
const struct nls_table *codepage);
|
|
int cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
|
|
const struct nls_table *cp, int map_chars);
|
|
__le16 *cifs_strndup_to_utf16(const char *src, const int maxlen,
|
|
int *utf16_len, const struct nls_table *cp,
|
|
int remap);
|
|
wchar_t cifs_toupper(wchar_t in);
|
|
|
|
static inline int cifs_remap(const struct cifs_sb_info *cifs_sb)
|
|
{
|
|
unsigned int sbflags = cifs_sb_flags(cifs_sb);
|
|
|
|
if (sbflags & CIFS_MOUNT_MAP_SFM_CHR)
|
|
return SFM_MAP_UNI_RSVD;
|
|
if (sbflags & CIFS_MOUNT_MAP_SPECIAL_CHR)
|
|
return SFU_MAP_UNI_RSVD;
|
|
|
|
return NO_MAP_UNI_RSVD;
|
|
}
|
|
|
|
#endif /* _CIFS_UNICODE_H */
|