Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 233307 | Differences between
and this patch

Collapse All | Expand All

(-)a/fs/fat/dir.c (-1 / +1 lines)
Lines 1082-1088 int fat_alloc_new_dir(struct inode *dir, Link Here
1082
		goto error_free;
1082
		goto error_free;
1083
	}
1083
	}
1084
1084
1085
	fat_date_unix2dos(ts->tv_sec, &time, &date);
1085
	fat_date_unix2dos(ts->tv_sec, &time, &date, sbi->options.tz_utc);
1086
1086
1087
	de = (struct msdos_dir_entry *)bhs[0]->b_data;
1087
	de = (struct msdos_dir_entry *)bhs[0]->b_data;
1088
	/* filling the new directory slots ("." and ".." entries) */
1088
	/* filling the new directory slots ("." and ".." entries) */
(-)a/fs/fat/inode.c (-7 / +20 lines)
Lines 382-398 static int fat_fill_inode(struct inode * Link Here
382
	inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1))
382
	inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1))
383
			   & ~((loff_t)sbi->cluster_size - 1)) >> 9;
383
			   & ~((loff_t)sbi->cluster_size - 1)) >> 9;
384
	inode->i_mtime.tv_sec =
384
	inode->i_mtime.tv_sec =
385
		date_dos2unix(le16_to_cpu(de->time), le16_to_cpu(de->date));
385
		date_dos2unix(le16_to_cpu(de->time), le16_to_cpu(de->date),
386
			      sbi->options.tz_utc);
386
	inode->i_mtime.tv_nsec = 0;
387
	inode->i_mtime.tv_nsec = 0;
387
	if (sbi->options.isvfat) {
388
	if (sbi->options.isvfat) {
388
		int secs = de->ctime_cs / 100;
389
		int secs = de->ctime_cs / 100;
389
		int csecs = de->ctime_cs % 100;
390
		int csecs = de->ctime_cs % 100;
390
		inode->i_ctime.tv_sec  =
391
		inode->i_ctime.tv_sec  =
391
			date_dos2unix(le16_to_cpu(de->ctime),
392
			date_dos2unix(le16_to_cpu(de->ctime),
392
				      le16_to_cpu(de->cdate)) + secs;
393
				      le16_to_cpu(de->cdate),
394
				      sbi->options.tz_utc) + secs;
393
		inode->i_ctime.tv_nsec = csecs * 10000000;
395
		inode->i_ctime.tv_nsec = csecs * 10000000;
394
		inode->i_atime.tv_sec =
396
		inode->i_atime.tv_sec =
395
			date_dos2unix(0, le16_to_cpu(de->adate));
397
			date_dos2unix(0, le16_to_cpu(de->adate),
398
				      sbi->options.tz_utc);
396
		inode->i_atime.tv_nsec = 0;
399
		inode->i_atime.tv_nsec = 0;
397
	} else
400
	} else
398
		inode->i_ctime = inode->i_atime = inode->i_mtime;
401
		inode->i_ctime = inode->i_atime = inode->i_mtime;
Lines 592-602 retry: Link Here
592
	raw_entry->attr = fat_attr(inode);
595
	raw_entry->attr = fat_attr(inode);
593
	raw_entry->start = cpu_to_le16(MSDOS_I(inode)->i_logstart);
596
	raw_entry->start = cpu_to_le16(MSDOS_I(inode)->i_logstart);
594
	raw_entry->starthi = cpu_to_le16(MSDOS_I(inode)->i_logstart >> 16);
597
	raw_entry->starthi = cpu_to_le16(MSDOS_I(inode)->i_logstart >> 16);
595
	fat_date_unix2dos(inode->i_mtime.tv_sec, &raw_entry->time, &raw_entry->date);
598
	fat_date_unix2dos(inode->i_mtime.tv_sec, &raw_entry->time,
599
			  &raw_entry->date, sbi->options.tz_utc);
596
	if (sbi->options.isvfat) {
600
	if (sbi->options.isvfat) {
597
		__le16 atime;
601
		__le16 atime;
598
		fat_date_unix2dos(inode->i_ctime.tv_sec,&raw_entry->ctime,&raw_entry->cdate);
602
		fat_date_unix2dos(inode->i_ctime.tv_sec, &raw_entry->ctime,
599
		fat_date_unix2dos(inode->i_atime.tv_sec,&atime,&raw_entry->adate);
603
				  &raw_entry->cdate, sbi->options.tz_utc);
604
		fat_date_unix2dos(inode->i_atime.tv_sec, &atime,
605
				  &raw_entry->adate, sbi->options.tz_utc);
600
		raw_entry->ctime_cs = (inode->i_ctime.tv_sec & 1) * 100 +
606
		raw_entry->ctime_cs = (inode->i_ctime.tv_sec & 1) * 100 +
601
			inode->i_ctime.tv_nsec / 10000000;
607
			inode->i_ctime.tv_nsec / 10000000;
602
	}
608
	}
