mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Linus <torvalds@transmeta.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	anton@samba.org, "David S. Miller" <davem@redhat.com>,
	ak@muc.de, davidm@hpl.hp.com, schwidefsky@de.ibm.com,
	ralf@gnu.org, willy@debian.org
Subject: [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent
Date: Fri, 13 Dec 2002 15:34:39 +1100	[thread overview]
Message-ID: <20021213153439.1f3e466e.sfr@canb.auug.org.au> (raw)

Hi Linus,

Another in the COMPAT series.  This build on the previous patches.

This patch renames more types and moves them into asm/compat.h and
also consolidates sys32_new{stat,fstat,lstat}.

Across all the architectures, the diffstat looks like this:
 arch/ia64/ia32/ia32_entry.S       |    6 -
 arch/ia64/ia32/sys_ia32.c         |  131 +++++++++++++-------------------------
 arch/mips64/kernel/linux32.c      |   59 +++--------------
 arch/mips64/kernel/scall_o32.S    |    6 -
 arch/parisc/kernel/ioctl32.c      |   10 +-
 arch/parisc/kernel/sys_parisc32.c |   85 +++---------------------
 arch/ppc64/kernel/ioctl32.c       |    8 +-
 arch/ppc64/kernel/misc.S          |    6 -
 arch/ppc64/kernel/sys_ppc32.c     |   96 +++++++++------------------
 arch/s390x/kernel/entry.S         |    6 -
 arch/s390x/kernel/ioctl32.c       |    5 -
 arch/s390x/kernel/linux32.c       |  107 ++++++++++---------------------
 arch/s390x/kernel/linux32.h       |   37 ----------
 arch/s390x/kernel/wrapper32.S     |   22 +++---
 arch/sparc64/kernel/ioctl32.c     |   10 +-
 arch/sparc64/kernel/sys_sparc32.c |  110 +++++++++++--------------------
 arch/sparc64/kernel/sys_sunos32.c |   16 ++--
 arch/sparc64/kernel/systbls.S     |   12 +--
 arch/x86_64/ia32/ia32_ioctl.c     |   10 +-
 arch/x86_64/ia32/ia32entry.S      |    6 -
 arch/x86_64/ia32/ipc32.c          |   16 ++--
 arch/x86_64/ia32/sys_ia32.c       |   84 ++++--------------------
 fs/Makefile                       |    2 
 fs/compat.c                       |   72 ++++++++++++++++++++
 include/asm-ia64/compat.h         |   32 ++++++++-
 include/asm-ia64/ia32.h           |   36 ----------
 include/asm-mips64/compat.h       |   31 ++++++++
 include/asm-mips64/posix_types.h  |    8 --
 include/asm-mips64/stat.h         |   24 ------
 include/asm-parisc/compat.h       |   39 +++++++++++
 include/asm-parisc/posix_types.h  |    8 --
 include/asm-ppc64/compat.h        |   28 ++++++++
 include/asm-ppc64/ppc32.h         |   46 ++-----------
 include/asm-s390x/compat.h        |   31 ++++++++
 include/asm-sparc64/compat.h      |   28 ++++++++
 include/asm-sparc64/fcntl.h       |    8 +-
 include/asm-sparc64/posix_types.h |    8 --
 include/asm-sparc64/siginfo.h     |    6 -
 include/asm-sparc64/stat.h        |   21 ------
 include/asm-x86_64/compat.h       |   31 ++++++++
 include/asm-x86_64/ia32.h         |   42 +-----------
 include/linux/compat.h            |    3 
 kernel/compat.c                   |   19 -----
 43 files changed, 589 insertions(+), 782 deletions(-)

This is just the architecture independent part of the patch.  I have
built this on PPC64 only.

Please apply.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/fs/Makefile 2.5.51-32bit.2/fs/Makefile
--- 2.5.51-32bit.1/fs/Makefile	2002-11-28 10:34:54.000000000 +1100
+++ 2.5.51-32bit.2/fs/Makefile	2002-12-12 17:18:35.000000000 +1100
@@ -15,6 +15,8 @@
 		filesystems.o namespace.o seq_file.o xattr.o libfs.o \
 		fs-writeback.o mpage.o direct-io.o aio.o eventpoll.o
 
+obj-$(CONFIG_COMPAT) += compat.o
+
 ifneq ($(CONFIG_NFSD),n)
 ifneq ($(CONFIG_NFSD),)
 obj-y += nfsctl.o
diff -ruN 2.5.51-32bit.1/fs/compat.c 2.5.51-32bit.2/fs/compat.c
--- 2.5.51-32bit.1/fs/compat.c	1970-01-01 10:00:00.000000000 +1000
+++ 2.5.51-32bit.2/fs/compat.c	2002-12-13 15:11:15.000000000 +1100
@@ -0,0 +1,72 @@
+/*
+ *  linux/fs/compat.c
+ *
+ *  Kernel compatibililty routines for e.g. 32 bit syscall support
+ *  on 64 bit kernels.
+ *
+ *  Copyright (C) 2002 Stephen Rothwell, IBM Corporation
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#include <linux/linkage.h>
+#include <linux/compat.h>
+#include <linux/errno.h>
+#include <linux/time.h>
+#include <linux/fs.h>
+
+#include <asm/uaccess.h>
+
+/*
+ * Not all architectures have sys_utime, so implement this in terms
+ * of sys_utimes.
+ */
+asmlinkage long compat_sys_utime(char *filename, struct compat_utimbuf *t)
+{
+	struct timeval tv[2];
+
+	if (t) {
+		if (get_user(tv[0].tv_sec, &t->actime) ||
+		    get_user(tv[1].tv_sec, &t->modtime))
+			return -EFAULT;
+		tv[0].tv_usec = 0;
+		tv[1].tv_usec = 0;
+	}
+	return do_utimes(filename, t ? tv : NULL);
+}
+
+
+asmlinkage long compat_sys_newstat(char * filename,
+		struct compat_stat *statbuf)
+{
+	struct kstat stat;
+	int error = vfs_stat(filename, &stat);
+
+	if (!error)
+		error = cp_compat_stat(&stat, statbuf);
+	return error;
+}
+
+asmlinkage long compat_sys_newlstat(char * filename,
+		struct compat_stat *statbuf)
+{
+	struct kstat stat;
+	int error = vfs_lstat(filename, &stat);
+
+	if (!error)
+		error = cp_compat_stat(&stat, statbuf);
+	return error;
+}
+
+asmlinkage long compat_sys_newfstat(unsigned int fd,
+		struct compat_stat * statbuf)
+{
+	struct kstat stat;
+	int error = vfs_fstat(fd, &stat);
+
+	if (!error)
+		error = cp_compat_stat(&stat, statbuf);
+	return error;
+}
diff -ruN 2.5.51-32bit.1/include/linux/compat.h 2.5.51-32bit.2/include/linux/compat.h
--- 2.5.51-32bit.1/include/linux/compat.h	2002-12-10 17:32:48.000000000 +1100
+++ 2.5.51-32bit.2/include/linux/compat.h	2002-12-13 14:49:21.000000000 +1100
@@ -8,6 +8,7 @@
 
 #ifdef CONFIG_COMPAT
 
+#include <linux/stat.h>
 #include <asm/compat.h>
 
 #define compat_jiffies_to_clock_t(x)	((x) / (HZ / COMPAT_USER_HZ))
@@ -29,5 +30,7 @@
 	compat_clock_t		tms_cstime;
 };
 
