forked from Minki/linux
Merge git://git.kernel.org/pub/scm/linux/kernel/git/hirofumi/fatfs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/hirofumi/fatfs-2.6: fat: Check s_dirt in fat_sync_fs() vfat: change the default from shortname=lower to shortname=mixed fat/nls: Fix handling of utf8 invalid char
This commit is contained in:
commit
4c8f1cb266
@ -102,7 +102,7 @@ shortname=lower|win95|winnt|mixed
|
||||
winnt: emulate the Windows NT rule for display/create.
|
||||
mixed: emulate the Windows NT rule for display,
|
||||
emulate the Windows 95 rule for create.
|
||||
Default setting is `lower'.
|
||||
Default setting is `mixed'.
|
||||
|
||||
tz=UTC -- Interpret timestamps as UTC rather than local time.
|
||||
This option disables the conversion of timestamps
|
||||
|
@ -323,7 +323,7 @@ extern int fat_flush_inodes(struct super_block *sb, struct inode *i1,
|
||||
/* fat/misc.c */
|
||||
extern void fat_fs_error(struct super_block *s, const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 2, 3))) __cold;
|
||||
extern void fat_clusters_flush(struct super_block *sb);
|
||||
extern int fat_clusters_flush(struct super_block *sb);
|
||||
extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
|
||||
extern void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts,
|
||||
__le16 __time, __le16 __date, u8 time_cs);
|
||||
|
@ -451,12 +451,16 @@ static void fat_write_super(struct super_block *sb)
|
||||
|
||||
static int fat_sync_fs(struct super_block *sb, int wait)
|
||||
{
|
||||
lock_super(sb);
|
||||
fat_clusters_flush(sb);
|
||||
sb->s_dirt = 0;
|
||||
unlock_super(sb);
|
||||
int err = 0;
|
||||
|
||||
return 0;
|
||||
if (sb->s_dirt) {
|
||||
lock_super(sb);
|
||||
sb->s_dirt = 0;
|
||||
err = fat_clusters_flush(sb);
|
||||
unlock_super(sb);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static void fat_put_super(struct super_block *sb)
|
||||
@ -812,7 +816,7 @@ static int fat_show_options(struct seq_file *m, struct vfsmount *mnt)
|
||||
seq_puts(m, ",shortname=mixed");
|
||||
break;
|
||||
case VFAT_SFN_DISPLAY_LOWER | VFAT_SFN_CREATE_WIN95:
|
||||
/* seq_puts(m, ",shortname=lower"); */
|
||||
seq_puts(m, ",shortname=lower");
|
||||
break;
|
||||
default:
|
||||
seq_puts(m, ",shortname=unknown");
|
||||
@ -963,7 +967,7 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug,
|
||||
opts->codepage = fat_default_codepage;
|
||||
opts->iocharset = fat_default_iocharset;
|
||||
if (is_vfat) {
|
||||
opts->shortname = VFAT_SFN_DISPLAY_LOWER|VFAT_SFN_CREATE_WIN95;
|
||||
opts->shortname = VFAT_SFN_DISPLAY_WINNT|VFAT_SFN_CREATE_WIN95;
|
||||
opts->rodir = 0;
|
||||
} else {
|
||||
opts->shortname = 0;
|
||||
|
@ -43,19 +43,19 @@ EXPORT_SYMBOL_GPL(fat_fs_error);
|
||||
|
||||
/* Flushes the number of free clusters on FAT32 */
|
||||
/* XXX: Need to write one per FSINFO block. Currently only writes 1 */
|
||||
void fat_clusters_flush(struct super_block *sb)
|
||||
int fat_clusters_flush(struct super_block *sb)
|
||||
{
|
||||
struct msdos_sb_info *sbi = MSDOS_SB(sb);
|
||||
struct buffer_head *bh;
|
||||
struct fat_boot_fsinfo *fsinfo;
|
||||
|
||||
if (sbi->fat_bits != 32)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
bh = sb_bread(sb, sbi->fsinfo_sector);
|
||||
if (bh == NULL) {
|
||||
printk(KERN_ERR "FAT: bread failed in fat_clusters_flush\n");
|
||||
return;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
fsinfo = (struct fat_boot_fsinfo *)bh->b_data;
|
||||
@ -74,6 +74,8 @@ void fat_clusters_flush(struct super_block *sb)
|
||||
mark_buffer_dirty(bh);
|
||||
}
|
||||
brelse(bh);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -499,17 +499,10 @@ xlate_to_uni(const unsigned char *name, int len, unsigned char *outname,
|
||||
int charlen;
|
||||
|
||||
if (utf8) {
|
||||
int name_len = strlen(name);
|
||||
|
||||
*outlen = utf8s_to_utf16s(name, PATH_MAX, (wchar_t *) outname);
|
||||
|
||||
/*
|
||||
* We stripped '.'s before and set len appropriately,
|
||||
* but utf8s_to_utf16s doesn't care about len
|
||||
*/
|
||||
*outlen -= (name_len - len);
|
||||
|
||||
if (*outlen > 255)
|
||||
*outlen = utf8s_to_utf16s(name, len, (wchar_t *)outname);
|
||||
if (*outlen < 0)
|
||||
return *outlen;
|
||||
else if (*outlen > 255)
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
op = &outname[*outlen * sizeof(wchar_t)];
|
||||
|
@ -124,10 +124,10 @@ int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs)
|
||||
while (*s && len > 0) {
|
||||
if (*s & 0x80) {
|
||||
size = utf8_to_utf32(s, len, &u);
|
||||
if (size < 0) {
|
||||
/* Ignore character and move on */
|
||||
size = 1;
|
||||
} else if (u >= PLANE_SIZE) {
|
||||
if (size < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (u >= PLANE_SIZE) {
|
||||
u -= PLANE_SIZE;
|
||||
*op++ = (wchar_t) (SURROGATE_PAIR |
|
||||
((u >> 10) & SURROGATE_BITS));
|
||||
|
Loading…
Reference in New Issue
Block a user