aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/readdir.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2009-04-30 07:18:00 -0400
committerSteve French <sfrench@us.ibm.com>2009-04-30 11:45:01 -0400
commitf58841666bc22e827ca0dcef7b71c7bc2758ce82 (patch)
tree5391996d11f791a6ade2c1df1ed795be2cc6e1ab /fs/cifs/readdir.c
parent460b96960d1946914e50316ffeefe7b41dddce91 (diff)
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>
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r--fs/cifs/readdir.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index ebd0da7ecb3d..e1351fe18a15 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -31,6 +31,13 @@
31#include "cifs_fs_sb.h" 31#include "cifs_fs_sb.h"
32#include "cifsfs.h" 32#include "cifsfs.h"
33 33
34/*
35 * To be safe - for UCS to UTF-8 with strings loaded with the rare long
36 * characters alloc more to account for such multibyte target UTF-8
37 * characters.
38 */
39#define UNICODE_NAME_MAX ((4 * NAME_MAX) + 2)
40
34#ifdef CONFIG_CIFS_DEBUG2 41#ifdef CONFIG_CIFS_DEBUG2
35static void dump_cifs_file_struct(struct file *file, char *label) 42static void dump_cifs_file_struct(struct file *file, char *label)
36{ 43{
@@ -881,14 +888,11 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
881 } 888 }
882 889
883 if (unicode) { 890 if (unicode) {
884 /* BB fixme - test with long names */ 891 pqst->len = cifs_from_ucs2((char *) pqst->name,
885 /* Note converted filename can be longer than in unicode */ 892 (__le16 *) filename,
886 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) 893 UNICODE_NAME_MAX, max_len, nlt,
887 pqst->len = cifs_convertUCSpath((char *)pqst->name, 894 cifs_sb->mnt_cifs_flags &
888 (__le16 *)filename, len/2, nlt); 895 CIFS_MOUNT_MAP_SPECIAL_CHR);
889 else
890 pqst->len = cifs_strfromUCS_le((char *)pqst->name,
891 (__le16 *)filename, len/2, nlt);
892 } else { 896 } else {
893 pqst->name = filename; 897 pqst->name = filename;
894 pqst->len = len; 898 pqst->len = len;
@@ -1070,11 +1074,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
1070 cifsFile->srch_inf.ntwrk_buf_start); 1074 cifsFile->srch_inf.ntwrk_buf_start);
1071 end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + max_len; 1075 end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + max_len;
1072 1076
1073 /* To be safe - for UCS to UTF-8 with strings loaded 1077 tmp_buf = kmalloc(UNICODE_NAME_MAX, GFP_KERNEL);
1074 with the rare long characters alloc more to account for
1075 such multibyte target UTF-8 characters. cifs_unicode.c,
1076 which actually does the conversion, has the same limit */
1077 tmp_buf = kmalloc((4 * NAME_MAX) + 2, GFP_KERNEL);
1078 for (i = 0; (i < num_to_fill) && (rc == 0); i++) { 1078 for (i = 0; (i < num_to_fill) && (rc == 0); i++) {
1079 if (current_entry == NULL) { 1079 if (current_entry == NULL) {
1080 /* evaluate whether this case is an error */ 1080 /* evaluate whether this case is an error */