cifs: change cifs_get_name_from_search_buf to use new unicode helper
...and remove cifs_convertUCSpath. There are no more callers. Also add a #define for the buffer used in the readdir path so that we don't have so many magic numbers floating around. Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: Suresh Jayaraman <sjayaraman@suse.de> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
committed by
Steve French
parent
460b96960d
commit
f58841666b
@@ -635,66 +635,6 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Convert 16 bit Unicode pathname from wire format to string in current code
|
||||
page. Conversion may involve remapping up the seven characters that are
|
||||
only legal in POSIX-like OS (if they are present in the string). Path
|
||||
names are little endian 16 bit Unicode on the wire */
|
||||
int
|
||||
cifs_convertUCSpath(char *target, const __le16 *source, int maxlen,
|
||||
const struct nls_table *cp)
|
||||
{
|
||||
int i, j, len;
|
||||
__u16 src_char;
|
||||
|
||||
for (i = 0, j = 0; i < maxlen; i++) {
|
||||
src_char = le16_to_cpu(source[i]);
|
||||
switch (src_char) {
|
||||
case 0:
|
||||
goto cUCS_out; /* BB check this BB */
|
||||
case UNI_COLON:
|
||||
target[j] = ':';
|
||||
break;
|
||||
case UNI_ASTERIK:
|
||||
target[j] = '*';
|
||||
break;
|
||||
case UNI_QUESTION:
|
||||
target[j] = '?';
|
||||
break;
|
||||
/* BB We can not handle remapping slash until
|
||||
all the calls to build_path_from_dentry
|
||||
are modified, as they use slash as separator BB */
|
||||
/* case UNI_SLASH:
|
||||
target[j] = '\\';
|
||||
break;*/
|
||||
case UNI_PIPE:
|
||||
target[j] = '|';
|
||||
break;
|
||||
case UNI_GRTRTHAN:
|
||||
target[j] = '>';
|
||||
break;
|
||||
case UNI_LESSTHAN:
|
||||
target[j] = '<';
|
||||
break;
|
||||
default:
|
||||
len = cp->uni2char(src_char, &target[j],
|
||||
NLS_MAX_CHARSET_SIZE);
|
||||
if (len > 0) {
|
||||
j += len;
|
||||
continue;
|
||||
} else {
|
||||
target[j] = '?';
|
||||
}
|
||||
}
|
||||
j++;
|
||||
/* make sure we do not overrun callers allocated temp buffer */
|
||||
if (j >= (2 * NAME_MAX))
|
||||
break;
|
||||
}
|
||||
cUCS_out:
|
||||
target[j] = 0;
|
||||
return j;
|
||||
}
|
||||
|
||||
/* Convert 16 bit Unicode pathname to wire format from string in current code
|
||||
page. Conversion may involve remapping up the seven characters that are
|
||||
only legal in POSIX-like OS (if they are present in the string). Path
|
||||
|
Reference in New Issue
Block a user