* Re: [PATCH][COMPAT] compat_sys_[f]statfs - s390x part
@ 2003-01-13 9:11 Martin Schwidefsky
2003-01-13 12:38 ` Stephen Rothwell
0 siblings, 1 reply; 3+ messages in thread
From: Martin Schwidefsky @ 2003-01-13 9:11 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: torvalds, linux-kernel
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: schwidefsky@de.ibm.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][COMPAT] compat_sys_[f]statfs - s390x part
2003-01-13 9:11 [PATCH][COMPAT] compat_sys_[f]statfs - s390x part Martin Schwidefsky
@ 2003-01-13 12:38 ` Stephen Rothwell
0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2003-01-13 12:38 UTC (permalink / raw)
To: Martin Schwidefsky; +Cc: torvalds, linux-kernel
Hi Martin,
On Mon, 13 Jan 2003 10:11:20 +0100 "Martin Schwidefsky" <schwidefsky@de.ibm.com> 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 sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH][COMPAT] compat_sys_[f]statfs - generic part
@ 2003-01-13 5:09 Stephen Rothwell
2003-01-13 5:25 ` [PATCH][COMPAT] compat_sys_[f]statfs - s390x part Stephen Rothwell
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2003-01-13 5:09 UTC (permalink / raw)
To: Linus
Cc: LKML, anton, David S. Miller, ak, davidm, schwidefsky, ralf, matthew
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 sfr@canb.auug.org.au
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;
+}
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH][COMPAT] compat_sys_[f]statfs - s390x part
2003-01-13 5:09 [PATCH][COMPAT] compat_sys_[f]statfs - generic part Stephen Rothwell
@ 2003-01-13 5:25 ` Stephen Rothwell
0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2003-01-13 5:25 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel, schwidefsky
Hi Linus,
Hopefully, with Martin's continued blessing, here is the s390x part.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
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 */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-01-13 12:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-13 9:11 [PATCH][COMPAT] compat_sys_[f]statfs - s390x part Martin Schwidefsky
2003-01-13 12:38 ` Stephen Rothwell
-- strict thread matches above, loose matches on Subject: below --
2003-01-13 5:09 [PATCH][COMPAT] compat_sys_[f]statfs - generic part Stephen Rothwell
2003-01-13 5:25 ` [PATCH][COMPAT] compat_sys_[f]statfs - s390x part Stephen Rothwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®