Commit 3b26a2ed authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] small cleanup of fat (3/3)

 - cleanup
 - remove unneeded mark_inode_dirty() in fat_extend_dir()
parent f4c4ca9d
...@@ -208,7 +208,6 @@ struct buffer_head *fat_extend_dir(struct inode *inode) ...@@ -208,7 +208,6 @@ struct buffer_head *fat_extend_dir(struct inode *inode)
} }
inode->i_size += 1 << MSDOS_SB(sb)->cluster_bits; inode->i_size += 1 << MSDOS_SB(sb)->cluster_bits;
MSDOS_I(inode)->mmu_private += 1 << MSDOS_SB(sb)->cluster_bits; MSDOS_I(inode)->mmu_private += 1 << MSDOS_SB(sb)->cluster_bits;
mark_inode_dirty(inode);
return res; return res;
} }
......
...@@ -690,42 +690,39 @@ xlate_to_uni(const char *name, int len, char *outname, int *longlen, int *outlen ...@@ -690,42 +690,39 @@ xlate_to_uni(const char *name, int len, char *outname, int *longlen, int *outlen
return 0; return 0;
} }
static int static int vfat_build_slots(struct inode *dir, const char *name, int len,
vfat_fill_slots(struct inode *dir, struct msdos_dir_slot *ds, const char *name, struct msdos_dir_slot *ds, int *slots, int is_dir)
int len, int *slots, int is_dir, int uni_xlate)
{ {
struct nls_table *nls_io, *nls_disk; struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
wchar_t *uname; struct fat_mount_options *opts = &sbi->options;
struct msdos_dir_slot *ps; struct msdos_dir_slot *ps;
struct msdos_dir_entry *de; struct msdos_dir_entry *de;
unsigned long page; unsigned long page;
unsigned char cksum, lcase; unsigned char cksum, lcase;
char *uniname, msdos_name[MSDOS_NAME]; char msdos_name[MSDOS_NAME];
int res, utf8, slot, ulen, unilen, i; wchar_t *uname;
int res, slot, ulen, usize, i;
loff_t offset; loff_t offset;
*slots = 0; *slots = 0;
utf8 = MSDOS_SB(dir->i_sb)->options.utf8; res = vfat_valid_longname(name, len, opts->unicode_xlate);
nls_io = MSDOS_SB(dir->i_sb)->nls_io; if (res < 0)
nls_disk = MSDOS_SB(dir->i_sb)->nls_disk; return res;
if (name[len-1] == '.')
len--;
if(!(page = __get_free_page(GFP_KERNEL))) if(!(page = __get_free_page(GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
uniname = (char *) page; uname = (wchar_t *)page;
res = xlate_to_uni(name, len, uniname, &ulen, &unilen, uni_xlate, res = xlate_to_uni(name, len, (char *)uname, &ulen, &usize,
utf8, nls_io); opts->unicode_xlate, opts->utf8, sbi->nls_io);
if (res < 0) if (res < 0)
goto out_free; goto out_free;
uname = (wchar_t *) page;
res = vfat_is_used_badchars(uname, ulen); res = vfat_is_used_badchars(uname, ulen);
if (res < 0) if (res < 0)
goto out_free; goto out_free;
res = vfat_create_shortname(dir, nls_disk, uname, ulen, res = vfat_create_shortname(dir, sbi->nls_disk, uname, ulen,
msdos_name, &lcase); msdos_name, &lcase);
if (res < 0) if (res < 0)
goto out_free; goto out_free;
...@@ -736,7 +733,7 @@ vfat_fill_slots(struct inode *dir, struct msdos_dir_slot *ds, const char *name, ...@@ -736,7 +733,7 @@ vfat_fill_slots(struct inode *dir, struct msdos_dir_slot *ds, const char *name,
} }
/* build the entry of long file name */ /* build the entry of long file name */
*slots = unilen / 13; *slots = usize / 13;
for (cksum = i = 0; i < 11; i++) { for (cksum = i = 0; i < 11; i++) {
cksum = (((cksum&1)<<7)|((cksum&0xfe)>>1)) + msdos_name[i]; cksum = (((cksum&1)<<7)|((cksum&0xfe)>>1)) + msdos_name[i];
} }
...@@ -774,21 +771,6 @@ vfat_fill_slots(struct inode *dir, struct msdos_dir_slot *ds, const char *name, ...@@ -774,21 +771,6 @@ vfat_fill_slots(struct inode *dir, struct msdos_dir_slot *ds, const char *name,
return res; return res;
} }
/* We can't get "." or ".." here - VFS takes care of those cases */
static int vfat_build_slots(struct inode *dir, const char *name, int len,
struct msdos_dir_slot *ds, int *slots, int is_dir)
{
int res, xlate;
xlate = MSDOS_SB(dir->i_sb)->options.unicode_xlate;
res = vfat_valid_longname(name, len, xlate);
if (res < 0)
return res;
return vfat_fill_slots(dir, ds, name, len, slots, is_dir, xlate);
}
static int vfat_add_entry(struct inode *dir,struct qstr* qname, static int vfat_add_entry(struct inode *dir,struct qstr* qname,
int is_dir, struct vfat_slot_info *sinfo_out, int is_dir, struct vfat_slot_info *sinfo_out,
struct buffer_head **bh, struct msdos_dir_entry **de) struct buffer_head **bh, struct msdos_dir_entry **de)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment