[PATCH] fs/hpfs/*: fix HPFS support under 64-bit kernel

Linux Kernel Mailing List <[email protected]> Thu, 24 Mar 2005 12:13:38 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1472, 2005/03/24 09:13:38-03:00, [email protected]

	[PATCH] fs/hpfs/*: fix HPFS support under 64-bit kernel
	
	The provided patch fixes HPFS filesystem support under 64-bit Linux kernel
	and closes the bugreport http://bugme.osdl.org/show_bug.cgi?id=4333
	
	The problem is in 'time_t' size which is 8 bytes on 64-bit systems
	(comparing to 4 bytes on 32-bit systems).  The patch introduces local
	'time32_t' type of the fixed size 4 and uses it where required.
	
	Signed-off-by: Andrew Morton <[email protected]>



 hpfs.h    |   12 +++++++-----
 hpfs_fn.h |    4 ++--
 2 files changed, 9 insertions(+), 7 deletions(-)


diff -Nru a/fs/hpfs/hpfs.h b/fs/hpfs/hpfs.h
--- a/fs/hpfs/hpfs.h	2005-03-24 09:05:56 -08:00
+++ b/fs/hpfs/hpfs.h	2005-03-24 09:05:56 -08:00
@@ -27,6 +27,8 @@
 typedef secno fnode_secno;		/* sector number of an fnode */
 typedef secno anode_secno;		/* sector number of an anode */
 
+typedef unsigned time32_t;		/* 32-bit time_t type */
+
 /* sector 0 */
 
 /* The boot block is very like a FAT boot block, except that the
@@ -84,9 +86,9 @@
   unsigned zero1;			/* 0 */
   secno badblocks;			/* bad block list */
   unsigned zero3;			/* 0 */
-  time_t last_chkdsk;			/* date last checked, 0 if never */
+  time32_t last_chkdsk;			/* date last checked, 0 if never */
   /*unsigned zero4;*/			/* 0 */
-  time_t last_optimize;			/* date last optimized, 0 if never */
+  time32_t last_optimize;			/* date last optimized, 0 if never */
   secno n_dir_band;			/* number of sectors in dir band */
   secno dir_band_start;			/* first sector in dir band */
   secno dir_band_end;			/* last sector in dir band */
@@ -287,10 +289,10 @@
   unsigned not_8x3: 1;			/* name is not 8.3 */
   unsigned flag15: 1;
   fnode_secno fnode;			/* fnode giving allocation info */
-  time_t write_date;			/* mtime */
+  time32_t write_date;			/* mtime */
   unsigned file_size;			/* file length, bytes */
-  time_t read_date;			/* atime */
-  time_t creation_date;			/* ctime */
+  time32_t read_date;			/* atime */
+  time32_t creation_date;			/* ctime */
   unsigned ea_size;			/* total EA length, bytes */
   unsigned char no_of_acls : 3;		/* number of ACL's */
   unsigned char reserver : 5;
diff -Nru a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h
--- a/fs/hpfs/hpfs_fn.h	2005-03-24 09:05:56 -08:00
+++ b/fs/hpfs/hpfs_fn.h	2005-03-24 09:05:56 -08:00
@@ -58,13 +58,13 @@
  * local time (HPFS) to GMT (Unix)
  */
 
-extern inline time_t local_to_gmt(struct super_block *s, time_t t)
+extern inline time_t local_to_gmt(struct super_block *s, time32_t t)
 {
 	extern struct timezone sys_tz;
 	return t + sys_tz.tz_minuteswest * 60 + s->s_hpfs_timeshift;
 }
 
-extern inline time_t gmt_to_local(struct super_block *s, time_t t)
+extern inline time32_t gmt_to_local(struct super_block *s, time_t t)
 {
 	extern struct timezone sys_tz;
 	return t - sys_tz.tz_minuteswest * 60 - s->s_hpfs_timeshift;