Hi Linus,
This patch creates compat_sys_statfs and compat_sys_fstatfs. This is just
the generic part of the patch. Following are the arch specific parts. The
diffstat for the whole patch looks like this:
arch/ia64/ia32/ia32_entry.S | 4 +-
arch/ia64/ia32/sys_ia32.c | 55 ------------------------------
arch/mips64/kernel/linux32.c | 66 ------------------------------------
arch/mips64/kernel/scall_o32.S | 4 +-
arch/parisc/kernel/sys_parisc32.c | 68 --------------------------------------
arch/ppc64/kernel/misc.S | 4 +-
arch/ppc64/kernel/sys_ppc32.c | 59 --------------------------------
arch/s390x/kernel/entry.S | 4 +-
arch/s390x/kernel/linux32.c | 55 ------------------------------
arch/s390x/kernel/linux32.h | 13 -------
arch/s390x/kernel/wrapper32.S | 16 ++++----
arch/sparc64/kernel/sys_sparc32.c | 55 ------------------------------
arch/sparc64/kernel/systbls.S | 4 +-
arch/x86_64/ia32/ia32entry.S | 4 +-
arch/x86_64/ia32/sys_ia32.c | 52 -----------------------------
fs/compat.c | 57 +++++++++++++++++++++++++++++++
include/asm-ia64/compat.h | 23 ++++++++++--
include/asm-ia64/ia32.h | 13 -------
include/asm-mips64/compat.h | 14 +++++++
include/asm-parisc/compat.h | 13 +++++++
include/asm-ppc64/compat.h | 13 +++++++
include/asm-ppc64/ppc32.h | 13 -------
include/asm-s390x/compat.h | 13 +++++++
include/asm-sparc64/compat.h | 13 +++++++
include/asm-sparc64/statfs.h | 14 -------
include/asm-x86_64/compat.h | 13 +++++++
include/asm-x86_64/ia32.h | 13 -------
27 files changed, 174 insertions(+), 501 deletions(-)
I was wondering if put_compat_statfs would not be better if it declared a
struct compat_statfs and then zeroed it and then copied each of the
elements and then used copy_to_user on the whole structure. This would
have two effects: it may be faster in the copy to user mode and we would
no longer need to understand the internals of compat_fsid_t. What do you
think?
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.56-32bit.3/fs/compat.c 2.5.56-32bit.4/fs/compat.c
--- 2.5.56-32bit.3/fs/compat.c 2003-01-13 15:39:42.000000000 +1100
+++ 2.5.56-32bit.4/fs/compat.c 2003-01-13 15:58:34.000000000 +1100
@@ -17,6 +17,8 @@
#include <linux/time.h>
#include <linux/fs.h>
#include <linux/fcntl.h>
+#include <linux/namei.h>
+#include <linux/file.h>
#include <asm/uaccess.h>
@@ -101,3 +103,58 @@
err |= __put_user(kfl->l_pid, &ufl->l_pid);
return err;
}
+
+static int put_compat_statfs(struct compat_statfs *ubuf, struct statfs *kbuf)
+{
+ if (verify_area(VERIFY_WRITE, ubuf, sizeof(*ubuf)) ||
+ __put_user(kbuf->f_type, &ubuf->f_type) ||
+ __put_user(kbuf->f_bsize, &ubuf->f_bsize) ||
+ __put_user(kbuf->f_blocks, &ubuf->f_blocks) ||
+ __put_user(kbuf->f_bfree, &ubuf->f_bfree) ||
+ __put_user(kbuf->f_bavail, &ubuf->f_bavail) ||
+ __put_user(kbuf->f_files, &ubuf->f_files) ||
+ __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]))
+ return -EFAULT;
+ return 0;
+}
+
+/*
+ * The following statfs calls are copies of code from fs/open.c and
+ * should be checked against those from time to time
+ */
+asmlinkage long compat_sys_statfs(const char *path, struct compat_statfs *buf)
+{
+ struct nameidata nd;
+ int error;
+
+ error = user_path_walk(path, &nd);
+ if (!error) {
+ struct statfs tmp;
+ error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp);
+ if (!error && put_compat_statfs(buf, &tmp))
+ error = -EFAULT;
+ path_release(&nd);
+ }
+ return error;
+}
+
+asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs *buf)
+{
+ struct file * file;
+ struct statfs tmp;
+ int error;
+
+ error = -EBADF;
+ file = fget(fd);
+ if (!file)
+ goto out;
+ error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp);
+ if (!error && put_compat_statfs(buf, &tmp))
+ error = -EFAULT;
+ fput(file);
+out:
+ return error;
+}
Hi Anton,
Here is the ppc64 part.
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.56-32bit.3/arch/ppc64/kernel/misc.S 2.5.56-32bit.4/arch/ppc64/kernel/misc.S
--- 2.5.56-32bit.3/arch/ppc64/kernel/misc.S 2003-01-09 16:23:54.000000000 +1100
+++ 2.5.56-32bit.4/arch/ppc64/kernel/misc.S 2003-01-13 11:07:06.000000000 +1100
@@ -567,8 +567,8 @@
.llong .sys32_getpriority
.llong .sys32_setpriority
.llong .sys_ni_syscall /* old profil syscall */
- .llong .sys32_statfs
- .llong .sys32_fstatfs /* 100 */
+ .llong .compat_sys_statfs
+ .llong .compat_sys_fstatfs /* 100 */
.llong .sys_ioperm
.llong .sys32_socketcall
.llong .sys32_syslog
diff -ruN 2.5.56-32bit.3/arch/ppc64/kernel/sys_ppc32.c 2.5.56-32bit.4/arch/ppc64/kernel/sys_ppc32.c
--- 2.5.56-32bit.3/arch/ppc64/kernel/sys_ppc32.c 2003-01-13 11:03:52.000000000 +1100
+++ 2.5.56-32bit.4/arch/ppc64/kernel/sys_ppc32.c 2003-01-13 11:07:06.000000000 +1100
@@ -807,65 +807,6 @@
return err;
}
-static inline int put_statfs (struct statfs32 *ubuf, struct statfs *kbuf)
-{
- int err;
-
- err = put_user (kbuf->f_type, &ubuf->f_type);
- err |= __put_user (kbuf->f_bsize, &ubuf->f_bsize);
- err |= __put_user (kbuf->f_blocks, &ubuf->f_blocks);
- err |= __put_user (kbuf->f_bfree, &ubuf->f_bfree);
- err |= __put_user (kbuf->f_bavail, &ubuf->f_bavail);
- err |= __put_user (kbuf->f_files, &ubuf->f_files);
- err |= __put_user (kbuf->f_ffree, &ubuf->f_ffree);
- err |= __put_user (kbuf->f_namelen, &ubuf->f_namelen);
- err |= __put_user (kbuf->f_fsid.val[0], &ubuf->f_fsid.val[0]);
- err |= __put_user (kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1]);
- return err;
-}
-
-extern asmlinkage int sys_statfs(const char * path, struct statfs * buf);
-
-asmlinkage long sys32_statfs(const char * path, struct statfs32 *buf)
-{
- int ret;
- struct statfs s;
- mm_segment_t old_fs = get_fs();
- char *pth;
-
- pth = getname (path);
- ret = PTR_ERR(pth);
- if (!IS_ERR(pth)) {
- set_fs (KERNEL_DS);
- ret = sys_statfs((const char *)pth, &s);
- set_fs (old_fs);
- putname (pth);
- if (put_statfs(buf, &s))
- return -EFAULT;
- }
-
- return ret;
-}
-
-extern asmlinkage long sys_fstatfs(unsigned int fd, struct statfs * buf);
-
-asmlinkage long sys32_fstatfs(unsigned int fd, struct statfs32 *buf)
-{
- int ret;
- struct statfs s;
- mm_segment_t old_fs = get_fs();
-
- set_fs (KERNEL_DS);
- ret = sys_fstatfs(fd, &s);
- set_fs (old_fs);
- if (put_statfs(buf, &s))
- return -EFAULT;
-
- return ret;
-}
-
-
-
extern asmlinkage long sys_sysfs(int option, unsigned long arg1, unsigned long arg2);
/* Note: it is necessary to treat option as an unsigned int,
diff -ruN 2.5.56-32bit.3/include/asm-ppc64/compat.h 2.5.56-32bit.4/include/asm-ppc64/compat.h
--- 2.5.56-32bit.3/include/asm-ppc64/compat.h 2003-01-09 16:24:05.000000000 +1100
+++ 2.5.56-32bit.4/include/asm-ppc64/compat.h 2003-01-13 11:07:06.000000000 +1100
@@ -64,4 +64,17 @@
short __unused;
};
+struct compat_statfs {
+ int f_type;
+ int f_bsize;
+ int f_blocks;
+ int f_bfree;
+ int f_bavail;
+ int f_files;
+ int f_ffree;
+ compat_fsid_t f_fsid;
+ int f_namelen; /* SunOS ignores this field. */
+ int f_spare[6];
+};
+
#endif /* _ASM_PPC64_COMPAT_H */
diff -ruN 2.5.56-32bit.3/include/asm-ppc64/ppc32.h 2.5.56-32bit.4/include/asm-ppc64/ppc32.h
--- 2.5.56-32bit.3/include/asm-ppc64/ppc32.h 2003-01-09 16:24:05.000000000 +1100
+++ 2.5.56-32bit.4/include/asm-ppc64/ppc32.h 2003-01-13 11:07:06.000000000 +1100
@@ -40,19 +40,6 @@
/* These are here to support 32-bit syscalls on a 64-bit kernel. */
-struct statfs32 {
- int f_type;
- int f_bsize;
- int f_blocks;
- int f_bfree;
- int f_bavail;
- int f_files;
- int f_ffree;
- compat_fsid_t f_fsid;
- int f_namelen; /* SunOS ignores this field. */
- int f_spare[6];
-};
-
typedef union sigval32 {
int sival_int;
unsigned int sival_ptr;
Hi Linus,
Hopefully, with Martin's continued blessing, here is the s390x part.
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.56-32bit.3/arch/s390x/kernel/entry.S 2.5.56-32bit.4/arch/s390x/kernel/entry.S
--- 2.5.56-32bit.3/arch/s390x/kernel/entry.S 2003-01-02 15:13:45.000000000 +1100
+++ 2.5.56-32bit.4/arch/s390x/kernel/entry.S 2003-01-13 11:07:06.000000000 +1100
@@ -490,8 +490,8 @@
.long SYSCALL(sys_getpriority,sys32_getpriority_wrapper)
.long SYSCALL(sys_setpriority,sys32_setpriority_wrapper)
.long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old profil syscall */
- .long SYSCALL(sys_statfs,sys32_statfs_wrapper)
- .long SYSCALL(sys_fstatfs,sys32_fstatfs_wrapper) /* 100 */
+ .long SYSCALL(sys_statfs,compat_sys_statfs_wrapper)
+ .long SYSCALL(sys_fstatfs,compat_sys_fstatfs_wrapper) /* 100 */
.long SYSCALL(sys_ni_syscall,sys_ni_syscall)
.long SYSCALL(sys_socketcall,sys32_socketcall_wrapper)
.long SYSCALL(sys_syslog,sys32_syslog_wrapper)
diff -ruN 2.5.56-32bit.3/arch/s390x/kernel/linux32.c 2.5.56-32bit.4/arch/s390x/kernel/linux32.c
--- 2.5.56-32bit.3/arch/s390x/kernel/linux32.c 2003-01-09 16:23:54.000000000 +1100
+++ 2.5.56-32bit.4/arch/s390x/kernel/linux32.c 2003-01-13 11:07:06.000000000 +1100
@@ -884,61 +884,6 @@
return sys32_fcntl(fd, cmd, arg);
}
-static inline int put_statfs (struct statfs32 *ubuf, struct statfs *kbuf)
-{
- int err;
-
- err = put_user (kbuf->f_type, &ubuf->f_type);
- err |= __put_user (kbuf->f_bsize, &ubuf->f_bsize);
- err |= __put_user (kbuf->f_blocks, &ubuf->f_blocks);
- err |= __put_user (kbuf->f_bfree, &ubuf->f_bfree);
- err |= __put_user (kbuf->f_bavail, &ubuf->f_bavail);
- err |= __put_user (kbuf->f_files, &ubuf->f_files);
- err |= __put_user (kbuf->f_ffree, &ubuf->f_ffree);
- err |= __put_user (kbuf->f_namelen, &ubuf->f_namelen);
- err |= __put_user (kbuf->f_fsid.val[0], &ubuf->f_fsid.val[0]);
- err |= __put_user (kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1]);
- return err;
-}
-
-extern asmlinkage int sys_statfs(const char * path, struct statfs * buf);
-
-asmlinkage int sys32_statfs(const char * path, struct statfs32 *buf)
-{
- int ret;
- struct statfs s;
- mm_segment_t old_fs = get_fs();
- char *pth;
-
- pth = getname (path);
- ret = PTR_ERR(pth);
- if (!IS_ERR(pth)) {
- set_fs (KERNEL_DS);
- ret = sys_statfs((const char *)pth, &s);
- set_fs (old_fs);
- putname (pth);
- if (put_statfs(buf, &s))
- return -EFAULT;
- }
- return ret;
-}
-
-extern asmlinkage int sys_fstatfs(unsigned int fd, struct statfs * buf);
-
-asmlinkage int sys32_fstatfs(unsigned int fd, struct statfs32 *buf)
-{
- int ret;
- struct statfs s;
- mm_segment_t old_fs = get_fs();
-
- set_fs (KERNEL_DS);
- ret = sys_fstatfs(fd, &s);
- set_fs (old_fs);
- if (put_statfs(buf, &s))
- return -EFAULT;
- return ret;
-}
-
extern asmlinkage long sys_truncate(const char * path, unsigned long length);
extern asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
diff -ruN 2.5.56-32bit.3/arch/s390x/kernel/linux32.h 2.5.56-32bit.4/arch/s390x/kernel/linux32.h
--- 2.5.56-32bit.3/arch/s390x/kernel/linux32.h 2003-01-09 16:23:54.000000000 +1100
+++ 2.5.56-32bit.4/arch/s390x/kernel/linux32.h 2003-01-13 11:07:06.000000000 +1100
@@ -25,19 +25,6 @@
#define F_SETLK64 13
#define F_SETLKW64 14
-struct statfs32 {
- __s32 f_type;
- __s32 f_bsize;
- __s32 f_blocks;
- __s32 f_bfree;
- __s32 f_bavail;
- __s32 f_files;
- __s32 f_ffree;
- __kernel_fsid_t f_fsid;
- __s32 f_namelen;
- __s32 f_spare[6];
-};
-
typedef __u32 old_sigset_t32; /* at least 32 bits */
struct old_sigaction32 {
diff -ruN 2.5.56-32bit.3/arch/s390x/kernel/wrapper32.S 2.5.56-32bit.4/arch/s390x/kernel/wrapper32.S
--- 2.5.56-32bit.3/arch/s390x/kernel/wrapper32.S 2003-01-02 15:13:45.000000000 +1100
+++ 2.5.56-32bit.4/arch/s390x/kernel/wrapper32.S 2003-01-13 11:07:06.000000000 +1100
@@ -440,17 +440,17 @@
lgfr %r4,%r4 # int
jg sys_setpriority # branch to system call
- .globl sys32_statfs_wrapper
-sys32_statfs_wrapper:
+ .globl compat_sys_statfs_wrapper
+compat_sys_statfs_wrapper:
llgtr %r2,%r2 # char *
- llgtr %r3,%r3 # struct statfs_emu31 *
- jg sys32_statfs # branch to system call
+ llgtr %r3,%r3 # struct compat_statfs *
+ jg compat_sys_statfs # branch to system call
- .globl sys32_fstatfs_wrapper
-sys32_fstatfs_wrapper:
+ .globl compat_sys_fstatfs_wrapper
+compat_sys_fstatfs_wrapper:
llgfr %r2,%r2 # unsigned int
- llgtr %r3,%r3 # struct statfs_emu31 *
- jg sys32_fstatfs # branch to system call
+ llgtr %r3,%r3 # struct compat_statfs *
+ jg compat_sys_fstatfs # branch to system call
.globl sys32_socketcall_wrapper
sys32_socketcall_wrapper:
diff -ruN 2.5.56-32bit.3/include/asm-s390x/compat.h 2.5.56-32bit.4/include/asm-s390x/compat.h
--- 2.5.56-32bit.3/include/asm-s390x/compat.h 2003-01-09 16:24:05.000000000 +1100
+++ 2.5.56-32bit.4/include/asm-s390x/compat.h 2003-01-13 11:07:06.000000000 +1100
@@ -67,4 +67,17 @@
short __unused;
};
+struct compat_statfs {
+ s32 f_type;
+ s32 f_bsize;
+ s32 f_blocks;
+ s32 f_bfree;
+ s32 f_bavail;
+ s32 f_files;
+ s32 f_ffree;
+ compat_fsid_t f_fsid;
+ s32 f_namelen;
+ s32 f_spare[6];
+};
+
#endif /* _ASM_S390X_COMPAT_H */
Hi Andi,
Here is tha x86_64 part. This is relative to 2.5.56 and the previous
patches that I have sent you.
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.56-32bit.3/arch/x86_64/ia32/ia32entry.S 2.5.56-32bit.4/arch/x86_64/ia32/ia32entry.S
--- 2.5.56-32bit.3/arch/x86_64/ia32/ia32entry.S 2003-01-09 16:23:55.000000000 +1100
+++ 2.5.56-32bit.4/arch/x86_64/ia32/ia32entry.S 2003-01-13 11:07:06.000000000 +1100
@@ -299,8 +299,8 @@
.quad sys_getpriority
.quad sys_setpriority
.quad ni_syscall /* old profil syscall holder */
- .quad sys32_statfs
- .quad sys32_fstatfs /* 100 */
+ .quad compat_sys_statfs
+ .quad compat_sys_fstatfs /* 100 */
.quad sys_ioperm
.quad sys32_socketcall
.quad sys_syslog
diff -ruN 2.5.56-32bit.3/arch/x86_64/ia32/sys_ia32.c 2.5.56-32bit.4/arch/x86_64/ia32/sys_ia32.c
--- 2.5.56-32bit.3/arch/x86_64/ia32/sys_ia32.c 2003-01-13 11:03:59.000000000 +1100
+++ 2.5.56-32bit.4/arch/x86_64/ia32/sys_ia32.c 2003-01-13 11:07:06.000000000 +1100
@@ -404,58 +404,6 @@
return 0;
}
-static int
-put_statfs (struct statfs32 *ubuf, struct statfs *kbuf)
-{
- if (verify_area(VERIFY_WRITE, ubuf, sizeof(struct statfs32)) ||
- __put_user (kbuf->f_type, &ubuf->f_type) ||
- __put_user (kbuf->f_bsize, &ubuf->f_bsize) ||
- __put_user (kbuf->f_blocks, &ubuf->f_blocks) ||
- __put_user (kbuf->f_bfree, &ubuf->f_bfree) ||
- __put_user (kbuf->f_bavail, &ubuf->f_bavail) ||
- __put_user (kbuf->f_files, &ubuf->f_files) ||
- __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]))
- return -EFAULT;
- return 0;
-}
-
-extern asmlinkage long sys_statfs(const char * path, struct statfs * buf);
-
-asmlinkage long
-sys32_statfs(const char * path, struct statfs32 *buf)
-{
- int ret;
- struct statfs s;
- mm_segment_t old_fs = get_fs();
-
- set_fs (KERNEL_DS);
- ret = sys_statfs((const char *)path, &s);
- set_fs (old_fs);
- if (put_statfs(buf, &s))
- return -EFAULT;
- return ret;
-}
-
-extern asmlinkage long sys_fstatfs(unsigned int fd, struct statfs * buf);
-
-asmlinkage long
-sys32_fstatfs(unsigned int fd, struct statfs32 *buf)
-{
- int ret;
- struct statfs s;
- mm_segment_t old_fs = get_fs();
-
- set_fs (KERNEL_DS);
- ret = sys_fstatfs(fd, &s);
- set_fs (old_fs);
- if (put_statfs(buf, &s))
- return -EFAULT;
- return ret;
-}
-
static inline long
get_tv32(struct timeval *o, struct compat_timeval *i)
{
diff -ruN 2.5.56-32bit.3/include/asm-x86_64/compat.h 2.5.56-32bit.4/include/asm-x86_64/compat.h
--- 2.5.56-32bit.3/include/asm-x86_64/compat.h 2003-01-09 16:24:05.000000000 +1100
+++ 2.5.56-32bit.4/include/asm-x86_64/compat.h 2003-01-13 11:07:06.000000000 +1100
@@ -68,4 +68,17 @@
compat_pid_t l_pid;
};
+struct compat_statfs {
+ int f_type;
+ int f_bsize;
+ int f_blocks;
+ int f_bfree;
+ int f_bavail;
+ int f_files;
+ int f_ffree;
+ compat_fsid_t f_fsid;
+ int f_namelen; /* SunOS ignores this field. */
+ int f_spare[6];
+};
+
#endif /* _ASM_X86_64_COMPAT_H */
diff -ruN 2.5.56-32bit.3/include/asm-x86_64/ia32.h 2.5.56-32bit.4/include/asm-x86_64/ia32.h
--- 2.5.56-32bit.3/include/asm-x86_64/ia32.h 2003-01-09 16:24:05.000000000 +1100
+++ 2.5.56-32bit.4/include/asm-x86_64/ia32.h 2003-01-13 11:07:06.000000000 +1100
@@ -101,19 +101,6 @@
} __attribute__((packed));
-struct statfs32 {
- int f_type;
- int f_bsize;
- int f_blocks;
- int f_bfree;
- int f_bavail;
- int f_files;
- int f_ffree;
- compat_fsid_t f_fsid;
- int f_namelen; /* SunOS ignores this field. */
- int f_spare[6];
-};
-
typedef union sigval32 {
int sival_int;
unsigned int sival_ptr;
Hi Dave,
This is the sparc64 part. This is relative to 2.5.56 and the previous
patches I have sent you.
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.56-32bit.3/arch/sparc64/kernel/sys_sparc32.c 2.5.56-32bit.4/arch/sparc64/kernel/sys_sparc32.c
--- 2.5.56-32bit.3/arch/sparc64/kernel/sys_sparc32.c 2003-01-12 15:11:55.000000000 +1100
+++ 2.5.56-32bit.4/arch/sparc64/kernel/sys_sparc32.c 2003-01-13 11:07:06.000000000 +1100
@@ -840,61 +840,6 @@
return sys32_fcntl(fd, cmd, arg);
}
-static int put_statfs (struct statfs32 *ubuf, struct statfs *kbuf)
-{
- int err;
-
- err = put_user (kbuf->f_type, &ubuf->f_type);
- err |= __put_user (kbuf->f_bsize, &ubuf->f_bsize);
- err |= __put_user (kbuf->f_blocks, &ubuf->f_blocks);
- err |= __put_user (kbuf->f_bfree, &ubuf->f_bfree);
- err |= __put_user (kbuf->f_bavail, &ubuf->f_bavail);
- err |= __put_user (kbuf->f_files, &ubuf->f_files);
- err |= __put_user (kbuf->f_ffree, &ubuf->f_ffree);
- err |= __put_user (kbuf->f_namelen, &ubuf->f_namelen);
- err |= __put_user (kbuf->f_fsid.val[0], &ubuf->f_fsid.val[0]);
- err |= __put_user (kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1]);
- return err;
-}
-
-extern asmlinkage int sys_statfs(const char * path, struct statfs * buf);
-
-asmlinkage int sys32_statfs(const char * path, struct statfs32 *buf)
-{
- int ret;
- struct statfs s;
- mm_segment_t old_fs = get_fs();
- char *pth;
-
- pth = getname (path);
- ret = PTR_ERR(pth);
- if (!IS_ERR(pth)) {
- set_fs (KERNEL_DS);
- ret = sys_statfs((const char *)pth, &s);
- set_fs (old_fs);
- putname (pth);
- if (put_statfs(buf, &s))
- return -EFAULT;
- }
- return ret;
-}
-
-extern asmlinkage int sys_fstatfs(unsigned int fd, struct statfs * buf);
-
-asmlinkage int sys32_fstatfs(unsigned int fd, struct statfs32 *buf)
-{
- int ret;
- struct statfs s;
- mm_segment_t old_fs = get_fs();
-
- set_fs (KERNEL_DS);
- ret = sys_fstatfs(fd, &s);
- set_fs (old_fs);
- if (put_statfs(buf, &s))
- return -EFAULT;
- return ret;
-}
-
extern asmlinkage long sys_truncate(const char * path, unsigned long length);
extern asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
diff -ruN 2.5.56-32bit.3/arch/sparc64/kernel/systbls.S 2.5.56-32bit.4/arch/sparc64/kernel/systbls.S
--- 2.5.56-32bit.3/arch/sparc64/kernel/systbls.S 2003-01-02 15:13:45.000000000 +1100
+++ 2.5.56-32bit.4/arch/sparc64/kernel/systbls.S 2003-01-13 11:07:06.000000000 +1100
@@ -50,7 +50,7 @@
/*140*/ .word sys32_sendfile64, sys_nis_syscall, sys_futex, sys_gettid, sys32_getrlimit
.word sys32_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write
/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
- .word sys32_fcntl64, sys_ni_syscall, sys32_statfs, sys32_fstatfs, sys_oldumount
+ .word sys32_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount
/*160*/ .word sys32_sched_setaffinity, sys32_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
.word sys_quotactl, sys_set_tid_address, sys32_mount, sys_ustat, sys_setxattr
/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents
@@ -197,7 +197,7 @@
.word sunos_nosys, sunos_nosys
/*150*/ .word sys_getsockname, sunos_nosys, sunos_nosys
.word sys_poll, sunos_nosys, sunos_nosys
- .word sunos_getdirentries, sys32_statfs, sys32_fstatfs
+ .word sunos_getdirentries, compat_sys_statfs, compat_sys_fstatfs
.word sys_oldumount, sunos_nosys, sunos_nosys
.word sys_getdomainname, sys_setdomainname
.word sunos_nosys, sys_quotactl, sunos_nosys
diff -ruN 2.5.56-32bit.3/include/asm-sparc64/compat.h 2.5.56-32bit.4/include/asm-sparc64/compat.h
--- 2.5.56-32bit.3/include/asm-sparc64/compat.h 2003-01-09 16:24:05.000000000 +1100
+++ 2.5.56-32bit.4/include/asm-sparc64/compat.h 2003-01-13 11:07:06.000000000 +1100
@@ -64,4 +64,17 @@
short __unused;
};
+struct compat_statfs {
+ int f_type;
+ int f_bsize;
+ int f_blocks;
+ int f_bfree;
+ int f_bavail;
+ int f_files;
+ int f_ffree;
+ compat_fsid_t f_fsid;
+ int f_namelen; /* SunOS ignores this field. */
+ int f_spare[6];
+};
+
#endif /* _ASM_SPARC64_COMPAT_H */
diff -ruN 2.5.56-32bit.3/include/asm-sparc64/statfs.h 2.5.56-32bit.4/include/asm-sparc64/statfs.h
--- 2.5.56-32bit.3/include/asm-sparc64/statfs.h 2003-01-09 16:24:05.000000000 +1100
+++ 2.5.56-32bit.4/include/asm-sparc64/statfs.h 2003-01-13 11:07:06.000000000 +1100
@@ -5,25 +5,11 @@
#ifndef __KERNEL_STRICT_NAMES
#include <linux/types.h>
-#include <linux/compat.h> /* for compat_fsid_t */
typedef __kernel_fsid_t fsid_t;
#endif
-struct statfs32 {
- int f_type;
- int f_bsize;
- int f_blocks;
- int f_bfree;
- int f_bavail;
- int f_files;
- int f_ffree;
- compat_fsid_t f_fsid;
- int f_namelen; /* SunOS ignores this field. */
- int f_spare[6];
-};
-
struct statfs {
long f_type;
long f_bsize;
Hi Ralf,
This is the mips64 part. This is relative to 2.5.56 and the previous
patches I have sent you.
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.56-32bit.3/arch/mips64/kernel/linux32.c 2.5.56-32bit.4/arch/mips64/kernel/linux32.c
--- 2.5.56-32bit.3/arch/mips64/kernel/linux32.c 2003-01-13 11:03:51.000000000 +1100
+++ 2.5.56-32bit.4/arch/mips64/kernel/linux32.c 2003-01-13 11:07:06.000000000 +1100
@@ -524,72 +524,6 @@
return ret;
}
-struct statfs32 {
- int f_type;
- int f_bsize;
- int f_frsize;
- int f_blocks;
- int f_bfree;
- int f_files;
- int f_ffree;
- int f_bavail;
- compat_fsid_t f_fsid;
- int f_namelen;
- int f_spare[6];
-};
-
-static inline int
-put_statfs (struct statfs32 *ubuf, struct statfs *kbuf)
-{
- int err;
-
- err = put_user (kbuf->f_type, &ubuf->f_type);
- err |= __put_user (kbuf->f_bsize, &ubuf->f_bsize);
- err |= __put_user (kbuf->f_blocks, &ubuf->f_blocks);
- err |= __put_user (kbuf->f_bfree, &ubuf->f_bfree);
- err |= __put_user (kbuf->f_bavail, &ubuf->f_bavail);
- err |= __put_user (kbuf->f_files, &ubuf->f_files);
- err |= __put_user (kbuf->f_ffree, &ubuf->f_ffree);
- err |= __put_user (kbuf->f_namelen, &ubuf->f_namelen);
- err |= __put_user (kbuf->f_fsid.val[0], &ubuf->f_fsid.val[0]);
- err |= __put_user (kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1]);
- return err;
-}
-
-extern asmlinkage int sys_statfs(const char * path, struct statfs * buf);
-
-asmlinkage int
-sys32_statfs(const char * path, struct statfs32 *buf)
-{
- int ret;
- struct statfs s;
- mm_segment_t old_fs = get_fs();
-
- set_fs (KERNEL_DS);
- ret = sys_statfs((const char *)path, &s);
- set_fs (old_fs);
- if (put_statfs(buf, &s))
- return -EFAULT;
- return ret;
-}
-
-extern asmlinkage int sys_fstatfs(unsigned int fd, struct statfs * buf);
-
-asmlinkage int
-sys32_fstatfs(unsigned int fd, struct statfs32 *buf)
-{
- int ret;
- struct statfs s;
- mm_segment_t old_fs = get_fs();
-
- set_fs (KERNEL_DS);
- ret = sys_fstatfs(fd, &s);
- set_fs (old_fs);
- if (put_statfs(buf, &s))
- return -EFAULT;
- return ret;
-}
-
extern asmlinkage int
sys_getrusage(int who, struct rusage *ru);
diff -ruN 2.5.56-32bit.3/arch/mips64/kernel/scall_o32.S 2.5.56-32bit.4/arch/mips64/kernel/scall_o32.S
--- 2.5.56-32bit.3/arch/mips64/kernel/scall_o32.S 2003-01-13 11:02:35.000000000 +1100
+++ 2.5.56-32bit.4/arch/mips64/kernel/scall_o32.S 2003-01-13 11:07:06.000000000 +1100
@@ -332,8 +332,8 @@
sys sys_getpriority 2
sys sys_setpriority 3
sys sys_ni_syscall 0
- sys sys32_statfs 2
- sys sys32_fstatfs 2 /* 4100 */
+ sys compat_sys_statfs 2
+ sys compat_sys_fstatfs 2 /* 4100 */
sys sys_ni_syscall 0 /* sys_ioperm */
sys sys_socketcall 2
sys sys_syslog 3
diff -ruN 2.5.56-32bit.3/include/asm-mips64/compat.h 2.5.56-32bit.4/include/asm-mips64/compat.h
--- 2.5.56-32bit.3/include/asm-mips64/compat.h 2003-01-13 11:03:18.000000000 +1100
+++ 2.5.56-32bit.4/include/asm-mips64/compat.h 2003-01-13 11:07:06.000000000 +1100
@@ -66,4 +66,18 @@
short __unused;
};
+struct compat_statfs {
+ int f_type;
+ int f_bsize;
+ int f_frsize;
+ int f_blocks;
+ int f_bfree;
+ int f_files;
+ int f_ffree;
+ int f_bavail;
+ compat_fsid_t f_fsid;
+ int f_namelen;
+ int f_spare[6];
+};
+
#endif /* _ASM_MIPS64_COMPAT_H */
Hi Willy,
Here is the parisc part. This is relative to 2.5.56 and the previous
patches I have sent you.
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.56-32bit.3/arch/parisc/kernel/sys_parisc32.c 2.5.56-32bit.4/arch/parisc/kernel/sys_parisc32.c
--- 2.5.56-32bit.3/arch/parisc/kernel/sys_parisc32.c 2003-01-13 11:03:51.000000000 +1100
+++ 2.5.56-32bit.4/arch/parisc/kernel/sys_parisc32.c 2003-01-13 11:07:06.000000000 +1100
@@ -315,74 +315,6 @@
return -ENOSYS;
}
-/* 32-bit user apps use struct statfs which uses 'long's */
-struct statfs32 {
- __s32 f_type;
- __s32 f_bsize;
- __s32 f_blocks;
- __s32 f_bfree;
- __s32 f_bavail;
- __s32 f_files;
- __s32 f_ffree;
- __kernel_fsid_t f_fsid;
- __s32 f_namelen;
- __s32 f_spare[6];
-};
-
-/* convert statfs struct to statfs32 struct and copy result to user */
-static unsigned long statfs32_to_user(struct statfs32 *ust32, struct statfs *st)
-{
- struct statfs32 st32;
-#undef CP
-#define CP(a) st32.a = st->a
- CP(f_type);
- CP(f_bsize);
- CP(f_blocks);
- CP(f_bfree);
- CP(f_bavail);
- CP(f_files);
- CP(f_ffree);
- CP(f_fsid);
- CP(f_namelen);
- return copy_to_user(ust32, &st32, sizeof st32);
-}
-
-/* The following statfs calls are copies of code from linux/fs/open.c and
- * should be checked against those from time to time */
-asmlinkage long sys32_statfs(const char * path, struct statfs32 * buf)
-{
- struct nameidata nd;
- int error;
-
- error = user_path_walk(path, &nd);
- if (!error) {
- struct statfs tmp;
- error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp);
- if (!error && statfs32_to_user(buf, &tmp))
- error = -EFAULT;
- path_release(&nd);
- }
- return error;
-}
-
-asmlinkage long sys32_fstatfs(unsigned int fd, struct statfs32 * buf)
-{
- struct file * file;
- struct statfs tmp;
- int error;
-
- error = -EBADF;
- file = fget(fd);
- if (!file)
- goto out;
- error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp);
- if (!error && statfs32_to_user(buf, &tmp))
- error = -EFAULT;
- fput(file);
-out:
- return error;
-}
-
/* These may not work without my local types changes, but I wanted the
* code available in case it's useful to others. -PB
*/
diff -ruN 2.5.56-32bit.3/include/asm-parisc/compat.h 2.5.56-32bit.4/include/asm-parisc/compat.h
--- 2.5.56-32bit.3/include/asm-parisc/compat.h 2003-01-13 11:03:18.000000000 +1100
+++ 2.5.56-32bit.4/include/asm-parisc/compat.h 2003-01-13 11:07:06.000000000 +1100
@@ -72,4 +72,17 @@
compat_pid_t l_pid;
};
+struct compat_statfs {
+ s32 f_type;
+ s32 f_bsize;
+ s32 f_blocks;
+ s32 f_bfree;
+ s32 f_bavail;
+ s32 f_files;
+ s32 f_ffree;
+ __kernel_fsid_t f_fsid;
+ s32 f_namelen;
+ s32 f_spare[6];
+};
+
#endif /* _ASM_PARISC_COMPAT_H */
Hi David,
Here is the ia64 part. It is relative to 2.5.56 plus the previous patches
I have sent you.
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/
diff -ruN 2.5.56-32bit.3/arch/ia64/ia32/ia32_entry.S 2.5.56-32bit.4/arch/ia64/ia32/ia32_entry.S
--- 2.5.56-32bit.3/arch/ia64/ia32/ia32_entry.S 2002-12-27 15:15:38.000000000 +1100
+++ 2.5.56-32bit.4/arch/ia64/ia32/ia32_entry.S 2003-01-13 11:07:06.000000000 +1100
@@ -290,8 +290,8 @@
data8 sys_getpriority
data8 sys_setpriority
data8 sys32_ni_syscall /* old profil syscall holder */
- data8 sys32_statfs
- data8 sys32_fstatfs /* 100 */
+ data8 compat_sys_statfs
+ data8 compat_sys_fstatfs /* 100 */
data8 sys32_ioperm
data8 sys32_socketcall
data8 sys_syslog
diff -ruN 2.5.56-32bit.3/arch/ia64/ia32/sys_ia32.c 2.5.56-32bit.4/arch/ia64/ia32/sys_ia32.c
--- 2.5.56-32bit.3/arch/ia64/ia32/sys_ia32.c 2003-01-13 11:03:51.000000000 +1100
+++ 2.5.56-32bit.4/arch/ia64/ia32/sys_ia32.c 2003-01-13 11:07:06.000000000 +1100
@@ -609,61 +609,6 @@
return retval;
}
-static inline int
-put_statfs (struct statfs32 *ubuf, struct statfs *kbuf)
-{
- int err;
-
- if (!access_ok(VERIFY_WRITE, ubuf, sizeof(*ubuf)))
- return -EFAULT;
-
- err = __put_user(kbuf->f_type, &ubuf->f_type);
- err |= __put_user(kbuf->f_bsize, &ubuf->f_bsize);
- err |= __put_user(kbuf->f_blocks, &ubuf->f_blocks);
- err |= __put_user(kbuf->f_bfree, &ubuf->f_bfree);
- err |= __put_user(kbuf->f_bavail, &ubuf->f_bavail);
- err |= __put_user(kbuf->f_files, &ubuf->f_files);
- err |= __put_user(kbuf->f_ffree, &ubuf->f_ffree);
- err |= __put_user(kbuf->f_namelen, &ubuf->f_namelen);
- err |= __put_user(kbuf->f_fsid.val[0], &ubuf->f_fsid.val[0]);
- err |= __put_user(kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1]);
- return err;
-}
-
-extern asmlinkage long sys_statfs(const char * path, struct statfs * buf);
-
-asmlinkage long
-sys32_statfs (const char *path, struct statfs32 *buf)
-{
- int ret;
- struct statfs s;
- mm_segment_t old_fs = get_fs();
-
- set_fs(KERNEL_DS);
- ret = sys_statfs(path, &s);
- set_fs(old_fs);
- if (put_statfs(buf, &s))
- return -EFAULT;
- return ret;
-}
-
-extern asmlinkage long sys_fstatfs(unsigned int fd, struct statfs * buf);
-
-asmlinkage long
-sys32_fstatfs (unsigned int fd, struct statfs32 *buf)
-{
- int ret;
- struct statfs s;
- mm_segment_t old_fs = get_fs();
-
- set_fs(KERNEL_DS);
- ret = sys_fstatfs(fd, &s);
- set_fs(old_fs);
- if (put_statfs(buf, &s))
- return -EFAULT;
- return ret;
-}
-
static inline long
get_tv32 (struct timeval *o, struct compat_timeval *i)
{
diff -ruN 2.5.56-32bit.3/include/asm-ia64/compat.h 2.5.56-32bit.4/include/asm-ia64/compat.h
--- 2.5.56-32bit.3/include/asm-ia64/compat.h 2003-01-13 11:02:36.000000000 +1100
+++ 2.5.56-32bit.4/include/asm-ia64/compat.h 2003-01-13 11:07:06.000000000 +1100
@@ -61,11 +61,24 @@
};
struct compat_flock {
- short l_type;
- short l_whence;
- compat_off_t l_start;
- compat_off_t l_len;
- compat_pid_t l_pid;
+ short l_type;
+ short l_whence;
+ compat_off_t l_start;
+ compat_off_t l_len;
+ compat_pid_t l_pid;
+};
+
+struct compat_statfs {
+ int f_type;
+ int f_bsize;
+ int f_blocks;
+ int f_bfree;
+ int f_bavail;
+ int f_files;
+ int f_ffree;
+ compat_fsid_t f_fsid;
+ int f_namelen; /* SunOS ignores this field. */
+ int f_spare[6];
};
#endif /* _ASM_IA64_COMPAT_H */
diff -ruN 2.5.56-32bit.3/include/asm-ia64/ia32.h 2.5.56-32bit.4/include/asm-ia64/ia32.h
--- 2.5.56-32bit.3/include/asm-ia64/ia32.h 2003-01-13 11:02:36.000000000 +1100
+++ 2.5.56-32bit.4/include/asm-ia64/ia32.h 2003-01-13 11:07:06.000000000 +1100
@@ -203,19 +203,6 @@
unsigned int st_ino_hi;
};
-struct statfs32 {
- int f_type;
- int f_bsize;
- int f_blocks;
- int f_bfree;
- int f_bavail;
- int f_files;
- int f_ffree;
- compat_fsid_t f_fsid;
- int f_namelen; /* SunOS ignores this field. */
- int f_spare[6];
-};
-
typedef union sigval32 {
int sival_int;
unsigned int sival_ptr;
Hi Stephen,
> Hopefully, with Martin's continued blessing, here is the s390x part.
Looks fine to me. I can't test it at the moment because the s390x compat
stuff is broken right now. Not because of your patches but other things
need fixing. I'll have a go at it as soon as I'm through with the TLS
stuff for binutils and glibc. Keep up with it, I'm happy about every
line of code that is moved out of the arch/s390* folders.
blue skies,
Martin
Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH
Sch?naicherstr. 220, D-71032 B?blingen, Telefon: 49 - (0)7031 - 16-2247
E-Mail: [email protected]
Hi Martin,
On Mon, 13 Jan 2003 10:11:20 +0100 "Martin Schwidefsky" <[email protected]> wrote:
>
> Looks fine to me. I can't test it at the moment because the s390x compat
> stuff is broken right now. Not because of your patches but other things
> need fixing. I'll have a go at it as soon as I'm through with the TLS
> stuff for binutils and glibc. Keep up with it, I'm happy about every
> line of code that is moved out of the arch/s390* folders.
Thanks, wiil do.
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/