Commit f76e3f49 authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] VFAT: ->i_[cam]time cleanups (1/6)

From René Scharfe <l.s.r@web.de>

there's one call to strncpy() in vfat that really should be a memcpy().
The source, msdos_name, is a space-filled char array, not a
NUL-terminated string.

The rest of the patch eliminates duplicate occurencies of the
CURRENT_TIME macro inside functions. This shrinks vfat.o by a few
bytes.
parent 07bd1e13
...@@ -714,7 +714,7 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name, ...@@ -714,7 +714,7 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name,
PRINTK3(("vfat_fill_slots 9\n")); PRINTK3(("vfat_fill_slots 9\n"));
/* build the entry of 8.3 alias name */ /* build the entry of 8.3 alias name */
(*slots)++; (*slots)++;
strncpy(de->name, msdos_name, MSDOS_NAME); memcpy(de->name, msdos_name, MSDOS_NAME);
de->attr = is_dir ? ATTR_DIR : ATTR_ARCH; de->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
de->lcase = lcase; de->lcase = lcase;
de->adate = de->cdate = de->date = 0; de->adate = de->cdate = de->date = 0;
...@@ -901,8 +901,7 @@ static void vfat_remove_entry(struct inode *dir,struct vfat_slot_info *sinfo, ...@@ -901,8 +901,7 @@ static void vfat_remove_entry(struct inode *dir,struct vfat_slot_info *sinfo,
int i; int i;
/* remove the shortname */ /* remove the shortname */
dir->i_mtime = CURRENT_TIME; dir->i_mtime = dir->i_atime = CURRENT_TIME;
dir->i_atime = CURRENT_TIME;
dir->i_version++; dir->i_version++;
mark_inode_dirty(dir); mark_inode_dirty(dir);
de->name[0] = DELETED_FLAG; de->name[0] = DELETED_FLAG;
...@@ -939,8 +938,7 @@ int vfat_rmdir(struct inode *dir,struct dentry* dentry) ...@@ -939,8 +938,7 @@ int vfat_rmdir(struct inode *dir,struct dentry* dentry)
return res; return res;
} }
dentry->d_inode->i_nlink = 0; dentry->d_inode->i_nlink = 0;
dentry->d_inode->i_mtime = CURRENT_TIME; dentry->d_inode->i_mtime = dentry->d_inode->i_atime = CURRENT_TIME;
dentry->d_inode->i_atime = CURRENT_TIME;
fat_detach(dentry->d_inode); fat_detach(dentry->d_inode);
mark_inode_dirty(dentry->d_inode); mark_inode_dirty(dentry->d_inode);
/* releases bh */ /* releases bh */
...@@ -965,8 +963,7 @@ int vfat_unlink(struct inode *dir, struct dentry* dentry) ...@@ -965,8 +963,7 @@ int vfat_unlink(struct inode *dir, struct dentry* dentry)
return res; return res;
} }
dentry->d_inode->i_nlink = 0; dentry->d_inode->i_nlink = 0;
dentry->d_inode->i_mtime = CURRENT_TIME; dentry->d_inode->i_mtime = dentry->d_inode->i_atime = CURRENT_TIME;
dentry->d_inode->i_atime = CURRENT_TIME;
fat_detach(dentry->d_inode); fat_detach(dentry->d_inode);
mark_inode_dirty(dentry->d_inode); mark_inode_dirty(dentry->d_inode);
/* releases bh */ /* releases bh */
...@@ -1013,8 +1010,7 @@ int vfat_mkdir(struct inode *dir,struct dentry* dentry,int mode) ...@@ -1013,8 +1010,7 @@ int vfat_mkdir(struct inode *dir,struct dentry* dentry,int mode)
mkdir_failed: mkdir_failed:
inode->i_nlink = 0; inode->i_nlink = 0;
inode->i_mtime = CURRENT_TIME; inode->i_mtime = inode->i_atime = CURRENT_TIME;
inode->i_atime = CURRENT_TIME;
fat_detach(inode); fat_detach(inode);
mark_inode_dirty(inode); mark_inode_dirty(inode);
/* releases bh */ /* releases bh */
......
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