diff options
Diffstat (limited to 'fs/cifs/cifs_unicode.c')
| -rw-r--r-- | fs/cifs/cifs_unicode.c | 41 | 
1 files changed, 21 insertions, 20 deletions
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index 1b2e180b018..fbb9da95184 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c @@ -27,17 +27,17 @@  #include "cifs_debug.h"  /* - * cifs_ucs2_bytes - how long will a string be after conversion? - * @ucs - pointer to input string + * cifs_utf16_bytes - how long will a string be after conversion? + * @utf16 - pointer to input string   * @maxbytes - don't go past this many bytes of input string   * @codepage - destination codepage   * - * Walk a ucs2le string and return the number of bytes that the string will + * Walk a utf16le string and return the number of bytes that the string will   * be after being converted to the given charset, not including any null   * termination required. Don't walk past maxbytes in the source buffer.   */  int -cifs_ucs2_bytes(const __le16 *from, int maxbytes, +cifs_utf16_bytes(const __le16 *from, int maxbytes,  		const struct nls_table *codepage)  {  	int i; @@ -122,7 +122,7 @@ cp_convert:  }  /* - * cifs_from_ucs2 - convert utf16le string to local charset + * cifs_from_utf16 - convert utf16le string to local charset   * @to - destination buffer   * @from - source buffer   * @tolen - destination buffer size (in bytes) @@ -130,7 +130,7 @@ cp_convert:   * @codepage - codepage to which characters should be converted   * @mapchar - should characters be remapped according to the mapchars option?   * - * Convert a little-endian ucs2le string (as sent by the server) to a string + * Convert a little-endian utf16le string (as sent by the server) to a string   * in the provided codepage. The tolen and fromlen parameters are to ensure   * that the code doesn't walk off of the end of the buffer (which is always   * a danger if the alignment of the source buffer is off). The destination @@ -139,12 +139,12 @@ cp_convert:   * null terminator).   *   * Note that some windows versions actually send multiword UTF-16 characters - * instead of straight UCS-2. The linux nls routines however aren't able to + * instead of straight UTF16-2. The linux nls routines however aren't able to   * deal with those characters properly. In the event that we get some of   * those characters, they won't be translated properly.   */  int -cifs_from_ucs2(char *to, const __le16 *from, int tolen, int fromlen, +cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen,  		 const struct nls_table *codepage, bool mapchar)  {  	int i, charlen, safelen; @@ -190,13 +190,13 @@ cifs_from_ucs2(char *to, const __le16 *from, int tolen, int fromlen,  }  /* - * NAME:	cifs_strtoUCS() + * NAME:	cifs_strtoUTF16()   *   * FUNCTION:	Convert character string to unicode string   *   */  int -cifs_strtoUCS(__le16 *to, const char *from, int len, +cifs_strtoUTF16(__le16 *to, const char *from, int len,  	      const struct nls_table *codepage)  {  	int charlen; @@ -206,7 +206,7 @@ cifs_strtoUCS(__le16 *to, const char *from, int len,  	for (i = 0; len && *from; i++, from += charlen, len -= charlen) {  		charlen = codepage->char2uni(from, len, &wchar_to);  		if (charlen < 1) { -			cERROR(1, "strtoUCS: char2uni of 0x%x returned %d", +			cERROR(1, "strtoUTF16: char2uni of 0x%x returned %d",  				*from, charlen);  			/* A question mark */  			wchar_to = 0x003f; @@ -220,7 +220,8 @@ cifs_strtoUCS(__le16 *to, const char *from, int len,  }  /* - * cifs_strndup_from_ucs - copy a string from wire format to the local codepage + * cifs_strndup_from_utf16 - copy a string from wire format to the local + * codepage   * @src - source string   * @maxlen - don't walk past this many bytes in the source string   * @is_unicode - is this a unicode string? @@ -231,19 +232,19 @@ cifs_strtoUCS(__le16 *to, const char *from, int len,   * error.   */  char * -cifs_strndup_from_ucs(const char *src, const int maxlen, const bool is_unicode, -	     const struct nls_table *codepage) +cifs_strndup_from_utf16(const char *src, const int maxlen, +			const bool is_unicode, const struct nls_table *codepage)  {  	int len;  	char *dst;  	if (is_unicode) { -		len = cifs_ucs2_bytes((__le16 *) src, maxlen, codepage); +		len = cifs_utf16_bytes((__le16 *) src, maxlen, codepage);  		len += nls_nullsize(codepage);  		dst = kmalloc(len, GFP_KERNEL);  		if (!dst)  			return NULL; -		cifs_from_ucs2(dst, (__le16 *) src, len, maxlen, codepage, +		cifs_from_utf16(dst, (__le16 *) src, len, maxlen, codepage,  			       false);  	} else {  		len = strnlen(src, maxlen); @@ -264,7 +265,7 @@ cifs_strndup_from_ucs(const char *src, const int maxlen, const bool is_unicode,   * names are little endian 16 bit Unicode on the wire   */  int -cifsConvertToUCS(__le16 *target, const char *source, int srclen, +cifsConvertToUTF16(__le16 *target, const char *source, int srclen,  		 const struct nls_table *cp, int mapChars)  {  	int i, j, charlen; @@ -273,7 +274,7 @@ cifsConvertToUCS(__le16 *target, const char *source, int srclen,  	wchar_t tmp;  	if (!mapChars) -		return cifs_strtoUCS(target, source, PATH_MAX, cp); +		return cifs_strtoUTF16(target, source, PATH_MAX, cp);  	for (i = 0, j = 0; i < srclen; j++) {  		src_char = source[i]; @@ -281,7 +282,7 @@ cifsConvertToUCS(__le16 *target, const char *source, int srclen,  		switch (src_char) {  		case 0:  			put_unaligned(0, &target[j]); -			goto ctoUCS_out; +			goto ctoUTF16_out;  		case ':':  			dst_char = cpu_to_le16(UNI_COLON);  			break; @@ -326,7 +327,7 @@ cifsConvertToUCS(__le16 *target, const char *source, int srclen,  		put_unaligned(dst_char, &target[j]);  	} -ctoUCS_out: +ctoUTF16_out:  	return i;  }  |