
From: Andi Kleen <ak@muc.de>

It fixes the statfs64 emulation on x86-64.  The problem is that x86-64
needs an __attribute__((aligned)) on the compat_statfs64 structure.  The
conclusion last time this was discussed was that the structure should be
duplicated.

Essentially it is the old shared structure copied to every user and x86-64
uses __attribute__((packed)).



 include/asm-generic/statfs.h |   14 ++++++++++++++
 include/asm-ia64/statfs.h    |   13 +++++++++++++
 include/asm-mips/statfs.h    |   14 ++++++++++++++
 include/asm-parisc/statfs.h  |   14 ++++++++++++++
 include/asm-ppc64/statfs.h   |   14 ++++++++++++++
 include/asm-s390/statfs.h    |   14 ++++++++++++++
 include/asm-sparc64/statfs.h |   14 ++++++++++++++
 include/asm-x86_64/statfs.h  |   14 ++++++++++++++
 include/linux/compat.h       |   14 --------------
 9 files changed, 111 insertions(+), 14 deletions(-)

diff -puN include/asm-generic/statfs.h~x86_64-statfs64-fix-2 include/asm-generic/statfs.h
--- 25/include/asm-generic/statfs.h~x86_64-statfs64-fix-2	2003-12-21 22:25:47.000000000 -0800
+++ 25-akpm/include/asm-generic/statfs.h	2003-12-21 22:25:47.000000000 -0800
@@ -34,4 +34,18 @@ struct statfs64 {
 	__u32 f_spare[5];
 };
 
+struct compat_statfs64 {
+	__u32 f_type;
+	__u32 f_bsize;
+	__u64 f_blocks;
+	__u64 f_bfree;
+	__u64 f_bavail;
+	__u64 f_files;
+	__u64 f_ffree;
+	__kernel_fsid_t f_fsid;
+	__u32 f_namelen;
+	__u32 f_frsize;
+	__u32 f_spare[5];
+};
+
 #endif
diff -puN include/asm-ia64/statfs.h~x86_64-statfs64-fix-2 include/asm-ia64/statfs.h
--- 25/include/asm-ia64/statfs.h~x86_64-statfs64-fix-2	2003-12-21 22:25:47.000000000 -0800
+++ 25-akpm/include/asm-ia64/statfs.h	2003-12-21 22:25:47.000000000 -0800
@@ -43,5 +43,18 @@ struct statfs64 {
 	long f_spare[5];
 };
 
+struct compat_statfs64 {
+	__u32 f_type;
+	__u32 f_bsize;
+	__u64 f_blocks;
+	__u64 f_bfree;
+	__u64 f_bavail;
+	__u64 f_files;
+	__u64 f_ffree;
+	__kernel_fsid_t f_fsid;
+	__u32 f_namelen;
+	__u32 f_frsize;
+	__u32 f_spare[5];
+} __attribute__((packed));
 
 #endif /* _ASM_IA64_STATFS_H */
