1 |
Author: mpagano |
2 |
Date: 2008-07-31 00:39:38 +0000 (Thu, 31 Jul 2008) |
3 |
New Revision: 1335 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/2.6.26/1900_UTC-timestamp-option.patch |
7 |
Modified: |
8 |
genpatches-2.6/trunk/2.6.26/0000_README |
9 |
Log: |
10 |
Adding UTC timestamp option patch bug #233307 |
11 |
|
12 |
Modified: genpatches-2.6/trunk/2.6.26/0000_README |
13 |
=================================================================== |
14 |
--- genpatches-2.6/trunk/2.6.26/0000_README 2008-07-24 17:20:37 UTC (rev 1334) |
15 |
+++ genpatches-2.6/trunk/2.6.26/0000_README 2008-07-31 00:39:38 UTC (rev 1335) |
16 |
@@ -39,6 +39,10 @@ |
17 |
Individual Patch Descriptions: |
18 |
-------------------------------------------------------------------------- |
19 |
|
20 |
+Patch: 1900_UTC-timestamp-option.patch |
21 |
+From: http://bugs.gentoo.org/233307 |
22 |
+Desc: Fix to add UTC timestamp option |
23 |
+ |
24 |
Patch: 2600_evdev-compat-ioctl-force-feedback.patch |
25 |
From: http://bugs.gentoo.org/214700 |
26 |
Desc: Fix evdev force feedback in 32-bit compat mode |
27 |
|
28 |
Added: genpatches-2.6/trunk/2.6.26/1900_UTC-timestamp-option.patch |
29 |
=================================================================== |
30 |
--- genpatches-2.6/trunk/2.6.26/1900_UTC-timestamp-option.patch (rev 0) |
31 |
+++ genpatches-2.6/trunk/2.6.26/1900_UTC-timestamp-option.patch 2008-07-31 00:39:38 UTC (rev 1335) |
32 |
@@ -0,0 +1,221 @@ |
33 |
+New mount option ("tz=UTC") for FAT (vfat/msdos) filesystems allowing |
34 |
+timestamps to be in coordinated universal time (UTC) rather than |
35 |
+local time in applications where doing this is advantageous (like |
36 |
+digital cameras, etc.) |
37 |
+ |
38 |
+Signed-off-by: Joe Peterson <joe@×××××××.com> |
39 |
+Acked-by: OGAWA Hirofumi <hirofumi@×××××××××××××××.jp> |
40 |
+--- |
41 |
+ |
42 |
+diff -puNr a/fs/fat/dir.c b/fs/fat/dir.c |
43 |
+--- a/fs/fat/dir.c 2008-06-25 08:53:35.676901351 -0600 |
44 |
++++ b/fs/fat/dir.c 2008-06-26 12:58:56.096272279 -0600 |
45 |
+@@ -1082,7 +1082,7 @@ int fat_alloc_new_dir(struct inode *dir, |
46 |
+ goto error_free; |
47 |
+ } |
48 |
+ |
49 |
+- fat_date_unix2dos(ts->tv_sec, &time, &date); |
50 |
++ fat_date_unix2dos(ts->tv_sec, &time, &date, sbi->options.tz_utc); |
51 |
+ |
52 |
+ de = (struct msdos_dir_entry *)bhs[0]->b_data; |
53 |
+ /* filling the new directory slots ("." and ".." entries) */ |
54 |
+diff -puNr a/fs/fat/inode.c b/fs/fat/inode.c |
55 |
+--- a/fs/fat/inode.c 2008-06-25 08:53:35.676901351 -0600 |
56 |
++++ b/fs/fat/inode.c 2008-06-26 14:57:07.087942764 -0600 |
57 |
+@@ -382,17 +382,20 @@ static int fat_fill_inode(struct inode * |
58 |
+ inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1)) |
59 |
+ & ~((loff_t)sbi->cluster_size - 1)) >> 9; |
60 |
+ inode->i_mtime.tv_sec = |
61 |
+- date_dos2unix(le16_to_cpu(de->time), le16_to_cpu(de->date)); |
62 |
++ date_dos2unix(le16_to_cpu(de->time), le16_to_cpu(de->date), |
63 |
++ sbi->options.tz_utc); |
64 |
+ inode->i_mtime.tv_nsec = 0; |
65 |
+ if (sbi->options.isvfat) { |
66 |
+ int secs = de->ctime_cs / 100; |
67 |
+ int csecs = de->ctime_cs % 100; |
68 |
+ inode->i_ctime.tv_sec = |
69 |
+ date_dos2unix(le16_to_cpu(de->ctime), |
70 |
+- le16_to_cpu(de->cdate)) + secs; |
71 |
++ le16_to_cpu(de->cdate), |
72 |
++ sbi->options.tz_utc) + secs; |
73 |
+ inode->i_ctime.tv_nsec = csecs * 10000000; |
74 |
+ inode->i_atime.tv_sec = |
75 |
+- date_dos2unix(0, le16_to_cpu(de->adate)); |
76 |
++ date_dos2unix(0, le16_to_cpu(de->adate), |
77 |
++ sbi->options.tz_utc); |
78 |
+ inode->i_atime.tv_nsec = 0; |
79 |
+ } else |
80 |
+ inode->i_ctime = inode->i_atime = inode->i_mtime; |
81 |
+@@ -592,11 +595,14 @@ retry: |
82 |
+ raw_entry->attr = fat_attr(inode); |
83 |
+ raw_entry->start = cpu_to_le16(MSDOS_I(inode)->i_logstart); |
84 |
+ raw_entry->starthi = cpu_to_le16(MSDOS_I(inode)->i_logstart >> 16); |
85 |
+- fat_date_unix2dos(inode->i_mtime.tv_sec, &raw_entry->time, &raw_entry->date); |
86 |
++ fat_date_unix2dos(inode->i_mtime.tv_sec, &raw_entry->time, |
87 |
++ &raw_entry->date, sbi->options.tz_utc); |
88 |
+ if (sbi->options.isvfat) { |
89 |
+ __le16 atime; |
90 |
+- fat_date_unix2dos(inode->i_ctime.tv_sec,&raw_entry->ctime,&raw_entry->cdate); |
91 |
+- fat_date_unix2dos(inode->i_atime.tv_sec,&atime,&raw_entry->adate); |
92 |
++ fat_date_unix2dos(inode->i_ctime.tv_sec, &raw_entry->ctime, |
93 |
++ &raw_entry->cdate, sbi->options.tz_utc); |
94 |
++ fat_date_unix2dos(inode->i_atime.tv_sec, &atime, |
95 |
++ &raw_entry->adate, sbi->options.tz_utc); |
96 |
+ raw_entry->ctime_cs = (inode->i_ctime.tv_sec & 1) * 100 + |
97 |
+ inode->i_ctime.tv_nsec / 10000000; |
98 |
+ } |
99 |
+@@ -836,6 +842,8 @@ static int fat_show_options(struct seq_f |
100 |
+ } |
101 |
+ if (sbi->options.flush) |
102 |
+ seq_puts(m, ",flush"); |
103 |
++ if (opts->tz_utc) |
104 |
++ seq_puts(m, ",tz=UTC"); |
105 |
+ |
106 |
+ return 0; |
107 |
+ } |
108 |
+@@ -848,7 +856,7 @@ enum { |
109 |
+ Opt_charset, Opt_shortname_lower, Opt_shortname_win95, |
110 |
+ Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes, |
111 |
+ Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, |
112 |
+- Opt_obsolate, Opt_flush, Opt_err, |
113 |
++ Opt_obsolate, Opt_flush, Opt_tz_utc, Opt_err, |
114 |
+ }; |
115 |
+ |
116 |
+ static match_table_t fat_tokens = { |
117 |
+@@ -883,6 +891,7 @@ static match_table_t fat_tokens = { |
118 |
+ {Opt_obsolate, "cvf_options=%100s"}, |
119 |
+ {Opt_obsolate, "posix"}, |
120 |
+ {Opt_flush, "flush"}, |
121 |
++ {Opt_tz_utc, "tz=UTC"}, |
122 |
+ {Opt_err, NULL}, |
123 |
+ }; |
124 |
+ static match_table_t msdos_tokens = { |
125 |
+@@ -947,6 +956,7 @@ static int parse_options(char *options, |
126 |
+ opts->utf8 = opts->unicode_xlate = 0; |
127 |
+ opts->numtail = 1; |
128 |
+ opts->usefree = opts->nocase = 0; |
129 |
++ opts->tz_utc = 0; |
130 |
+ *debug = 0; |
131 |
+ |
132 |
+ if (!options) |
133 |
+@@ -1036,6 +1046,9 @@ static int parse_options(char *options, |
134 |
+ case Opt_flush: |
135 |
+ opts->flush = 1; |
136 |
+ break; |
137 |
++ case Opt_tz_utc: |
138 |
++ opts->tz_utc = 1; |
139 |
++ break; |
140 |
+ |
141 |
+ /* msdos specific */ |
142 |
+ case Opt_dots: |
143 |
+diff -puNr a/fs/fat/misc.c b/fs/fat/misc.c |
144 |
+--- a/fs/fat/misc.c 2008-06-25 08:53:35.676901351 -0600 |
145 |
++++ b/fs/fat/misc.c 2008-06-26 12:59:08.627376422 -0600 |
146 |
+@@ -142,7 +142,7 @@ static int day_n[] = { |
147 |
+ }; |
148 |
+ |
149 |
+ /* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */ |
150 |
+-int date_dos2unix(unsigned short time, unsigned short date) |
151 |
++int date_dos2unix(unsigned short time, unsigned short date, int tz_utc) |
152 |
+ { |
153 |
+ int month, year, secs; |
154 |
+ |
155 |
+@@ -156,16 +156,18 @@ int date_dos2unix(unsigned short time, u |
156 |
+ ((date & 31)-1+day_n[month]+(year/4)+year*365-((year & 3) == 0 && |
157 |
+ month < 2 ? 1 : 0)+3653); |
158 |
+ /* days since 1.1.70 plus 80's leap day */ |
159 |
+- secs += sys_tz.tz_minuteswest*60; |
160 |
++ if (!tz_utc) |
161 |
++ secs += sys_tz.tz_minuteswest*60; |
162 |
+ return secs; |
163 |
+ } |
164 |
+ |
165 |
+ /* Convert linear UNIX date to a MS-DOS time/date pair. */ |
166 |
+-void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date) |
167 |
++void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date, int tz_utc) |
168 |
+ { |
169 |
+ int day, year, nl_day, month; |
170 |
+ |
171 |
+- unix_date -= sys_tz.tz_minuteswest*60; |
172 |
++ if (!tz_utc) |
173 |
++ unix_date -= sys_tz.tz_minuteswest*60; |
174 |
+ |
175 |
+ /* Jan 1 GMT 00:00:00 1980. But what about another time zone? */ |
176 |
+ if (unix_date < 315532800) |
177 |
+diff -puNr a/fs/msdos/namei.c b/fs/msdos/namei.c |
178 |
+--- a/fs/msdos/namei.c 2008-06-25 08:53:35.696902410 -0600 |
179 |
++++ b/fs/msdos/namei.c 2008-06-26 12:58:42.255055811 -0600 |
180 |
+@@ -243,6 +243,7 @@ static int msdos_add_entry(struct inode |
181 |
+ int is_dir, int is_hid, int cluster, |
182 |
+ struct timespec *ts, struct fat_slot_info *sinfo) |
183 |
+ { |
184 |
++ struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb); |
185 |
+ struct msdos_dir_entry de; |
186 |
+ __le16 time, date; |
187 |
+ int err; |
188 |
+@@ -252,7 +253,7 @@ static int msdos_add_entry(struct inode |
189 |
+ if (is_hid) |
190 |
+ de.attr |= ATTR_HIDDEN; |
191 |
+ de.lcase = 0; |
192 |
+- fat_date_unix2dos(ts->tv_sec, &time, &date); |
193 |
++ fat_date_unix2dos(ts->tv_sec, &time, &date, sbi->options.tz_utc); |
194 |
+ de.cdate = de.adate = 0; |
195 |
+ de.ctime = 0; |
196 |
+ de.ctime_cs = 0; |
197 |
+diff -puNr a/fs/vfat/namei.c b/fs/vfat/namei.c |
198 |
+--- a/fs/vfat/namei.c 2008-06-25 08:53:35.686902663 -0600 |
199 |
++++ b/fs/vfat/namei.c 2008-06-26 12:58:27.073724049 -0600 |
200 |
+@@ -621,7 +621,7 @@ shortname: |
201 |
+ memcpy(de->name, msdos_name, MSDOS_NAME); |
202 |
+ de->attr = is_dir ? ATTR_DIR : ATTR_ARCH; |
203 |
+ de->lcase = lcase; |
204 |
+- fat_date_unix2dos(ts->tv_sec, &time, &date); |
205 |
++ fat_date_unix2dos(ts->tv_sec, &time, &date, sbi->options.tz_utc); |
206 |
+ de->time = de->ctime = time; |
207 |
+ de->date = de->cdate = de->adate = date; |
208 |
+ de->ctime_cs = 0; |
209 |
+diff -puNr a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h |
210 |
+--- a/include/linux/msdos_fs.h 2008-06-25 08:53:17.435303045 -0600 |
211 |
++++ b/include/linux/msdos_fs.h 2008-06-26 14:58:40.626135522 -0600 |
212 |
+@@ -205,7 +205,8 @@ struct fat_mount_options { |
213 |
+ atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */ |
214 |
+ flush:1, /* write things quickly */ |
215 |
+ nocase:1, /* Does this need case conversion? 0=need case conversion*/ |
216 |
+- usefree:1; /* Use free_clusters for FAT32 */ |
217 |
++ usefree:1, /* Use free_clusters for FAT32 */ |
218 |
++ tz_utc:1; /* Filesystem timestamps are in UTC */ |
219 |
+ }; |
220 |
+ |
221 |
+ #define FAT_HASH_BITS 8 |
222 |
+@@ -428,8 +429,9 @@ extern int fat_flush_inodes(struct super |
223 |
+ extern void fat_fs_panic(struct super_block *s, const char *fmt, ...); |
224 |
+ extern void fat_clusters_flush(struct super_block *sb); |
225 |
+ extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster); |
226 |
+-extern int date_dos2unix(unsigned short time, unsigned short date); |
227 |
+-extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date); |
228 |
++extern int date_dos2unix(unsigned short time, unsigned short date, int tz_utc); |
229 |
++extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date, |
230 |
++ int tz_utc); |
231 |
+ extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs); |
232 |
+ |
233 |
+ int fat_cache_init(void); |
234 |
+ |
235 |
+diff -puN Documentation/filesystems/vfat.txt~utc-timestamp-option-for-fat-filesystems-fix Documentation/filesystems/vfat.txt |
236 |
+--- a/Documentation/filesystems/vfat.txt~utc-timestamp-option-for-fat-filesystems-fix |
237 |
++++ a/Documentation/filesystems/vfat.txt |
238 |
+@@ -96,6 +96,14 @@ shortname=lower|win95|winnt|mixed |
239 |
+ emulate the Windows 95 rule for create. |
240 |
+ Default setting is `lower'. |
241 |
+ |
242 |
++tz=UTC -- Interpret timestamps as UTC rather than local time. |
243 |
++ This option disables the conversion of timestamps |
244 |
++ between local time (as used by Windows on FAT) and UTC |
245 |
++ (which Linux uses internally). This is particuluarly |
246 |
++ useful when mounting devices (like digital cameras) |
247 |
++ that are set to UTC in order to avoid the pitfalls of |
248 |
++ local time. |
249 |
++ |
250 |
+ <bool>: 0,1,yes,no,true,false |
251 |
+ |
252 |
+ TODO |
253 |
+ |