[Yaffs] patch: struct yaffs_ObjectHeader fix for 64 bit compile

Frank Rowand frowand@mvista.com
Mon, 22 Nov 2004 15:48:40 -0800


This is a multi-part message in MIME format.
--------------030507050008040203080800
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

The attached patch should allow a 64 bit compile to create a
struct yaffs_ObjectHeader with proper field size and
alignment.

I have not yet tested this on 64 bit hardware, but wanted to
share it before it became stale.

I also have not tried it with a compiler other than gcc (I'm
not sure what people are using for WINCE targets), so I don't
know if this will work with other compilers.

-Frank
-- 
Frank Rowand <frank_rowand@mvista.com>
MontaVista Software, Inc

--------------030507050008040203080800
Content-Type: text/plain;
 name="yaffs_userland_04_64bit.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="yaffs_userland_04_64bit.patch"

Index: yaffs/yaffs_guts.h
===================================================================
--- yaffs.orig/yaffs_guts.h
+++ yaffs/yaffs_guts.h
@@ -181,16 +181,17 @@
 	YAFFS_OBJECT_TYPE_DIRECTORY,
 	YAFFS_OBJECT_TYPE_HARDLINK,
 	YAFFS_OBJECT_TYPE_SPECIAL
-} yaffs_ObjectType;
+} yaffs_ObjectType __attribute__ ((__mode__ (__SI__)));
 
 typedef struct
 {
 	yaffs_ObjectType type;
 
 	// Apply to everything	
-	int   parentObjectId;
+	__s32 parentObjectId;
 	__u16 sum__NoLongerUsed;	// checksum of name. Calc this off the name to prevent inconsistencies
 	char  name[YAFFS_MAX_NAME_LENGTH + 1];
+	char  pad[2];
 
 	// Thes following apply to directories, files, symlinks - not hard links
 	__u32 st_mode;  // protection
@@ -209,10 +210,10 @@
 #endif
 
 	// File size  applies to files only
-	int fileSize; 
+	__s32 fileSize; 
 		
 	// Equivalent object id applies to hard links only.
-	int  equivalentObjectId;
+	__s32 equivalentObjectId;
 	
 	// Alias is for symlinks only.
 	char alias[YAFFS_MAX_ALIAS_LENGTH + 1];
Index: yaffs/devextras.h
===================================================================
--- yaffs.orig/devextras.h
+++ yaffs/devextras.h
@@ -33,9 +33,11 @@
 
 // User space defines
 
-typedef unsigned char   __u8;
-typedef unsigned short  __u16;
-typedef unsigned        __u32;
+typedef int32_t   __s32;
+
+typedef u_int8_t  __u8;
+typedef u_int16_t __u16;
+typedef u_int32_t __u32;
 
 
 /*

--------------030507050008040203080800--