diff -puN include/asm-mips/statfs.h~x86_64-statfs64-fix-2 include/asm-mips/statfs.h
--- 25/include/asm-mips/statfs.h~x86_64-statfs64-fix-2	2003-12-21 22:25:47.000000000 -0800
+++ 25-akpm/include/asm-mips/statfs.h	2003-12-21 22:25:47.000000000 -0800
@@ -75,6 +75,20 @@ struct statfs64 {			/* Same as struct st
 	long		f_spare[6];
 };
 
+struct compat_statfs64 {
+	__u32 f_type;
+	__u32 f_bsize;
+	__u64 f_blocks;
+	__u64 f_bfree;
+	__u64 f_bavail;
+	__u64 f_files;
+	__u64 f_ffree;
+	__kernel_fsid_t f_fsid;
+	__u32 f_namelen;
+	__u32 f_frsize;
+	__u32 f_spare[5];
+};
+
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
 
 #endif /* _ASM_STATFS_H */
diff -puN include/asm-parisc/statfs.h~x86_64-statfs64-fix-2 include/asm-parisc/statfs.h
--- 25/include/asm-parisc/statfs.h~x86_64-statfs64-fix-2	2003-12-21 22:25:47.000000000 -0800
+++ 25-akpm/include/asm-parisc/statfs.h	2003-12-21 22:25:47.000000000 -0800
@@ -41,4 +41,18 @@ struct statfs64 {
 	long f_spare[5];
 };
 
+struct compat_statfs64 {
+	__u32 f_type;
+	__u32 f_bsize;
+	__u64 f_blocks;
+	__u64 f_bfree;
+	__u64 f_bavail;
+	__u64 f_files;
+	__u64 f_ffree;
+	__kernel_fsid_t f_fsid;
+	__u32 f_namelen;
+	__u32 f_frsize;
+	__u32 f_spare[5];
+};
+
 #endif
diff -puN include/asm-ppc64/statfs.h~x86_64-statfs64-fix-2 include/asm-ppc64/statfs.h
--- 25/include/asm-ppc64/statfs.h~x86_64-statfs64-fix-2	2003-12-21 22:25:47.000000000 -0800
+++ 25-akpm/include/asm-ppc64/statfs.h	2003-12-21 22:25:47.000000000 -0800
@@ -44,4 +44,18 @@ struct statfs64 {
 	long f_spare[5];
 };
 
+struct compat_statfs64 {
+	__u32 f_type;
+	__u32 f_bsize;
+	__u64 f_blocks;
+	__u64 f_bfree;
+	__u64 f_bavail;
+	__u64 f_files;
+	__u64 f_ffree;
+	__kernel_fsid_t f_fsid;
+	__u32 f_namelen;
+	__u32 f_frsize;
+	__u32 f_spare[5];
+};
+
 #endif  /* _PPC64_STATFS_H */
diff -puN include/asm-s390/statfs.h~x86_64-statfs64-fix-2 include/asm-s390/statfs.h
--- 25/include/asm-s390/statfs.h~x86_64-statfs64-fix-2	2003-12-21 22:25:47.000000000 -0800
+++ 25-akpm/include/asm-s390/statfs.h	2003-12-21 22:25:47.000000000 -0800
@@ -53,5 +53,19 @@ struct statfs64 {
 	int  f_spare[5];
 };
 
+struct compat_statfs64 {
+	__u32 f_type;
+	__u32 f_bsize;
+	__u64 f_blocks;
+	__u64 f_bfree;
+	__u64 f_bavail;
+	__u64 f_files;
+	__u64 f_ffree;
+	__kernel_fsid_t f_fsid;
+	__u32 f_namelen;
+	__u32 f_frsize;
+	__u32 f_spare[5];
+};
+
 #endif /* __s390x__ */
 #endif
diff -puN include/asm-sparc64/statfs.h~x86_64-statfs64-fix-2 include/asm-sparc64/statfs.h
--- 25/include/asm-sparc64/statfs.h~x86_64-statfs64-fix-2	2003-12-21 22:25:47.000000000 -0800
+++ 25-akpm/include/asm-sparc64/statfs.h	2003-12-21 22:25:47.000000000 -0800
@@ -38,4 +38,18 @@ struct statfs64 {
 	long f_spare[5];
 };
 
+struct compat_statfs64 {
+	__u32 f_type;
+	__u32 f_bsize;
+	__u64 f_blocks;
+	__u64 f_bfree;
+	__u64 f_bavail;
+	__u64 f_files;
+	__u64 f_ffree;
+	__kernel_fsid_t f_fsid;
+	__u32 f_namelen;
+	__u32 f_frsize;
+	__u32 f_spare[5];
+};
+
 #endif
diff -puN include/asm-x86_64/statfs.h~x86_64-statfs64-fix-2 include/asm-x86_64/statfs.h
--- 25/include/asm-x86_64/statfs.h~x86_64-statfs64-fix-2	2003-12-21 22:25:47.000000000 -0800
+++ 25-akpm/include/asm-x86_64/statfs.h	2003-12-21 22:25:47.000000000 -0800
@@ -41,4 +41,18 @@ struct statfs64 {
 	long f_spare[5];
 };
 
+struct compat_statfs64 {
+	__u32 f_type;
+	__u32 f_bsize;
+	__u64 f_blocks;
+	__u64 f_bfree;
+	__u64 f_bavail;
+	__u64 f_files;
+	__u64 f_ffree;
+	__kernel_fsid_t f_fsid;
+	__u32 f_namelen;
+	__u32 f_frsize;
+	__u32 f_spare[5];
+} __attribute__((packed));
+
 #endif
diff -puN include/linux/compat.h~x86_64-statfs64-fix-2 include/linux/compat.h
--- 25/include/linux/compat.h~x86_64-statfs64-fix-2	2003-12-21 22:25:47.000000000 -0800
+++ 25-akpm/include/linux/compat.h	2003-12-21 22:25:47.000000000 -0800
@@ -76,20 +76,6 @@ struct compat_rusage {
 	compat_long_t	ru_nivcsw;
 };
 
-struct compat_statfs64 {
-	__u32 f_type;
-	__u32 f_bsize;
-	__u64 f_blocks;
-	__u64 f_bfree;
-	__u64 f_bavail;
-	__u64 f_files;
-	__u64 f_ffree;
-	__kernel_fsid_t f_fsid;
-	__u32 f_namelen;
-	__u32 f_frsize;
-	__u32 f_spare[5];
-};
-
 struct compat_dirent {
 	u32		d_ino;
 	compat_off_t	d_off;

_
