aboutsummaryrefslogtreecommitdiffstats
path: root/fs/msdos
diff options
context:
space:
mode:
authorJoe Peterson <joe@skyrush.com>2008-07-25 04:46:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:34 -0400
commitb271e067c896ad4082b15e96077675d08db40625 (patch)
tree1837d1c988226116e277c4f71b7f57aed5a7df05 /fs/msdos
parente8938a62a85d1f487e02c3b01955b47c9598f6d2 (diff)
fatfs: add UTC timestamp option
Provide a new mount option ("tz=UTC") for DOS (vfat/msdos) filesystems, allowing timestamps to be in coordinated universal time (UTC) rather than local time in applications where doing this is advantageous. In particular, portable devices that use fat/vfat (such as digital cameras) can benefit from using UTC in their internal clocks, thus avoiding daylight saving time errors and general time ambiguity issues. The user of the device does not have to worry about changing the time when moving from place or when daylight saving changes. The new mount option, when set, disables the counter-adjustment that Linux currently makes to FAT timestamp info in anticipation of the normal userspace time zone correction. When used in this new mode, all daylight saving time and time zone handling is done in userspace as is normal for many other filesystems (like ext3). The default mode, which remains unchanged, is still appropriate when mounting volumes written in Windows (because of its use of local time). I originally based this patch on one submitted last year by Paul Collins, but I updated it to work with current source and changed variable/option naming. Ogawa Hirofumi (who maintains these filesystems) and I discussed this patch at length on lkml, and he suggested using the option name in the attached version of the patch. Barry Bouwsma pointed out a good addition to the patch as well. Signed-off-by: Joe Peterson <joe@skyrush.com> Signed-off-by: Paul Collins <paul@ondioline.org> Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Cc: Barry Bouwsma <free_beer_for_all@yahoo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/msdos')
-rw-r--r--fs/msdos/namei.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c
index e4ad6c6b753e..e844b9809d27 100644
--- a/fs/msdos/namei.c
+++ b/fs/msdos/namei.c
@@ -237,6 +237,7 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name,
237 int is_dir, int is_hid, int cluster, 237 int is_dir, int is_hid, int cluster,
238 struct timespec *ts, struct fat_slot_info *sinfo) 238 struct timespec *ts, struct fat_slot_info *sinfo)
239{ 239{
240 struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
240 struct msdos_dir_entry de; 241 struct msdos_dir_entry de;
241 __le16 time, date; 242 __le16 time, date;
242 int err; 243 int err;
@@ -246,7 +247,7 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name,
246 if (is_hid) 247 if (is_hid)
247 de.attr |= ATTR_HIDDEN; 248 de.attr |= ATTR_HIDDEN;
248 de.lcase = 0; 249 de.lcase = 0;
249 fat_date_unix2dos(ts->tv_sec, &time, &date); 250 fat_date_unix2dos(ts->tv_sec, &time, &date, sbi->options.tz_utc);
250 de.cdate = de.adate = 0; 251 de.cdate = de.adate = 0;
251 de.ctime = 0; 252 de.ctime = 0;
252 de.ctime_cs = 0; 253 de.ctime_cs = 0;