Lines 836-841 static int fat_show_options(struct seq_f Link Here
836
	}
842
	}
837
	if (sbi->options.flush)
843
	if (sbi->options.flush)
838
		seq_puts(m, ",flush");
844
		seq_puts(m, ",flush");
845
	if (opts->tz_utc)
846
		seq_puts(m, ",tz=UTC");
839
847
840
	return 0;
848
	return 0;
841
}
849
}
Lines 848-854 enum { Link Here
848
	Opt_charset, Opt_shortname_lower, Opt_shortname_win95,
856
	Opt_charset, Opt_shortname_lower, Opt_shortname_win95,
849
	Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes,
857
	Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes,
850
	Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes,
858
	Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes,
851
	Opt_obsolate, Opt_flush, Opt_err,
859
	Opt_obsolate, Opt_flush, Opt_tz_utc, Opt_err,
852
};
860
};
853
861
854
static match_table_t fat_tokens = {
862
static match_table_t fat_tokens = {
Lines 883-888 static match_table_t fat_tokens = { Link Here
883
	{Opt_obsolate, "cvf_options=%100s"},
891
	{Opt_obsolate, "cvf_options=%100s"},
884
	{Opt_obsolate, "posix"},
892
	{Opt_obsolate, "posix"},
885
	{Opt_flush, "flush"},
893
	{Opt_flush, "flush"},
894
	{Opt_tz_utc, "tz=UTC"},
886
	{Opt_err, NULL},
895
	{Opt_err, NULL},
887
};
896
};
888
static match_table_t msdos_tokens = {
897
static match_table_t msdos_tokens = {
Lines 947-952 static int parse_options(char *options, Link Here
947
	opts->utf8 = opts->unicode_xlate = 0;
956
	opts->utf8 = opts->unicode_xlate = 0;
948
	opts->numtail = 1;
957
	opts->numtail = 1;
949
	opts->usefree = opts->nocase = 0;
958
	opts->usefree = opts->nocase = 0;
959
	opts->tz_utc = 0;
950
	*debug = 0;
960
	*debug = 0;
951
961
952
	if (!options)
962
	if (!options)
Lines 1036-1041 static int parse_options(char *options, Link Here
1036
		case Opt_flush:
1046
		case Opt_flush:
1037
			opts->flush = 1;
1047
			opts->flush = 1;
1038
			break;
1048
			break;
1049
		case Opt_tz_utc:
1050
			opts->tz_utc = 1;
1051
			break;
1039
1052
1040
		/* msdos specific */
1053
		/* msdos specific */
1041
		case Opt_dots:
1054
		case Opt_dots:
(-)a/fs/fat/misc.c (-4 / +6 lines)
Lines 142-148 static int day_n[] = { Link Here
142
};
142
};
143
143
144
/* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */
144
/* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */
145
int date_dos2unix(unsigned short time, unsigned short date)
145
int date_dos2unix(unsigned short time, unsigned short date, int tz_utc)
146
{
146
{
147
	int month, year, secs;
147
	int month, year, secs;
148
148
Lines 156-171 int date_dos2unix(unsigned short time, u Link Here
156
	    ((date & 31)-1+day_n[month]+(year/4)+year*365-((year & 3) == 0 &&
156
	    ((date & 31)-1+day_n[month]+(year/4)+year*365-((year & 3) == 0 &&
157
	    month < 2 ? 1 : 0)+3653);
157
	    month < 2 ? 1 : 0)+3653);
158
			/* days since 1.1.70 plus 80's leap day */
158
			/* days since 1.1.70 plus 80's leap day */
159
	secs += sys_tz.tz_minuteswest*60;
159
	if (!tz_utc)
160
		secs += sys_tz.tz_minuteswest*60;
160
	return secs;
161
	return secs;
161
}
162
}
162
163
163
/* Convert linear UNIX date to a MS-DOS time/date pair. */
164
/* Convert linear UNIX date to a MS-DOS time/date pair. */
164
void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date)
165
void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date, int tz_utc)
165
{
166
{
166
	int day, year, nl_day, month;
167
	int day, year, nl_day, month;
167
168
168
	unix_date -= sys_tz.tz_minuteswest*60;
169
	if (!tz_utc)
170
		unix_date -= sys_tz.tz_minuteswest*60;
169
171
170
	/* Jan 1 GMT 00:00:00 1980. But what about another time zone? */
172
	/* Jan 1 GMT 00:00:00 1980. But what about another time zone? */
171
	if (unix_date < 315532800)
173
	if (unix_date < 315532800)
(-)a/fs/msdos/namei.c (-1 / +2 lines)
Lines 243-248 static int msdos_add_entry(struct inode Link Here
243
			   int is_dir, int is_hid, int cluster,
243
			   int is_dir, int is_hid, int cluster,
244
			   struct timespec *ts, struct fat_slot_info *sinfo)
244
			   struct timespec *ts, struct fat_slot_info *sinfo)
245
{
245
{
246
	struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
246
	struct msdos_dir_entry de;
247
	struct msdos_dir_entry de;
247
	__le16 time, date;
248
	__le16 time, date;
248
	int err;
249
	int err;
Lines 252-258 static int msdos_add_entry(struct inode Link Here
252
	if (is_hid)
253
	if (is_hid)
253
		de.attr |= ATTR_HIDDEN;
254
		de.attr |= ATTR_HIDDEN;
254
	de.lcase = 0;
255
	de.lcase = 0;
255
	fat_date_unix2dos(ts->tv_sec, &time, &date);
256
	fat_date_unix2dos(ts->tv_sec, &time, &date, sbi->options.tz_utc);
256
	de.cdate = de.adate = 0;
257
	de.cdate = de.adate = 0;
257
	de.ctime = 0;
258
	de.ctime = 0;
258
	de.ctime_cs = 0;
259
	de.ctime_cs = 0;
(-)a/fs/vfat/namei.c (-1 / +1 lines)
Lines 621-627 shortname: Link Here
621
	memcpy(de->name, msdos_name, MSDOS_NAME);
621
	memcpy(de->name, msdos_name, MSDOS_NAME);
622
	de->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
622
	de->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
623
	de->lcase = lcase;
623
	de->lcase = lcase;
624
	fat_date_unix2dos(ts->tv_sec, &time, &date);
624
	fat_date_unix2dos(ts->tv_sec, &time, &date, sbi->options.tz_utc);
625
	de->time = de->ctime = time;
625
	de->time = de->ctime = time;
626
	de->date = de->cdate = de->adate = date;
626
	de->date = de->cdate = de->adate = date;
627
	de->ctime_cs = 0;
627
	de->ctime_cs = 0;
(-)a/include/linux/msdos_fs.h (-3 / +5 lines)
Lines 205-211 struct fat_mount_options { Link Here
205
		 atari:1,         /* Use Atari GEMDOS variation of MS-DOS fs */
205
		 atari:1,         /* Use Atari GEMDOS variation of MS-DOS fs */
206
		 flush:1,	  /* write things quickly */
206
		 flush:1,	  /* write things quickly */
207
		 nocase:1,	  /* Does this need case conversion? 0=need case conversion*/
207
		 nocase:1,	  /* Does this need case conversion? 0=need case conversion*/
208
		 usefree:1;	  /* Use free_clusters for FAT32 */
208
		 usefree:1,	  /* Use free_clusters for FAT32 */
209
		 tz_utc:1;	  /* Filesystem timestamps are in UTC */
209
};
210
};
210
211
211
#define FAT_HASH_BITS	8
212
#define FAT_HASH_BITS	8
Lines 428-435 extern int fat_flush_inodes(struct super Link Here
428
extern void fat_fs_panic(struct super_block *s, const char *fmt, ...);
429
extern void fat_fs_panic(struct super_block *s, const char *fmt, ...);
429
extern void fat_clusters_flush(struct super_block *sb);
430
extern void fat_clusters_flush(struct super_block *sb);
430
extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
431
extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster);
431
extern int date_dos2unix(unsigned short time, unsigned short date);
432
extern int date_dos2unix(unsigned short time, unsigned short date, int tz_utc);
432
extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date);
433
extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date,
434
			      int tz_utc);
433
extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs);
435
extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs);
434
436
435
int fat_cache_init(void);
437
int fat_cache_init(void);

Return to bug 233307