+extern int cp_compat_stat(struct kstat *, struct compat_stat *);
+
 #endif /* CONFIG_COMPAT */
 #endif /* _LINUX_COMPAT_H */
diff -ruN 2.5.51-32bit.1/kernel/compat.c 2.5.51-32bit.2/kernel/compat.c
--- 2.5.51-32bit.1/kernel/compat.c	2002-12-10 16:45:09.000000000 +1100
+++ 2.5.51-32bit.2/kernel/compat.c	2002-12-12 17:19:15.000000000 +1100
@@ -88,25 +88,6 @@
 	return ret;
 }
 
-/*
- * Not all architectures have sys_utime, so implement this in terms
- * of sys_utimes.
- */
-asmlinkage long compat_sys_utime(char *filename, struct compat_utimbuf *t)
-{
-	struct timeval tv[2];
-
-	if (t) {
-		if (get_user(tv[0].tv_sec, &t->actime) ||
-		    get_user(tv[1].tv_sec, &t->modtime))
-			return -EFAULT;
-		tv[0].tv_usec = 0;
-		tv[1].tv_usec = 0;
-	}
-	return do_utimes(filename, t ? tv : NULL);
-}
-
-
 static inline long get_compat_itimerval(struct itimerval *o,
 		struct compat_itimerval *i)
 {

             reply	other threads:[~2002-12-13  4:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-13  4:34 Stephen Rothwell [this message]
2002-12-13  4:37 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - ppc64 Stephen Rothwell
2002-12-13  4:39 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - sparc64 Stephen Rothwell
2002-12-13  4:43 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - x86_64 Stephen Rothwell
2002-12-13  4:44 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - ia64 Stephen Rothwell
2002-12-13  4:46 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - s390x Stephen Rothwell
2002-12-13  4:48 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - mips64 Stephen Rothwell
2002-12-13  4:51 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - parisc Stephen Rothwell
2002-12-13  5:32 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent David S. Miller
2002-12-13  6:18   ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021213153439.1f3e466e.sfr@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=ak@muc.de \
    --cc=anton@samba.org \
    --cc=davem@redhat.com \
    --cc=davidm@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ralf@gnu.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=torvalds@transmeta.com \
    --cc=willy@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®