
From Andi Kleen

Various touchups for the statfs64 patch



 fs/compat.c                 |   10 ++++++----
 fs/open.c                   |    8 ++++++--
 include/asm-x86_64/compat.h |    3 ++-
 include/asm-x86_64/statfs.h |    3 ++-
 4 files changed, 16 insertions(+), 8 deletions(-)

diff -puN fs/compat.c~statfs64-x86_64-fixes fs/compat.c
--- 25/fs/compat.c~statfs64-x86_64-fixes	2003-06-07 12:32:31.000000000 -0700
+++ 25-akpm/fs/compat.c	2003-06-07 12:32:31.000000000 -0700
@@ -87,7 +87,8 @@ asmlinkage long compat_sys_newfstat(unsi
 	return error;
 }
 
-static int put_compat_statfs(struct compat_statfs *ubuf, struct statfs *kbuf)
+/* RED-PEN should return EOVERFLOW or similar on overflows */
+static int put_compat_statfs(struct compat_statfs *ubuf, struct kstatfs *kbuf)
 {
 	if (verify_area(VERIFY_WRITE, ubuf, sizeof(*ubuf)) ||
 	    __put_user(kbuf->f_type, &ubuf->f_type) ||
@@ -99,7 +100,8 @@ static int put_compat_statfs(struct comp
 	    __put_user(kbuf->f_ffree, &ubuf->f_ffree) ||
 	    __put_user(kbuf->f_namelen, &ubuf->f_namelen) ||
 	    __put_user(kbuf->f_fsid.val[0], &ubuf->f_fsid.val[0]) ||
-	    __put_user(kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1]))
+	    __put_user(kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1]) ||
+	    __put_user(kbuf->f_frsize, &ubuf->f_frsize))	
 		return -EFAULT;
 	return 0;
 }
@@ -115,7 +117,7 @@ asmlinkage long compat_sys_statfs(const 
 
 	error = user_path_walk(path, &nd);
 	if (!error) {
-		struct statfs tmp;
+		struct kstatfs tmp;
 		error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp);
 		if (!error && put_compat_statfs(buf, &tmp))
 			error = -EFAULT;
@@ -127,7 +129,7 @@ asmlinkage long compat_sys_statfs(const 
 asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs *buf)
 {
 	struct file * file;
-	struct statfs tmp;
+	struct kstatfs tmp;
 	int error;
 
 	error = -EBADF;
diff -puN fs/open.c~statfs64-x86_64-fixes fs/open.c
--- 25/fs/open.c~statfs64-x86_64-fixes	2003-06-07 12:32:31.000000000 -0700
+++ 25-akpm/fs/open.c	2003-06-07 12:32:31.000000000 -0700
@@ -72,6 +72,7 @@ static int vfs_statfs_native(struct supe
 	return 0;
 }
 
+#if BITS_PER_LONG != 64
 static int vfs_statfs64(struct super_block *sb, struct statfs64 *buf)
 {
 	struct kstatfs st;
@@ -98,6 +99,7 @@ static int vfs_statfs64(struct super_blo
 	}
 	return 0;
 }
+#endif
 
 asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf)
 {
@@ -115,7 +117,7 @@ asmlinkage long sys_statfs(const char __
 	return error;
 }
 
-
+#if BITS_PER_LONG!=64
 asmlinkage long sys_statfs64(const char *path, size_t sz, struct statfs64 *buf)
 {
 	struct nameidata nd;
@@ -133,7 +135,7 @@ asmlinkage long sys_statfs64(const char 
 	}
 	return error;
 }
-
+#endif
 
 asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf)
 {
@@ -153,6 +155,7 @@ out:
 	return error;
 }
 
+#if BITS_PER_LONG!=64
 asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 *buf)
 {
 	struct file * file;
@@ -173,6 +176,7 @@ asmlinkage long sys_fstatfs64(unsigned i
 out:
 	return error;
 }
+#endif
 
 int do_truncate(struct dentry *dentry, loff_t length)
 {
diff -puN include/asm-x86_64/compat.h~statfs64-x86_64-fixes include/asm-x86_64/compat.h
--- 25/include/asm-x86_64/compat.h~statfs64-x86_64-fixes	2003-06-07 12:32:31.000000000 -0700
+++ 25-akpm/include/asm-x86_64/compat.h	2003-06-07 12:32:31.000000000 -0700
@@ -101,7 +101,8 @@ struct compat_statfs {
 	int		f_ffree;
 	compat_fsid_t	f_fsid;
 	int		f_namelen;	/* SunOS ignores this field. */
-	int		f_spare[6];
+	int		f_frsize;
+	int		f_spare[5];
 };
 
 #define COMPAT_RLIM_OLD_INFINITY	0x7fffffff
diff -puN include/asm-x86_64/statfs.h~statfs64-x86_64-fixes include/asm-x86_64/statfs.h
--- 25/include/asm-x86_64/statfs.h~statfs64-x86_64-fixes	2003-06-07 12:32:31.000000000 -0700
+++ 25-akpm/include/asm-x86_64/statfs.h	2003-06-07 12:32:31.000000000 -0700
@@ -19,7 +19,8 @@ struct statfs {
 	long f_ffree;
 	__kernel_fsid_t f_fsid;
 	long f_namelen;
-	long f_spare[6];
+	long f_frsize;
+	long f_spare[5];
 };
 
 #endif

_
