aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fat/inode.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-12-17 19:02:58 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-17 20:15:22 -0500
commit58156c8fbf43e71dd091848d4dbfd780d04016e6 (patch)
treeffe31e639221d1f2434f873f93d3ee654cbfb9da /fs/fat/inode.c
parentf562146a3daf6aa0bbf2a1bc4b6b7da031ed5dcd (diff)
fat: provide option for setting timezone offset
So far FAT either offsets time stamps by sys_tz.minuteswest or leaves them as they are (when tz=UTC mount option is used). However in some cases it is useful if one can specify time stamp offset on his own (e.g. when time zone of the camera connected is different from time zone of the computer, or when HW clock is in UTC and thus sys_tz.minuteswest == 0). So provide a mount option time_offset= which allows user to specify offset in minutes that should be applied to time stamps on the filesystem. akpm: this code would work incorrectly when used via `mount -o remount', because cached inodes would not be updated. But fatfs's fat_remount() is basically a no-op anyway. Signed-off-by: Jan Kara <jack@suse.cz> Acked-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/inode.c')
-rw-r--r--fs/fat/inode.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 7b186a5d51b1..59ac83be2d5b 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -778,8 +778,12 @@ static int fat_show_options(struct seq_file *m, struct dentry *root)
778 } 778 }
779 if (opts->flush) 779 if (opts->flush)
780 seq_puts(m, ",flush"); 780 seq_puts(m, ",flush");
781 if (opts->tz_utc) 781 if (opts->tz_set) {
782 seq_puts(m, ",tz=UTC"); 782 if (opts->time_offset)
783 seq_printf(m, ",time_offset=%d", opts->time_offset);
784 else
785 seq_puts(m, ",tz=UTC");
786 }
783 if (opts->errors == FAT_ERRORS_CONT) 787 if (opts->errors == FAT_ERRORS_CONT)
784 seq_puts(m, ",errors=continue"); 788 seq_puts(m, ",errors=continue");
785 else if (opts->errors == FAT_ERRORS_PANIC) 789 else if (opts->errors == FAT_ERRORS_PANIC)
@@ -801,7 +805,8 @@ enum {
801 Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes, 805 Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes,
802 Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, 806 Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes,
803 Opt_obsolete, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err_cont, 807 Opt_obsolete, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err_cont,
804 Opt_err_panic, Opt_err_ro, Opt_discard, Opt_nfs, Opt_err, 808 Opt_err_panic, Opt_err_ro, Opt_discard, Opt_nfs, Opt_time_offset,
809 Opt_err,
805}; 810};
806 811
807static const match_table_t fat_tokens = { 812static const match_table_t fat_tokens = {
@@ -826,6 +831,7 @@ static const match_table_t fat_tokens = {
826 {Opt_immutable, "sys_immutable"}, 831 {Opt_immutable, "sys_immutable"},
827 {Opt_flush, "flush"}, 832 {Opt_flush, "flush"},
828 {Opt_tz_utc, "tz=UTC"}, 833 {Opt_tz_utc, "tz=UTC"},
834 {Opt_time_offset, "time_offset=%d"},
829 {Opt_err_cont, "errors=continue"}, 835 {Opt_err_cont, "errors=continue"},
830 {Opt_err_panic, "errors=panic"}, 836 {Opt_err_panic, "errors=panic"},
831 {Opt_err_ro, "errors=remount-ro"}, 837 {Opt_err_ro, "errors=remount-ro"},
@@ -910,7 +916,7 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat,
910 opts->utf8 = opts->unicode_xlate = 0; 916 opts->utf8 = opts->unicode_xlate = 0;
911 opts->numtail = 1; 917 opts->numtail = 1;
912 opts->usefree = opts->nocase = 0; 918 opts->usefree = opts->nocase = 0;
913 opts->tz_utc = 0; 919 opts->tz_set = 0;
914 opts->nfs = 0; 920 opts->nfs = 0;
915 opts->errors = FAT_ERRORS_RO; 921 opts->errors = FAT_ERRORS_RO;
916 *debug = 0; 922 *debug = 0;
@@ -1006,8 +1012,17 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat,
1006 case Opt_flush: 1012 case Opt_flush:
1007 opts->flush = 1; 1013 opts->flush = 1;
1008 break; 1014 break;
1015 case Opt_time_offset:
1016 if (match_int(&args[0], &option))
1017 return 0;
1018 if (option < -12 * 60 || option > 12 * 60)
1019 return 0;
1020 opts->tz_set = 1;
1021 opts->time_offset = option;
1022 break;
1009 case Opt_tz_utc: 1023 case Opt_tz_utc:
1010 opts->tz_utc = 1; 1024 opts->tz_set = 1;
1025 opts->time_offset = 0;
1011 break; 1026 break;
1012 case Opt_err_cont: 1027 case Opt_err_cont:
1013 opts->errors = FAT_ERRORS_CONT; 1028 opts->errors = FAT_ERRORS_CONT;