diff options
author | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2008-11-06 15:53:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-06 18:41:20 -0500 |
commit | 7decd1cb0305b97243f283fa7f4baf5fe613edeb (patch) | |
tree | d17b291fd622c8ea45fd0ac8346f3c82c13759b6 /fs/fat/namei_vfat.c | |
parent | 9e975dae2970d22557662761c8505ce9fd165684 (diff) |
fat: Fix and cleanup timestamp conversion
This cleans date_dos2unix()/fat_date_unix2dos() up. New code should be
much more readable.
And this fixes those old functions. Those doesn't handle 2100
correctly. 2100 isn't leap year, but old one handles it as leap year.
Also, with this, centi sec is handled and is fixed.
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fat/namei_vfat.c')
-rw-r--r-- | fs/fat/namei_vfat.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index facf3bf0211a..1536bc3ca0f0 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -568,6 +568,7 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name, | |||
568 | unsigned char msdos_name[MSDOS_NAME]; | 568 | unsigned char msdos_name[MSDOS_NAME]; |
569 | wchar_t *uname; | 569 | wchar_t *uname; |
570 | __le16 time, date; | 570 | __le16 time, date; |
571 | u8 time_cs; | ||
571 | int err, ulen, usize, i; | 572 | int err, ulen, usize, i; |
572 | loff_t offset; | 573 | loff_t offset; |
573 | 574 | ||
@@ -620,10 +621,10 @@ shortname: | |||
620 | memcpy(de->name, msdos_name, MSDOS_NAME); | 621 | memcpy(de->name, msdos_name, MSDOS_NAME); |
621 | de->attr = is_dir ? ATTR_DIR : ATTR_ARCH; | 622 | de->attr = is_dir ? ATTR_DIR : ATTR_ARCH; |
622 | de->lcase = lcase; | 623 | de->lcase = lcase; |
623 | fat_date_unix2dos(ts->tv_sec, &time, &date, sbi->options.tz_utc); | 624 | fat_time_unix2fat(sbi, ts, &time, &date, &time_cs); |
624 | de->time = de->ctime = time; | 625 | de->time = de->ctime = time; |
625 | de->date = de->cdate = de->adate = date; | 626 | de->date = de->cdate = de->adate = date; |
626 | de->ctime_cs = 0; | 627 | de->ctime_cs = time_cs; |
627 | de->start = cpu_to_le16(cluster); | 628 | de->start = cpu_to_le16(cluster); |
628 | de->starthi = cpu_to_le16(cluster >> 16); | 629 | de->starthi = cpu_to_le16(cluster >> 16); |
629 | de->size = 0; | 630 | de->size = 0; |