summaryrefslogtreecommitdiffstats
path: root/fs/vfat/namei.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-09-19 19:15:08 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-09-19 19:15:08 +0000
commit03ba4131783cc9e872f8bb26a03f15bc11f27564 (patch)
tree88db8dba75ae06ba3bad08e42c5e52efc162535c /fs/vfat/namei.c
parent257730f99381dd26e10b832fce4c94cae7ac1176 (diff)
- Merge with Linux 2.1.121.
- Bugfixes.
Diffstat (limited to 'fs/vfat/namei.c')
-rw-r--r--fs/vfat/namei.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c
index be37113d5..fe1565106 100644
--- a/fs/vfat/namei.c
+++ b/fs/vfat/namei.c
@@ -100,22 +100,6 @@ static struct dentry_operations vfat_dentry_ops[4] = {
}
};
-static int strnicmp(const char *s1, const char *s2, int len)
-{
- int n = 0;
- while (*s1 && *s2 && (tolower(*s1) == tolower(*s2))) {
- s1++; s2++; n++;
- if (n == len) return 0;
- }
- if (*s1 == 0 && *s2 == 0) return 0;
- if (*s1 && *s2) {
- if (*s1 > *s2) return 1;
- return -1;
- }
- if (*s1) return 1;
- return -1;
-}
-
void vfat_put_super(struct super_block *sb)
{
fat_put_super(sb);
@@ -1771,8 +1755,6 @@ int vfat_rename(struct inode *old_dir,struct dentry *old_dentry,
MSDOS_I(new_inode)->i_logstart = MSDOS_I(old_inode)->i_logstart;
MSDOS_I(new_inode)->i_attrs = MSDOS_I(old_inode)->i_attrs;
- old_inode->i_nlink = 0;
-
fat_cache_inval_inode(old_inode);
mark_inode_dirty(new_inode);
@@ -1816,6 +1798,16 @@ int vfat_rename(struct inode *old_dir,struct dentry *old_dentry,
fat_brelse(sb, dotdot_bh);
}
+ /*
+ * This convinces the VFS layer to drop the old inode,
+ * but at the same time fools the VFAT layer to not
+ * actually delete any of the blocks in the old file
+ * (because they are very much used by the renamed file)
+ */
+ MSDOS_I(old_inode)->i_start = 0;
+ MSDOS_I(old_inode)->i_logstart = 0;
+ old_inode->i_nlink = 0;
+
if (res > 0) res = 0;
if (res == 0) {