diff options
author | Stephane Kardas <stephane.kardas@certa.ssi.gouv.fr> | 2005-09-21 12:55:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-21 13:12:18 -0400 |
commit | 62a36c43c898d45efcfe3376ea1da6a9a182e1ad (patch) | |
tree | 3d2e39625a2ca620ef71433cf100ff51a225438b /fs | |
parent | 89d7cbf73e1a85241eb42339f6cb7a429fec178c (diff) |
[PATCH] fat: fix adate
During a forensic analysis on the fat file system, I found than the result for
the last access date on this file system was different between the stat
command and the istat command (package tct-utils).
The istat command display a true date (the right windows date) but the stat
primitive (so stat, find, ls command) displays a wrong date.
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fat/inode.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 51b1d15d9d5c..e2effe2dc9b2 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -300,9 +300,9 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) | |||
300 | inode->i_blksize = sbi->cluster_size; | 300 | inode->i_blksize = sbi->cluster_size; |
301 | inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1)) | 301 | inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1)) |
302 | & ~((loff_t)sbi->cluster_size - 1)) >> 9; | 302 | & ~((loff_t)sbi->cluster_size - 1)) >> 9; |
303 | inode->i_mtime.tv_sec = inode->i_atime.tv_sec = | 303 | inode->i_mtime.tv_sec = |
304 | date_dos2unix(le16_to_cpu(de->time), le16_to_cpu(de->date)); | 304 | date_dos2unix(le16_to_cpu(de->time), le16_to_cpu(de->date)); |
305 | inode->i_mtime.tv_nsec = inode->i_atime.tv_nsec = 0; | 305 | inode->i_mtime.tv_nsec = 0; |
306 | if (sbi->options.isvfat) { | 306 | if (sbi->options.isvfat) { |
307 | int secs = de->ctime_cs / 100; | 307 | int secs = de->ctime_cs / 100; |
308 | int csecs = de->ctime_cs % 100; | 308 | int csecs = de->ctime_cs % 100; |
@@ -310,8 +310,11 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) | |||
310 | date_dos2unix(le16_to_cpu(de->ctime), | 310 | date_dos2unix(le16_to_cpu(de->ctime), |
311 | le16_to_cpu(de->cdate)) + secs; | 311 | le16_to_cpu(de->cdate)) + secs; |
312 | inode->i_ctime.tv_nsec = csecs * 10000000; | 312 | inode->i_ctime.tv_nsec = csecs * 10000000; |
313 | inode->i_atime.tv_sec = | ||
314 | date_dos2unix(le16_to_cpu(0), le16_to_cpu(de->adate)); | ||
315 | inode->i_atime.tv_nsec = 0; | ||
313 | } else | 316 | } else |
314 | inode->i_ctime = inode->i_mtime; | 317 | inode->i_ctime = inode->i_atime = inode->i_mtime; |
315 | 318 | ||
316 | return 0; | 319 | return 0; |
317 | } | 320 | } |
@@ -513,7 +516,9 @@ retry: | |||
513 | raw_entry->starthi = cpu_to_le16(MSDOS_I(inode)->i_logstart >> 16); | 516 | raw_entry->starthi = cpu_to_le16(MSDOS_I(inode)->i_logstart >> 16); |
514 | fat_date_unix2dos(inode->i_mtime.tv_sec, &raw_entry->time, &raw_entry->date); | 517 | fat_date_unix2dos(inode->i_mtime.tv_sec, &raw_entry->time, &raw_entry->date); |
515 | if (sbi->options.isvfat) { | 518 | if (sbi->options.isvfat) { |
519 | __le16 atime; | ||
516 | fat_date_unix2dos(inode->i_ctime.tv_sec,&raw_entry->ctime,&raw_entry->cdate); | 520 | fat_date_unix2dos(inode->i_ctime.tv_sec,&raw_entry->ctime,&raw_entry->cdate); |
521 | fat_date_unix2dos(inode->i_atime.tv_sec,&atime,&raw_entry->adate); | ||
517 | raw_entry->ctime_cs = (inode->i_ctime.tv_sec & 1) * 100 + | 522 | raw_entry->ctime_cs = (inode->i_ctime.tv_sec & 1) * 100 + |
518 | inode->i_ctime.tv_nsec / 10000000; | 523 | inode->i_ctime.tv_nsec / 10000000; |
519 | } | 524 | } |