diff options
Diffstat (limited to 'fs/fat/dir.c')
-rw-r--r-- | fs/fat/dir.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index ee42b9e0b16a..4ad64732cbce 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c | |||
@@ -98,7 +98,7 @@ next: | |||
98 | 98 | ||
99 | *bh = sb_bread(sb, phys); | 99 | *bh = sb_bread(sb, phys); |
100 | if (*bh == NULL) { | 100 | if (*bh == NULL) { |
101 | printk(KERN_ERR "FAT: Directory bread(block %llu) failed\n", | 101 | fat_msg(sb, KERN_ERR, "Directory bread(block %llu) failed", |
102 | (llu)phys); | 102 | (llu)phys); |
103 | /* skip this block */ | 103 | /* skip this block */ |
104 | *pos = (iblock + 1) << sb->s_blocksize_bits; | 104 | *pos = (iblock + 1) << sb->s_blocksize_bits; |
@@ -136,9 +136,10 @@ static inline int fat_get_entry(struct inode *dir, loff_t *pos, | |||
136 | * but ignore that right now. | 136 | * but ignore that right now. |
137 | * Ahem... Stack smashing in ring 0 isn't fun. Fixed. | 137 | * Ahem... Stack smashing in ring 0 isn't fun. Fixed. |
138 | */ | 138 | */ |
139 | static int uni16_to_x8(unsigned char *ascii, const wchar_t *uni, int len, | 139 | static int uni16_to_x8(struct super_block *sb, unsigned char *ascii, |
140 | int uni_xlate, struct nls_table *nls) | 140 | const wchar_t *uni, int len, struct nls_table *nls) |
141 | { | 141 | { |
142 | int uni_xlate = MSDOS_SB(sb)->options.unicode_xlate; | ||
142 | const wchar_t *ip; | 143 | const wchar_t *ip; |
143 | wchar_t ec; | 144 | wchar_t ec; |
144 | unsigned char *op; | 145 | unsigned char *op; |
@@ -166,23 +167,23 @@ static int uni16_to_x8(unsigned char *ascii, const wchar_t *uni, int len, | |||
166 | } | 167 | } |
167 | 168 | ||
168 | if (unlikely(*ip)) { | 169 | if (unlikely(*ip)) { |
169 | printk(KERN_WARNING "FAT: filename was truncated while " | 170 | fat_msg(sb, KERN_WARNING, "filename was truncated while " |
170 | "converting."); | 171 | "converting."); |
171 | } | 172 | } |
172 | 173 | ||
173 | *op = 0; | 174 | *op = 0; |
174 | return (op - ascii); | 175 | return (op - ascii); |
175 | } | 176 | } |
176 | 177 | ||
177 | static inline int fat_uni_to_x8(struct msdos_sb_info *sbi, const wchar_t *uni, | 178 | static inline int fat_uni_to_x8(struct super_block *sb, const wchar_t *uni, |
178 | unsigned char *buf, int size) | 179 | unsigned char *buf, int size) |
179 | { | 180 | { |
181 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | ||
180 | if (sbi->options.utf8) | 182 | if (sbi->options.utf8) |
181 | return utf16s_to_utf8s(uni, FAT_MAX_UNI_CHARS, | 183 | return utf16s_to_utf8s(uni, FAT_MAX_UNI_CHARS, |
182 | UTF16_HOST_ENDIAN, buf, size); | 184 | UTF16_HOST_ENDIAN, buf, size); |
183 | else | 185 | else |
184 | return uni16_to_x8(buf, uni, size, sbi->options.unicode_xlate, | 186 | return uni16_to_x8(sb, buf, uni, size, sbi->nls_io); |
185 | sbi->nls_io); | ||
186 | } | 187 | } |
187 | 188 | ||
188 | static inline int | 189 | static inline int |
@@ -419,7 +420,7 @@ parse_record: | |||
419 | 420 | ||
420 | /* Compare shortname */ | 421 | /* Compare shortname */ |
421 | bufuname[last_u] = 0x0000; | 422 | bufuname[last_u] = 0x0000; |
422 | len = fat_uni_to_x8(sbi, bufuname, bufname, sizeof(bufname)); | 423 | len = fat_uni_to_x8(sb, bufuname, bufname, sizeof(bufname)); |
423 | if (fat_name_match(sbi, name, name_len, bufname, len)) | 424 | if (fat_name_match(sbi, name, name_len, bufname, len)) |
424 | goto found; | 425 | goto found; |
425 | 426 | ||
@@ -428,7 +429,7 @@ parse_record: | |||
428 | int size = PATH_MAX - FAT_MAX_UNI_SIZE; | 429 | int size = PATH_MAX - FAT_MAX_UNI_SIZE; |
429 | 430 | ||
430 | /* Compare longname */ | 431 | /* Compare longname */ |
431 | len = fat_uni_to_x8(sbi, unicode, longname, size); | 432 | len = fat_uni_to_x8(sb, unicode, longname, size); |
432 | if (fat_name_match(sbi, name, name_len, longname, len)) | 433 | if (fat_name_match(sbi, name, name_len, longname, len)) |
433 | goto found; | 434 | goto found; |
434 | } | 435 | } |
@@ -545,7 +546,7 @@ parse_record: | |||
545 | if (nr_slots) { | 546 | if (nr_slots) { |
546 | void *longname = unicode + FAT_MAX_UNI_CHARS; | 547 | void *longname = unicode + FAT_MAX_UNI_CHARS; |
547 | int size = PATH_MAX - FAT_MAX_UNI_SIZE; | 548 | int size = PATH_MAX - FAT_MAX_UNI_SIZE; |
548 | int len = fat_uni_to_x8(sbi, unicode, longname, size); | 549 | int len = fat_uni_to_x8(sb, unicode, longname, size); |
549 | 550 | ||
550 | fill_name = longname; | 551 | fill_name = longname; |
551 | fill_len = len; | 552 | fill_len = len; |
@@ -621,7 +622,7 @@ parse_record: | |||
621 | 622 | ||
622 | if (isvfat) { | 623 | if (isvfat) { |
623 | bufuname[j] = 0x0000; | 624 | bufuname[j] = 0x0000; |
624 | i = fat_uni_to_x8(sbi, bufuname, bufname, sizeof(bufname)); | 625 | i = fat_uni_to_x8(sb, bufuname, bufname, sizeof(bufname)); |
625 | } | 626 | } |
626 | if (nr_slots) { | 627 | if (nr_slots) { |
627 | /* hack for fat_ioctl_filldir() */ | 628 | /* hack for fat_ioctl_filldir() */ |
@@ -979,6 +980,7 @@ static int __fat_remove_entries(struct inode *dir, loff_t pos, int nr_slots) | |||
979 | 980 | ||
980 | int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo) | 981 | int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo) |
981 | { | 982 | { |
983 | struct super_block *sb = dir->i_sb; | ||
982 | struct msdos_dir_entry *de; | 984 | struct msdos_dir_entry *de; |
983 | struct buffer_head *bh; | 985 | struct buffer_head *bh; |
984 | int err = 0, nr_slots; | 986 | int err = 0, nr_slots; |
@@ -1013,8 +1015,8 @@ int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo) | |||
1013 | */ | 1015 | */ |
1014 | err = __fat_remove_entries(dir, sinfo->slot_off, nr_slots); | 1016 | err = __fat_remove_entries(dir, sinfo->slot_off, nr_slots); |
1015 | if (err) { | 1017 | if (err) { |
1016 | printk(KERN_WARNING | 1018 | fat_msg(sb, KERN_WARNING, |
1017 | "FAT: Couldn't remove the long name slots\n"); | 1019 | "Couldn't remove the long name slots"); |
1018 | } | 1020 | } |
1019 | } | 1021 | } |
1020 | 1022 | ||
@@ -1265,7 +1267,7 @@ int fat_add_entries(struct inode *dir, void *slots, int nr_slots, | |||
1265 | if (sbi->fat_bits != 32) | 1267 | if (sbi->fat_bits != 32) |
1266 | goto error; | 1268 | goto error; |
1267 | } else if (MSDOS_I(dir)->i_start == 0) { | 1269 | } else if (MSDOS_I(dir)->i_start == 0) { |
1268 | printk(KERN_ERR "FAT: Corrupted directory (i_pos %lld)\n", | 1270 | fat_msg(sb, KERN_ERR, "Corrupted directory (i_pos %lld)", |
1269 | MSDOS_I(dir)->i_pos); | 1271 | MSDOS_I(dir)->i_pos); |
1270 | err = -EIO; | 1272 | err = -EIO; |
1271 | goto error; | 1273 | goto error; |