public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent
@ 2002-12-13  4:34 Stephen Rothwell
  2002-12-13  4:37 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - ppc64 Stephen Rothwell
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-13  4:34 UTC (permalink / raw)
  To: Linus; +Cc: LKML, anton, David S. Miller, ak, davidm, schwidefsky, ralf,
	willy

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)
 {

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - ppc64
  2002-12-13  4:34 [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent Stephen Rothwell
@ 2002-12-13  4:37 ` Stephen Rothwell
  2002-12-13  4:39 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - sparc64 Stephen Rothwell
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-13  4:37 UTC (permalink / raw)
  To: anton; +Cc: linux-kernel

Hi Anton,

Here is the ppc64 part of this patch.

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

diff -ruN 2.5.51-32bit.1/arch/ppc64/kernel/ioctl32.c 2.5.51-32bit.2/arch/ppc64/kernel/ioctl32.c
--- 2.5.51-32bit.1/arch/ppc64/kernel/ioctl32.c	2002-12-10 15:10:16.000000000 +1100
+++ 2.5.51-32bit.2/arch/ppc64/kernel/ioctl32.c	2002-12-13 15:18:39.000000000 +1100
@@ -1722,9 +1722,9 @@
 
 struct loop_info32 {
 	int			lo_number;      /* ioctl r/o */
-	__kernel_dev_t32	lo_device;      /* ioctl r/o */
+	compat_dev_t	lo_device;      /* ioctl r/o */
 	unsigned int		lo_inode;       /* ioctl r/o */
-	__kernel_dev_t32	lo_rdevice;     /* ioctl r/o */
+	compat_dev_t	lo_rdevice;     /* ioctl r/o */
 	int			lo_offset;
 	int			lo_encrypt_type;
 	int			lo_encrypt_key_size;    /* ioctl w/o */
@@ -2054,7 +2054,7 @@
 	set_fs(old_fs);
 
 	if (err >= 0)
-		err = put_user(kuid, (__kernel_uid_t32 *)arg);
+		err = put_user(kuid, (compat_uid_t *)arg);
 
 	return err;
 }
@@ -3656,7 +3656,7 @@
 #define HANDLE_IOCTL(cmd,handler) { cmd, (unsigned long)handler, 0 }
 
 #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int)
-#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, __kernel_uid_t32)
+#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
 
 static struct ioctl_trans ioctl_translations[] = {
     /* List here explicitly which ioctl's need translation,
diff -ruN 2.5.51-32bit.1/arch/ppc64/kernel/misc.S 2.5.51-32bit.2/arch/ppc64/kernel/misc.S
--- 2.5.51-32bit.1/arch/ppc64/kernel/misc.S	2002-12-10 17:06:50.000000000 +1100
+++ 2.5.51-32bit.2/arch/ppc64/kernel/misc.S	2002-12-13 14:57:05.000000000 +1100
@@ -614,9 +614,9 @@
 	.llong .sys32_syslog
 	.llong .compat_sys_setitimer
 	.llong .compat_sys_getitimer		/* 105 */
-	.llong .sys32_newstat
-	.llong .sys32_newlstat
-	.llong .sys32_newfstat
+	.llong .compat_sys_newstat
+	.llong .compat_sys_newlstat
+	.llong .compat_sys_newfstat
 	.llong .sys_uname
 	.llong .sys_ni_syscall		/* 110 old iopl syscall */
 	.llong .sys_vhangup
diff -ruN 2.5.51-32bit.1/arch/ppc64/kernel/sys_ppc32.c 2.5.51-32bit.2/arch/ppc64/kernel/sys_ppc32.c
--- 2.5.51-32bit.1/arch/ppc64/kernel/sys_ppc32.c	2002-12-10 17:07:08.000000000 +1100
+++ 2.5.51-32bit.2/arch/ppc64/kernel/sys_ppc32.c	2002-12-13 14:44:53.000000000 +1100
@@ -300,16 +300,16 @@
 struct ncp_mount_data32_v3 {
         int version;
         unsigned int ncp_fd;
-        __kernel_uid_t32 mounted_uid;
-        __kernel_pid_t32 wdog_pid;
+        compat_uid_t mounted_uid;
+        compat_pid_t wdog_pid;
         unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
         unsigned int time_out;
         unsigned int retry_count;
         unsigned int flags;
-        __kernel_uid_t32 uid;
-        __kernel_gid_t32 gid;
-        __kernel_mode_t32 file_mode;
-        __kernel_mode_t32 dir_mode;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
 };
 
 struct ncp_mount_data32_v4 {
@@ -380,11 +380,11 @@
 
 struct smb_mount_data32 {
         int version;
-        __kernel_uid_t32 mounted_uid;
-        __kernel_uid_t32 uid;
-        __kernel_gid_t32 gid;
-        __kernel_mode_t32 file_mode;
-        __kernel_mode_t32 dir_mode;
+        compat_uid_t mounted_uid;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
 };
 
 static void *do_smb_super_data_conv(void *raw_data)
@@ -802,10 +802,13 @@
 	return sys32_select((int)n, inp, outp, exp, tvp_x);
 }
 
-static int cp_new_stat32(struct kstat *stat, struct stat32 *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
 {
 	int err;
 
+	if (stat->size > MAX_NON_LFS)
+		return -EOVERFLOW;
+
 	err  = put_user(stat->dev, &statbuf->st_dev);
 	err |= put_user(stat->ino, &statbuf->st_ino);
 	err |= put_user(stat->mode, &statbuf->st_mode);
@@ -813,8 +816,6 @@
 	err |= put_user(stat->uid, &statbuf->st_uid);
 	err |= put_user(stat->gid, &statbuf->st_gid);
 	err |= put_user(stat->rdev, &statbuf->st_rdev);
-	if (stat->size > MAX_NON_LFS)
-		return -EOVERFLOW;
 	err |= put_user(stat->size, &statbuf->st_size);
 	err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
 	err |= put_user(0, &statbuf->__unused1);
@@ -830,39 +831,6 @@
 	return err;
 }
 
-asmlinkage long sys32_newstat(char* filename, struct stat32* statbuf)
-{
-	struct kstat stat;
-	int error = vfs_stat(filename, &stat);
-	
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage long sys32_newlstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_lstat(filename, &stat);
-	
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage long sys32_newfstat(unsigned int fd, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_fstat(fd, &stat);
-	
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
 static inline int put_statfs (struct statfs32 *ubuf, struct statfs *kbuf)
 {
 	int err;
@@ -1492,27 +1460,27 @@
 struct nfsctl_export32 {
 	s8			ex32_client[NFSCLNT_IDMAX+1];
 	s8			ex32_path[NFS_MAXPATHLEN+1];
-	__kernel_dev_t32	ex32_dev;
-	__kernel_ino_t32	ex32_ino;
+	compat_dev_t	ex32_dev;
+	compat_ino_t	ex32_ino;
 	s32			ex32_flags;
-	__kernel_uid_t32	ex32_anon_uid;
-	__kernel_gid_t32	ex32_anon_gid;
+	compat_uid_t	ex32_anon_uid;
+	compat_gid_t	ex32_anon_gid;
 };
 
 struct nfsctl_uidmap32 {
 	u32			ug32_ident;   /* char * */
-	__kernel_uid_t32	ug32_uidbase;
+	compat_uid_t	ug32_uidbase;
 	s32			ug32_uidlen;
 	u32			ug32_udimap;  /* uid_t * */
-	__kernel_uid_t32	ug32_gidbase;
+	compat_uid_t	ug32_gidbase;
 	s32			ug32_gidlen;
 	u32			ug32_gdimap;  /* gid_t * */
 };
 
 struct nfsctl_fhparm32 {
 	struct sockaddr		gf32_addr;
-	__kernel_dev_t32	gf32_dev;
-	__kernel_ino_t32	gf32_ino;
+	compat_dev_t	gf32_dev;
+	compat_ino_t	gf32_ino;
 	s32			gf32_version;
 };
 
@@ -1645,7 +1613,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_udimap[i],
-			      &(((__kernel_uid_t32 *)A(uaddr))[i]));
+			      &(((compat_uid_t *)A(uaddr))[i]));
 	err |= __get_user(karg->ca_umap.ug_gidbase,
 		      &arg32->ca32_umap.ug32_gidbase);
 	err |= __get_user(karg->ca_umap.ug_uidlen,
@@ -1659,7 +1627,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_gdimap[i],
-			      &(((__kernel_gid_t32 *)A(uaddr))[i]));
+			      &(((compat_gid_t *)A(uaddr))[i]));
 
 	return err;
 }
@@ -2128,8 +2096,8 @@
 	unsigned int msg_cbytes;
 	unsigned int msg_qnum;
 	unsigned int msg_qbytes;
-	__kernel_pid_t32 msg_lspid;
-	__kernel_pid_t32 msg_lrpid;
+	compat_pid_t msg_lspid;
+	compat_pid_t msg_lrpid;
 	unsigned int __unused4;
 	unsigned int __unused5;
 };
@@ -2158,8 +2126,8 @@
 	compat_time_t shm_ctime;
 	unsigned int __unused4;
 	compat_size_t shm_segsz;
-	__kernel_pid_t32 shm_cpid;
-	__kernel_pid_t32 shm_lpid;
+	compat_pid_t shm_cpid;
+	compat_pid_t shm_lpid;
 	unsigned int shm_nattch;
 	unsigned int __unused5;
 	unsigned int __unused6;
@@ -2681,7 +2649,7 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_sendfile(u32 out_fd, u32 in_fd, __kernel_off_t32* offset, u32 count)
+asmlinkage long sys32_sendfile(u32 out_fd, u32 in_fd, compat_off_t* offset, u32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -4265,7 +4233,7 @@
 extern asmlinkage int sys_sched_setaffinity(pid_t pid, unsigned int len,
 					    unsigned long *user_mask_ptr);
 
-asmlinkage int sys32_sched_setaffinity(__kernel_pid_t32 pid, unsigned int len,
+asmlinkage int sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
 				       u32 *user_mask_ptr)
 {
 	unsigned long kernel_mask;
@@ -4289,7 +4257,7 @@
 extern asmlinkage int sys_sched_getaffinity(pid_t pid, unsigned int len,
 					    unsigned long *user_mask_ptr);
 
-asmlinkage int sys32_sched_getaffinity(__kernel_pid_t32 pid, unsigned int len,
+asmlinkage int sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
 				       u32 *user_mask_ptr)
 {
 	unsigned long kernel_mask;
diff -ruN 2.5.51-32bit.1/include/asm-ppc64/compat.h 2.5.51-32bit.2/include/asm-ppc64/compat.h
--- 2.5.51-32bit.1/include/asm-ppc64/compat.h	2002-12-10 16:38:13.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-ppc64/compat.h	2002-12-12 16:14:11.000000000 +1100
@@ -11,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u32		compat_uid_t;
+typedef u32		compat_gid_t;
+typedef u32		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u32		compat_dev_t;
+typedef s32		compat_off_t;
+typedef s16		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -22,4 +30,24 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;	
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	compat_off_t	st_size;
+	compat_off_t	st_blksize;
+	compat_off_t	st_blocks;
+	compat_time_t	st_atime;
+	u32		__unused1;
+	compat_time_t	st_mtime;
+	u32		__unused2;
+	compat_time_t	st_ctime;
+	u32		__unused3;
+	u32		__unused4[2];
+};
+
 #endif /* _ASM_PPC64_COMPAT_H */
diff -ruN 2.5.51-32bit.1/include/asm-ppc64/ppc32.h 2.5.51-32bit.2/include/asm-ppc64/ppc32.h
--- 2.5.51-32bit.1/include/asm-ppc64/ppc32.h	2002-12-10 15:44:11.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-ppc64/ppc32.h	2002-12-12 16:01:09.000000000 +1100
@@ -44,17 +44,9 @@
 })
 
 /* These are here to support 32-bit syscalls on a 64-bit kernel. */
-typedef int		__kernel_pid_t32;
 typedef unsigned short	__kernel_ipc_pid_t32;
-typedef unsigned int	__kernel_uid_t32;
-typedef unsigned int	__kernel_gid_t32;
-typedef unsigned int	__kernel_dev_t32;
-typedef unsigned int	__kernel_ino_t32;
-typedef unsigned int	__kernel_mode_t32;
 typedef unsigned int	__kernel_umode_t32;
-typedef short		__kernel_nlink_t32;
 typedef int		__kernel_daddr_t32;
-typedef int		__kernel_off_t32;
 typedef unsigned int	__kernel_caddr_t32;
 typedef int		__kernel_loff_t32;
 
@@ -86,8 +78,8 @@
 
 		/* kill() */
 		struct {
-			__kernel_pid_t32 _pid;		/* sender's pid */
-			__kernel_uid_t32 _uid;		/* sender's uid */
+			compat_pid_t _pid;		/* sender's pid */
+			compat_uid_t _uid;		/* sender's uid */
 		} _kill;
 
 		/* POSIX.1b timers */
@@ -98,15 +90,15 @@
 
 		/* POSIX.1b signals */
 		struct {
-			__kernel_pid_t32 _pid;		/* sender's pid */
-			__kernel_uid_t32 _uid;		/* sender's uid */
+			compat_pid_t _pid;		/* sender's pid */
+			compat_uid_t _uid;		/* sender's uid */
 			sigval_t32 _sigval;
 		} _rt;
 
 		/* SIGCHLD */
 		struct {
-			__kernel_pid_t32 _pid;		/* which child */
-			__kernel_uid_t32 _uid;		/* sender's uid */
+			compat_pid_t _pid;		/* which child */
+			compat_uid_t _uid;		/* sender's uid */
 			int _status;			/* exit code */
 			compat_clock_t _utime;
 			compat_clock_t _stime;
@@ -162,32 +154,12 @@
 struct flock32 {
 	short l_type;
 	short l_whence;
-	__kernel_off_t32 l_start;
-	__kernel_off_t32 l_len;
-	__kernel_pid_t32 l_pid;
+	compat_off_t l_start;
+	compat_off_t l_len;
+	compat_pid_t l_pid;
 	short __unused;
 };
 
-struct stat32 {
-	__kernel_dev_t32   st_dev; /* 2 */
-	__kernel_ino_t32   st_ino; /* 4  */
-	__kernel_mode_t32  st_mode; /* 2  */
-	short   	   st_nlink; /* 2 */
-	__kernel_uid_t32   st_uid; /* 2 */
-	__kernel_gid_t32   st_gid; /* 2 */
-	__kernel_dev_t32   st_rdev; /* 2 */
-	__kernel_off_t32   st_size; /* 4 */
-	__kernel_off_t32   st_blksize; /* 4 */
-	__kernel_off_t32   st_blocks; /* 4 */
-	compat_time_t    st_atime; /* 4 */
-	unsigned int       __unused1; /* 4 */
-	compat_time_t    st_mtime; /* 4 */
-	unsigned int       __unused2; /* 4 */
-	compat_time_t    st_ctime; /* 4 */
-	unsigned int       __unused3; /* 4 */
-	unsigned int  __unused4[2]; /* 2*4 */
-};
-
 struct sigcontext32 {
 	unsigned int	_unused[4];
 	int		signal;

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - sparc64
  2002-12-13  4:34 [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent Stephen Rothwell
  2002-12-13  4:37 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - ppc64 Stephen Rothwell
@ 2002-12-13  4:39 ` Stephen Rothwell
  2002-12-13  4:43 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - x86_64 Stephen Rothwell
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-13  4:39 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel

Hi Dave,

This is the sparc64 part if the patch.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/sparc64/kernel/ioctl32.c 2.5.51-32bit.2/arch/sparc64/kernel/ioctl32.c
--- 2.5.51-32bit.1/arch/sparc64/kernel/ioctl32.c	2002-12-10 15:10:17.000000000 +1100
+++ 2.5.51-32bit.2/arch/sparc64/kernel/ioctl32.c	2002-12-13 14:44:35.000000000 +1100
@@ -2041,9 +2041,9 @@
 
 struct loop_info32 {
 	int			lo_number;      /* ioctl r/o */
-	__kernel_dev_t32	lo_device;      /* ioctl r/o */
+	compat_dev_t	lo_device;      /* ioctl r/o */
 	unsigned int		lo_inode;       /* ioctl r/o */
-	__kernel_dev_t32	lo_rdevice;     /* ioctl r/o */
+	compat_dev_t	lo_rdevice;     /* ioctl r/o */
 	int			lo_offset;
 	int			lo_encrypt_type;
 	int			lo_encrypt_key_size;    /* ioctl w/o */
@@ -2248,7 +2248,7 @@
 	set_fs(old_fs);
 
 	if (err >= 0)
-		err = put_user(kuid, (__kernel_uid_t32 *)arg);
+		err = put_user(kuid, (compat_uid_t *)arg);
 
 	return err;
 }
@@ -2835,7 +2835,7 @@
 } lv_status_byindex_req32_t;
 
 typedef struct {
-	__kernel_dev_t32 dev;
+	compat_dev_t dev;
 	u32   lv;
 } lv_status_bydev_req32_t;
 
@@ -5133,7 +5133,7 @@
 HANDLE_IOCTL(VIDIOCGFREQ32, do_video_ioctl)
 HANDLE_IOCTL(VIDIOCSFREQ32, do_video_ioctl)
 /* One SMB ioctl needs translations. */
-#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, __kernel_uid_t32)
+#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
 HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid)
 /* NCPFS */
 HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest)
diff -ruN 2.5.51-32bit.1/arch/sparc64/kernel/sys_sparc32.c 2.5.51-32bit.2/arch/sparc64/kernel/sys_sparc32.c
--- 2.5.51-32bit.1/arch/sparc64/kernel/sys_sparc32.c	2002-12-10 17:06:24.000000000 +1100
+++ 2.5.51-32bit.2/arch/sparc64/kernel/sys_sparc32.c	2002-12-13 14:44:40.000000000 +1100
@@ -289,11 +289,11 @@
 struct ipc_perm32
 {
 	key_t    	  key;
-        __kernel_uid_t32  uid;
-        __kernel_gid_t32  gid;
-        __kernel_uid_t32  cuid;
-        __kernel_gid_t32  cgid;
-        __kernel_mode_t32 mode;
+        compat_uid_t  uid;
+        compat_gid_t  gid;
+        compat_uid_t  cuid;
+        compat_gid_t  cgid;
+        compat_mode_t mode;
         unsigned short  seq;
 };
 
@@ -347,8 +347,8 @@
 	unsigned int  msg_cbytes;
 	unsigned int  msg_qnum;
 	unsigned int  msg_qbytes;
-	__kernel_pid_t32 msg_lspid;
-	__kernel_pid_t32 msg_lrpid;
+	compat_pid_t msg_lspid;
+	compat_pid_t msg_lrpid;
 	unsigned int  __unused1;
 	unsigned int  __unused2;
 };
@@ -374,8 +374,8 @@
 	unsigned int		__pad3;
 	compat_time_t  	shm_ctime;
 	compat_size_t	shm_segsz;
-	__kernel_pid_t32	shm_cpid;
-	__kernel_pid_t32	shm_lpid;
+	compat_pid_t	shm_cpid;
+	compat_pid_t	shm_lpid;
 	unsigned int		shm_nattch;
 	unsigned int		__unused1;
 	unsigned int		__unused2;
@@ -1397,10 +1397,13 @@
 	return ret;
 }
 
-static int cp_new_stat32(struct kstat *stat, struct stat32 *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
 {
 	int err;
 
+	if (stat->size > MAX_NON_LFS)
+		return -EOVERFLOW;
+
 	err  = put_user(stat->dev, &statbuf->st_dev);
 	err |= put_user(stat->ino, &statbuf->st_ino);
 	err |= put_user(stat->mode, &statbuf->st_mode);
@@ -1408,8 +1411,6 @@
 	err |= put_user(high2lowuid(stat->uid), &statbuf->st_uid);
 	err |= put_user(high2lowgid(stat->gid), &statbuf->st_gid);
 	err |= put_user(stat->rdev, &statbuf->st_rdev);
-	if (stat->size > MAX_NON_LFS)
-		return -EOVERFLOW;
 	err |= put_user(stat->size, &statbuf->st_size);
 	err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
 	err |= put_user(0, &statbuf->__unused1);
@@ -1425,39 +1426,6 @@
 	return err;
 }
 
-asmlinkage int sys32_newstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_stat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage int sys32_newlstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_lstat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage int sys32_newfstat(unsigned int fd, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_fstat(fd, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
 extern asmlinkage int sys_sysfs(int option, unsigned long arg1, unsigned long arg2);
 
 asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2)
@@ -1468,16 +1436,16 @@
 struct ncp_mount_data32_v3 {
         int version;
         unsigned int ncp_fd;
-        __kernel_uid_t32 mounted_uid;
-        __kernel_pid_t32 wdog_pid;
+        compat_uid_t mounted_uid;
+        compat_pid_t wdog_pid;
         unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
         unsigned int time_out;
         unsigned int retry_count;
         unsigned int flags;
-        __kernel_uid_t32 uid;
-        __kernel_gid_t32 gid;
-        __kernel_mode_t32 file_mode;
-        __kernel_mode_t32 dir_mode;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
 };
 
 struct ncp_mount_data32_v4 {
@@ -1548,11 +1516,11 @@
 
 struct smb_mount_data32 {
         int version;
-        __kernel_uid_t32 mounted_uid;
-        __kernel_uid_t32 uid;
-        __kernel_gid_t32 gid;
-        __kernel_mode_t32 file_mode;
-        __kernel_mode_t32 dir_mode;
+        compat_uid_t mounted_uid;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
 };
 
 static void *do_smb_super_data_conv(void *raw_data)
@@ -1712,7 +1680,7 @@
 	return err;
 }
 
-asmlinkage int sys32_wait4(__kernel_pid_t32 pid, unsigned int *stat_addr, int options, struct rusage32 *ru)
+asmlinkage int sys32_wait4(compat_pid_t pid, unsigned int *stat_addr, int options, struct rusage32 *ru)
 {
 	if (!ru)
 		return sys_wait4(pid, stat_addr, options, NULL);
@@ -1774,7 +1742,7 @@
 
 extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval);
 
-asmlinkage int sys32_sched_rr_get_interval(__kernel_pid_t32 pid, struct compat_timespec *interval)
+asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval)
 {
 	struct timespec t;
 	int ret;
@@ -3083,27 +3051,27 @@
 struct nfsctl_export32 {
 	s8			ex32_client[NFSCLNT_IDMAX+1];
 	s8			ex32_path[NFS_MAXPATHLEN+1];
-	__kernel_dev_t32	ex32_dev;
-	__kernel_ino_t32	ex32_ino;
+	compat_dev_t	ex32_dev;
+	compat_ino_t	ex32_ino;
 	s32			ex32_flags;
-	__kernel_uid_t32	ex32_anon_uid;
-	__kernel_gid_t32	ex32_anon_gid;
+	compat_uid_t	ex32_anon_uid;
+	compat_gid_t	ex32_anon_gid;
 };
 
 struct nfsctl_uidmap32 {
 	u32			ug32_ident;   /* char * */
-	__kernel_uid_t32	ug32_uidbase;
+	compat_uid_t	ug32_uidbase;
 	s32			ug32_uidlen;
 	u32			ug32_udimap;  /* uid_t * */
-	__kernel_uid_t32	ug32_gidbase;
+	compat_uid_t	ug32_gidbase;
 	s32			ug32_gidlen;
 	u32			ug32_gdimap;  /* gid_t * */
 };
 
 struct nfsctl_fhparm32 {
 	struct sockaddr		gf32_addr;
-	__kernel_dev_t32	gf32_dev;
-	__kernel_ino_t32	gf32_ino;
+	compat_dev_t	gf32_dev;
+	compat_ino_t	gf32_ino;
 	s32			gf32_version;
 };
 
@@ -3232,7 +3200,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_udimap[i],
-			      &(((__kernel_uid_t32 *)A(uaddr))[i]));
+			      &(((compat_uid_t *)A(uaddr))[i]));
 	err |= __get_user(karg->ca_umap.ug_gidbase,
 		      &arg32->ca32_umap.ug32_gidbase);
 	err |= __get_user(karg->ca_umap.ug_uidlen,
@@ -3246,7 +3214,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_gdimap[i],
-			      &(((__kernel_gid_t32 *)A(uaddr))[i]));
+			      &(((compat_gid_t *)A(uaddr))[i]));
 
 	return (err ? -EFAULT : 0);
 }
@@ -3540,7 +3508,7 @@
 
 extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
 
-asmlinkage int sys32_sendfile(int out_fd, int in_fd, __kernel_off_t32 *offset, s32 count)
+asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -3795,7 +3763,7 @@
 extern asmlinkage int sys_sched_setaffinity(pid_t pid, unsigned int len,
 					    unsigned long *user_mask_ptr);
 
-asmlinkage int sys32_sched_setaffinity(__kernel_pid_t32 pid, unsigned int len,
+asmlinkage int sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
 				       u32 *user_mask_ptr)
 {
 	unsigned long kernel_mask;
@@ -3819,7 +3787,7 @@
 extern asmlinkage int sys_sched_getaffinity(pid_t pid, unsigned int len,
 					    unsigned long *user_mask_ptr);
 
-asmlinkage int sys32_sched_getaffinity(__kernel_pid_t32 pid, unsigned int len,
+asmlinkage int sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
 				       u32 *user_mask_ptr)
 {
 	unsigned long kernel_mask;
diff -ruN 2.5.51-32bit.1/arch/sparc64/kernel/sys_sunos32.c 2.5.51-32bit.2/arch/sparc64/kernel/sys_sunos32.c
--- 2.5.51-32bit.1/arch/sparc64/kernel/sys_sunos32.c	2002-12-10 15:10:17.000000000 +1100
+++ 2.5.51-32bit.2/arch/sparc64/kernel/sys_sunos32.c	2002-12-12 13:53:26.000000000 +1100
@@ -798,14 +798,14 @@
 }
 
 /* So stupid... */
-extern asmlinkage int sys32_wait4(__kernel_pid_t32 pid,
+extern asmlinkage int sys32_wait4(compat_pid_t pid,
 				  u32 stat_addr, int options, u32 ru);
 
-asmlinkage int sunos_wait4(__kernel_pid_t32 pid, u32 stat_addr, int options, u32 ru)
+asmlinkage int sunos_wait4(compat_pid_t pid, u32 stat_addr, int options, u32 ru)
 {
 	int ret;
 
-	ret = sys32_wait4((pid ? pid : ((__kernel_pid_t32)-1)),
+	ret = sys32_wait4((pid ? pid : ((compat_pid_t)-1)),
 			  stat_addr, options, ru);
 	return ret;
 }
@@ -931,11 +931,11 @@
 struct ipc_perm32
 {
 	key_t    	  key;
-        __kernel_uid_t32  uid;
-        __kernel_gid_t32  gid;
-        __kernel_uid_t32  cuid;
-        __kernel_gid_t32  cgid;
-        __kernel_mode_t32 mode;
+        compat_uid_t  uid;
+        compat_gid_t  gid;
+        compat_uid_t  cuid;
+        compat_gid_t  cgid;
+        compat_mode_t mode;
         unsigned short  seq;
 };
 
diff -ruN 2.5.51-32bit.1/arch/sparc64/kernel/systbls.S 2.5.51-32bit.2/arch/sparc64/kernel/systbls.S
--- 2.5.51-32bit.1/arch/sparc64/kernel/systbls.S	2002-12-10 17:06:07.000000000 +1100
+++ 2.5.51-32bit.2/arch/sparc64/kernel/systbls.S	2002-12-13 14:56:51.000000000 +1100
@@ -26,12 +26,12 @@
 /*20*/	.word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16
 /*25*/	.word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause
 /*30*/	.word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
-	.word sys_chown, sys_sync, sys_kill, sys32_newstat, sys32_sendfile
-/*40*/	.word sys32_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid
+	.word sys_chown, sys_sync, sys_kill, compat_sys_newstat, sys32_sendfile
+/*40*/	.word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid
 	.word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16
 /*50*/	.word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys32_ioctl
 	.word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve
-/*60*/	.word sys_umask, sys_chroot, sys32_newfstat, sys_fstat64, sys_getpagesize
+/*60*/	.word sys_umask, sys_chroot, compat_sys_newfstat, sys_fstat64, sys_getpagesize
 	.word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
 /*70*/	.word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect
 	.word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16
@@ -150,8 +150,8 @@
 	.word sunos_nosys, sunos_nosys, sunos_nosys
 	.word sunos_nosys, sunos_nosys, sunos_nosys
 	.word sys_access, sunos_nosys, sunos_nosys
-	.word sys_sync, sys_kill, sys32_newstat
-	.word sunos_nosys, sys32_newlstat, sys_dup
+	.word sys_sync, sys_kill, compat_sys_newstat
+	.word sunos_nosys, compat_sys_newlstat, sys_dup
 	.word sys_pipe, sunos_nosys, sunos_nosys
 	.word sunos_nosys, sunos_nosys, sunos_getgid
 	.word sunos_nosys, sunos_nosys
@@ -159,7 +159,7 @@
 	.word sunos_mctl, sunos_ioctl, sys_reboot
 	.word sunos_nosys, sys_symlink, sys_readlink
 	.word sys32_execve, sys_umask, sys_chroot
-	.word sys32_newfstat, sunos_nosys, sys_getpagesize
+	.word compat_sys_newfstat, sunos_nosys, sys_getpagesize
 	.word sys_msync, sys_vfork, sunos_nosys
 	.word sunos_nosys, sunos_sbrk, sunos_sstk
 	.word sunos_mmap, sunos_vadvise, sys_munmap
diff -ruN 2.5.51-32bit.1/include/asm-sparc64/compat.h 2.5.51-32bit.2/include/asm-sparc64/compat.h
--- 2.5.51-32bit.1/include/asm-sparc64/compat.h	2002-12-10 16:38:22.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-sparc64/compat.h	2002-12-12 16:17:41.000000000 +1100
@@ -11,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u16		compat_uid_t;
+typedef u16		compat_gid_t;
+typedef u16		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u16		compat_dev_t;
+typedef s32		compat_off_t;
+typedef s16		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -22,4 +30,24 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	compat_off_t	st_size;
+	compat_time_t	st_atime;
+	u32		__unused1;
+	compat_time_t	st_mtime;
+	u32		__unused2;
+	compat_time_t	st_ctime;
+	u32		__unused3;
+	compat_off_t	st_blksize;
+	compat_off_t	st_blocks;
+	u32		__unused4[2];
+};
+
 #endif /* _ASM_SPARC64_COMPAT_H */
diff -ruN 2.5.51-32bit.1/include/asm-sparc64/fcntl.h 2.5.51-32bit.2/include/asm-sparc64/fcntl.h
--- 2.5.51-32bit.1/include/asm-sparc64/fcntl.h	2001-09-21 07:11:58.000000000 +1000
+++ 2.5.51-32bit.2/include/asm-sparc64/fcntl.h	2002-12-12 14:48:45.000000000 +1100
@@ -79,12 +79,14 @@
 };
 
 #ifdef __KERNEL__
+#include <linux/compat.h>
+
 struct flock32 {
 	short l_type;
 	short l_whence;
-	__kernel_off_t32 l_start;
-	__kernel_off_t32 l_len;
-	__kernel_pid_t32 l_pid;
+	compat_off_t l_start;
+	compat_off_t l_len;
+	compat_pid_t l_pid;
 	short __unused;
 };
 #endif
diff -ruN 2.5.51-32bit.1/include/asm-sparc64/posix_types.h 2.5.51-32bit.2/include/asm-sparc64/posix_types.h
--- 2.5.51-32bit.1/include/asm-sparc64/posix_types.h	2002-12-10 15:42:57.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-sparc64/posix_types.h	2002-12-12 16:15:40.000000000 +1100
@@ -48,17 +48,9 @@
 } __kernel_fsid_t;
 
 /* Now 32bit compatibility types */
-typedef int                    __kernel_pid_t32;
 typedef unsigned short         __kernel_ipc_pid_t32;
-typedef unsigned short         __kernel_uid_t32;
-typedef unsigned short         __kernel_gid_t32;
-typedef unsigned short         __kernel_dev_t32;
-typedef unsigned int           __kernel_ino_t32;
-typedef unsigned short         __kernel_mode_t32;
 typedef unsigned short         __kernel_umode_t32;
-typedef short                  __kernel_nlink_t32;
 typedef int                    __kernel_daddr_t32;
-typedef int                    __kernel_off_t32;
 typedef unsigned int           __kernel_caddr_t32;
 typedef long		       __kernel_loff_t32;
 typedef __kernel_fsid_t        __kernel_fsid_t32;
diff -ruN 2.5.51-32bit.1/include/asm-sparc64/siginfo.h 2.5.51-32bit.2/include/asm-sparc64/siginfo.h
--- 2.5.51-32bit.1/include/asm-sparc64/siginfo.h	2002-12-10 15:43:53.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-sparc64/siginfo.h	2002-12-12 11:28:48.000000000 +1100
@@ -30,7 +30,7 @@
 
 		/* kill() */
 		struct {
-			__kernel_pid_t32 _pid;		/* sender's pid */
+			compat_pid_t _pid;		/* sender's pid */
 			unsigned int _uid;		/* sender's uid */
 		} _kill;
 
@@ -42,14 +42,14 @@
 
 		/* POSIX.1b signals */
 		struct {
-			__kernel_pid_t32 _pid;		/* sender's pid */
+			compat_pid_t _pid;		/* sender's pid */
 			unsigned int _uid;		/* sender's uid */
 			sigval_t32 _sigval;
 		} _rt;
 
 		/* SIGCHLD */
 		struct {
-			__kernel_pid_t32 _pid;		/* which child */
+			compat_pid_t _pid;		/* which child */
 			unsigned int _uid;		/* sender's uid */
 			int _status;			/* exit code */
 			compat_clock_t _utime;
diff -ruN 2.5.51-32bit.1/include/asm-sparc64/stat.h 2.5.51-32bit.2/include/asm-sparc64/stat.h
--- 2.5.51-32bit.1/include/asm-sparc64/stat.h	2002-12-10 15:10:40.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-sparc64/stat.h	2002-12-12 15:22:10.000000000 +1100
@@ -3,29 +3,8 @@
 #define _SPARC64_STAT_H
 
 #include <linux/types.h>
-#include <linux/compat.h>
 #include <linux/time.h>
 
-struct stat32 {
-	__kernel_dev_t32   st_dev;
-	__kernel_ino_t32   st_ino;
-	__kernel_mode_t32  st_mode;
-	short   	   st_nlink;
-	__kernel_uid_t32   st_uid;
-	__kernel_gid_t32   st_gid;
-	__kernel_dev_t32   st_rdev;
-	__kernel_off_t32   st_size;
-	compat_time_t    st_atime;
-	unsigned int       __unused1;
-	compat_time_t    st_mtime;
-	unsigned int       __unused2;
-	compat_time_t    st_ctime;
-	unsigned int       __unused3;
-	__kernel_off_t32   st_blksize;
-	__kernel_off_t32   st_blocks;
-	unsigned int  __unused4[2];
-};
-
 struct stat {
 	dev_t   st_dev;
 	ino_t   st_ino;

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - x86_64
  2002-12-13  4:34 [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent Stephen Rothwell
  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 ` Stephen Rothwell
  2002-12-13  4:44 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - ia64 Stephen Rothwell
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-13  4:43 UTC (permalink / raw)
  To: ak; +Cc: linux-kernel

Hi Andi,

Here is the x86_64 part of the patch.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/x86_64/ia32/ia32_ioctl.c 2.5.51-32bit.2/arch/x86_64/ia32/ia32_ioctl.c
--- 2.5.51-32bit.1/arch/x86_64/ia32/ia32_ioctl.c	2002-12-10 15:26:49.000000000 +1100
+++ 2.5.51-32bit.2/arch/x86_64/ia32/ia32_ioctl.c	2002-12-13 14:44:57.000000000 +1100
@@ -1909,9 +1909,9 @@
 
 struct loop_info32 {
 	int			lo_number;      /* ioctl r/o */
-	__kernel_dev_t32	lo_device;      /* ioctl r/o */
+	compat_dev_t	lo_device;      /* ioctl r/o */
 	unsigned int		lo_inode;       /* ioctl r/o */
-	__kernel_dev_t32	lo_rdevice;     /* ioctl r/o */
+	compat_dev_t	lo_rdevice;     /* ioctl r/o */
 	int			lo_offset;
 	int			lo_encrypt_type;
 	int			lo_encrypt_key_size;    /* ioctl w/o */
@@ -2116,7 +2116,7 @@
 	set_fs(old_fs);
 
 	if (err >= 0)
-		err = put_user(kuid, (__kernel_uid_t32 *)arg);
+		err = put_user(kuid, (compat_pid_t *)arg);
 
 	return err;
 }
@@ -3487,7 +3487,7 @@
 
 struct dirent32 {
 	unsigned int		d_ino;
-	__kernel_off_t32	d_off;
+	compat_off_t	d_off;
 	unsigned short	d_reclen;
 	char		d_name[256]; /* We must not include limits.h! */
 };
@@ -4937,7 +4937,7 @@
 HANDLE_IOCTL(VIDIOCGFREQ32, do_video_ioctl)
 HANDLE_IOCTL(VIDIOCSFREQ32, do_video_ioctl)
 /* One SMB ioctl needs translations. */
-#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, __kernel_uid_t32)
+#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_pid_t)
 HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid)
 HANDLE_IOCTL(ATM_GETLINKRATE32, do_atm_ioctl)
 HANDLE_IOCTL(ATM_GETNAMES32, do_atm_ioctl)
diff -ruN 2.5.51-32bit.1/arch/x86_64/ia32/ia32entry.S 2.5.51-32bit.2/arch/x86_64/ia32/ia32entry.S
--- 2.5.51-32bit.1/arch/x86_64/ia32/ia32entry.S	2002-12-10 17:07:24.000000000 +1100
+++ 2.5.51-32bit.2/arch/x86_64/ia32/ia32entry.S	2002-12-13 14:57:15.000000000 +1100
@@ -227,9 +227,9 @@
 	.quad sys_syslog
 	.quad compat_sys_setitimer
 	.quad compat_sys_getitimer	/* 105 */
-	.quad sys32_newstat
-	.quad sys32_newlstat
-	.quad sys32_newfstat
+	.quad compat_sys_newstat
+	.quad compat_sys_newlstat
+	.quad compat_sys_newfstat
 	.quad sys32_uname
 	.quad stub32_iopl		/* 110 */
 	.quad sys_vhangup
diff -ruN 2.5.51-32bit.1/arch/x86_64/ia32/ipc32.c 2.5.51-32bit.2/arch/x86_64/ia32/ipc32.c
--- 2.5.51-32bit.1/arch/x86_64/ia32/ipc32.c	2002-12-10 15:26:49.000000000 +1100
+++ 2.5.51-32bit.2/arch/x86_64/ia32/ipc32.c	2002-12-12 13:43:57.000000000 +1100
@@ -30,10 +30,10 @@
 
 struct ipc_perm32 {
 	int key;
-	__kernel_uid_t32 uid;
-	__kernel_gid_t32 gid;
-	__kernel_uid_t32 cuid;
-	__kernel_gid_t32 cgid;
+	compat_uid_t uid;
+	compat_gid_t gid;
+	compat_uid_t cuid;
+	compat_gid_t cgid;
 	unsigned short mode;
 	unsigned short seq;
 };
@@ -101,8 +101,8 @@
 	unsigned int msg_cbytes;
 	unsigned int msg_qnum;
 	unsigned int msg_qbytes;
-	__kernel_pid_t32 msg_lspid;
-	__kernel_pid_t32 msg_lrpid;
+	compat_pid_t msg_lspid;
+	compat_pid_t msg_lrpid;
 	unsigned int __unused4;
 	unsigned int __unused5;
 };
@@ -127,8 +127,8 @@
 	unsigned int __unused2;
 	compat_time_t shm_ctime;
 	unsigned int __unused3;
-	__kernel_pid_t32 shm_cpid;
-	__kernel_pid_t32 shm_lpid;
+	compat_pid_t shm_cpid;
+	compat_pid_t shm_lpid;
 	unsigned int shm_nattch;
 	unsigned int __unused4;
 	unsigned int __unused5;
diff -ruN 2.5.51-32bit.1/arch/x86_64/ia32/sys_ia32.c 2.5.51-32bit.2/arch/x86_64/ia32/sys_ia32.c
--- 2.5.51-32bit.1/arch/x86_64/ia32/sys_ia32.c	2002-12-10 17:07:52.000000000 +1100
+++ 2.5.51-32bit.2/arch/x86_64/ia32/sys_ia32.c	2002-12-13 14:45:03.000000000 +1100
@@ -86,10 +86,9 @@
 extern int overflowuid,overflowgid; 
 
 
-static int
-putstat(struct stat32 *ubuf, struct stat *kbuf)
+int cp_compat_stat(struct kstat *kbuf, struct compat_stat *ubuf)
 {
-	if (verify_area(VERIFY_WRITE, ubuf, sizeof(struct stat32)) ||
+	if (verify_area(VERIFY_WRITE, ubuf, sizeof(struct compat_stat)) ||
 	    __put_user (kbuf->st_dev, &ubuf->st_dev) ||
 	    __put_user (kbuf->st_ino, &ubuf->st_ino) ||
 	    __put_user (kbuf->st_mode, &ubuf->st_mode) ||
@@ -107,57 +106,6 @@
 	return 0;
 }
 
-extern asmlinkage long sys_newstat(char * filename, struct stat * statbuf);
-
-asmlinkage long
-sys32_newstat(char * filename, struct stat32 *statbuf)
-{
-	int ret;
-	struct stat s;
-	mm_segment_t old_fs = get_fs();
-	
-	set_fs (KERNEL_DS);
-	ret = sys_newstat(filename, &s);
-	set_fs (old_fs);
-	if (putstat (statbuf, &s))
-		return -EFAULT;
-	return ret;
-}
-
-extern asmlinkage long sys_newlstat(char * filename, struct stat * statbuf);
-
-asmlinkage long
-sys32_newlstat(char * filename, struct stat32 *statbuf)
-{
-	int ret;
-	struct stat s;
-	mm_segment_t old_fs = get_fs();
-	
-	set_fs (KERNEL_DS);
-	ret = sys_newlstat(filename, &s);
-	set_fs (old_fs);
-	if (putstat (statbuf, &s))
-		return -EFAULT;
-	return ret;
-}
-
-extern asmlinkage long sys_newfstat(unsigned int fd, struct stat * statbuf);
-
-asmlinkage long
-sys32_newfstat(unsigned int fd, struct stat32 *statbuf)
-{
-	int ret;
-	struct stat s;
-	mm_segment_t old_fs = get_fs();
-	
-	set_fs (KERNEL_DS);
-	ret = sys_newfstat(fd, &s);
-	set_fs (old_fs);
-	if (putstat (statbuf, &s))
-		return -EFAULT;
-	return ret;
-}
-
 /* Another set for IA32/LFS -- x86_64 struct stat is different due to 
    support for 64bit inode numbers. */
 
@@ -1062,7 +1010,7 @@
 				int options, struct rusage * ru);
 
 asmlinkage long
-sys32_wait4(__kernel_pid_t32 pid, unsigned int *stat_addr, int options,
+sys32_wait4(compat_pid_t pid, unsigned int *stat_addr, int options,
 	    struct rusage32 *ru)
 {
 	if (!ru)
@@ -1084,7 +1032,7 @@
 }
 
 asmlinkage long
-sys32_waitpid(__kernel_pid_t32 pid, unsigned int *stat_addr, int options)
+sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options)
 {
 	return sys32_wait4(pid, stat_addr, options, NULL);
 }
@@ -1326,7 +1274,7 @@
 						struct timespec *interval);
 
 asmlinkage long
-sys32_sched_rr_get_interval(__kernel_pid_t32 pid, struct compat_timespec *interval)
+sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval)
 {
 	struct timespec t;
 	int ret;
@@ -1686,7 +1634,7 @@
 				       size_t count); 
 
 asmlinkage long
-sys32_sendfile(int out_fd, int in_fd, __kernel_off_t32 *offset, s32 count)
+sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -2030,27 +1978,27 @@
 struct nfsctl_export32 {
 	s8			ex32_client[NFSCLNT_IDMAX+1];
 	s8			ex32_path[NFS_MAXPATHLEN+1];
-	__kernel_dev_t32	ex32_dev;
-	__kernel_ino_t32	ex32_ino;
+	compat_dev_t	ex32_dev;
+	compat_ino_t	ex32_ino;
 	s32			ex32_flags;
-	__kernel_uid_t32	ex32_anon_uid;
-	__kernel_gid_t32	ex32_anon_gid;
+	compat_pid_t	ex32_anon_uid;
+	compat_gid_t	ex32_anon_gid;
 };
 
 struct nfsctl_uidmap32 {
 	u32			ug32_ident;   /* char * */
-	__kernel_uid_t32	ug32_uidbase;
+	compat_pid_t	ug32_uidbase;
 	s32			ug32_uidlen;
 	u32			ug32_udimap;  /* uid_t * */
-	__kernel_uid_t32	ug32_gidbase;
+	compat_pid_t	ug32_gidbase;
 	s32			ug32_gidlen;
 	u32			ug32_gdimap;  /* gid_t * */
 };
 
 struct nfsctl_fhparm32 {
 	struct sockaddr		gf32_addr;
-	__kernel_dev_t32	gf32_dev;
-	__kernel_ino_t32	gf32_ino;
+	compat_dev_t	gf32_dev;
+	compat_ino_t	gf32_ino;
 	s32			gf32_version;
 };
 
@@ -2179,7 +2127,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_udimap[i],
-			      &(((__kernel_uid_t32 *)A(uaddr))[i]));
+			      &(((compat_pid_t *)A(uaddr))[i]));
 	err |= __get_user(karg->ca_umap.ug_gidbase,
 		      &arg32->ca32_umap.ug32_gidbase);
 	err |= __get_user(karg->ca_umap.ug_uidlen,
@@ -2193,7 +2141,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_gdimap[i],
-			      &(((__kernel_gid_t32 *)A(uaddr))[i]));
+			      &(((compat_gid_t *)A(uaddr))[i]));
 
 	return err;
 }
diff -ruN 2.5.51-32bit.1/include/asm-x86_64/compat.h 2.5.51-32bit.2/include/asm-x86_64/compat.h
--- 2.5.51-32bit.1/include/asm-x86_64/compat.h	2002-12-10 16:38:26.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-x86_64/compat.h	2002-12-12 16:52:38.000000000 +1100
@@ -11,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u16		compat_uid_t;
+typedef u16		compat_gid_t;
+typedef u16		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u16		compat_dev_t;
+typedef s32		compat_off_t;
+typedef u16		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -22,4 +30,27 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;
+	u16		__pad1;
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	u16		__pad2;
+	u32		st_size;
+	u32		st_blksize;
+	u32		st_blocks;
+	u32		st_atime;
+	u32		__unused1;
+	u32		st_mtime;
+	u32		__unused2;
+	u32		st_ctime;
+	u32		__unused3;
+	u32		__unused4;
+	u32		__unused5;
+};
+
 #endif /* _ASM_X86_64_COMPAT_H */
diff -ruN 2.5.51-32bit.1/include/asm-x86_64/ia32.h 2.5.51-32bit.2/include/asm-x86_64/ia32.h
--- 2.5.51-32bit.1/include/asm-x86_64/ia32.h	2002-12-10 15:44:49.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-x86_64/ia32.h	2002-12-12 16:51:29.000000000 +1100
@@ -5,26 +5,18 @@
 
 #ifdef CONFIG_IA32_EMULATION
 
-#include <compat.h>
+#include <linux/compat.h>
 
 /*
  * 32 bit structures for IA32 support.
  */
 
 /* 32bit compatibility types */
-typedef int		       __kernel_pid_t32;
 typedef unsigned short	       __kernel_ipc_pid_t32;
-typedef unsigned short	       __kernel_uid_t32;
 typedef unsigned 				__kernel_uid32_t32;
-typedef unsigned short	       __kernel_gid_t32;
 typedef unsigned 				__kernel_gid32_t32;
-typedef unsigned short	       __kernel_dev_t32;
-typedef unsigned int	       __kernel_ino_t32;
-typedef unsigned short	       __kernel_mode_t32;
 typedef unsigned short	       __kernel_umode_t32;
-typedef short		       __kernel_nlink_t32;
 typedef int		       __kernel_daddr_t32;
-typedef int		       __kernel_off_t32;
 typedef unsigned int	       __kernel_caddr_t32;
 typedef long		       __kernel_loff_t32;
 typedef __kernel_fsid_t	       __kernel_fsid_t32;
@@ -34,9 +26,9 @@
 struct flock32 {
        short l_type;
        short l_whence;
-       __kernel_off_t32 l_start;
-       __kernel_off_t32 l_len;
-       __kernel_pid_t32 l_pid;
+       compat_off_t l_start;
+       compat_off_t l_len;
+       compat_pid_t l_pid;
 };
 
 
@@ -95,30 +87,6 @@
 	sigset32_t	  uc_sigmask;	/* mask last for extensibility */
 };
 
-struct stat32 {
-       unsigned short st_dev;
-       unsigned short __pad1;
-       unsigned int st_ino;
-       unsigned short st_mode;
-       unsigned short st_nlink;
-       unsigned short st_uid;
-       unsigned short st_gid;
-       unsigned short st_rdev;
-       unsigned short __pad2;
-       unsigned int  st_size;
-       unsigned int  st_blksize;
-       unsigned int  st_blocks;
-       unsigned int  st_atime;
-       unsigned int  __unused1;
-       unsigned int  st_mtime;
-       unsigned int  __unused2;
-       unsigned int  st_ctime;
-       unsigned int  __unused3;
-       unsigned int  __unused4;
-       unsigned int  __unused5;
-};
-
-
 /* This matches struct stat64 in glibc2.2, hence the absolutely
  * insane amounts of padding around dev_t's.
  */
@@ -221,7 +189,7 @@
 
 struct ustat32 {
 	__u32	f_tfree;
-	__kernel_ino_t32		f_tinode;
+	compat_ino_t		f_tinode;
 	char			f_fname[6];
 	char			f_fpack[6];
 };

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - ia64
  2002-12-13  4:34 [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent Stephen Rothwell
                   ` (2 preceding siblings ...)
  2002-12-13  4:43 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - x86_64 Stephen Rothwell
@ 2002-12-13  4:44 ` Stephen Rothwell
  2002-12-13  4:46 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - s390x Stephen Rothwell
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-13  4:44 UTC (permalink / raw)
  To: davidm; +Cc: linux-kernel

Hi David,

This is the ia64 part of the patch.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/ia64/ia32/ia32_entry.S 2.5.51-32bit.2/arch/ia64/ia32/ia32_entry.S
--- 2.5.51-32bit.1/arch/ia64/ia32/ia32_entry.S	2002-12-10 17:00:17.000000000 +1100
+++ 2.5.51-32bit.2/arch/ia64/ia32/ia32_entry.S	2002-12-13 14:54:13.000000000 +1100
@@ -297,9 +297,9 @@
 	data8 sys_syslog
 	data8 compat_sys_setitimer
 	data8 compat_sys_getitimer	  /* 105 */
-	data8 sys32_newstat
-	data8 sys32_newlstat
-	data8 sys32_newfstat
+	data8 compat_sys_newstat
+	data8 compat_sys_newlstat
+	data8 compat_sys_newfstat
 	data8 sys32_ni_syscall
 	data8 sys32_iopl		  /* 110 */
 	data8 sys_vhangup
diff -ruN 2.5.51-32bit.1/arch/ia64/ia32/sys_ia32.c 2.5.51-32bit.2/arch/ia64/ia32/sys_ia32.c
--- 2.5.51-32bit.1/arch/ia64/ia32/sys_ia32.c	2002-12-10 16:58:43.000000000 +1100
+++ 2.5.51-32bit.2/arch/ia64/ia32/sys_ia32.c	2002-12-12 17:22:58.000000000 +1100
@@ -175,8 +175,7 @@
 	return r;
 }
 
-static inline int
-putstat (struct stat32 *ubuf, struct kstat *stat)
+int cp_compat_stat(struct kstat *stat, struct compat_stat *ubuf)
 {
 	int err;
 
@@ -202,42 +201,6 @@
 	return err;
 }
 
-asmlinkage long
-sys32_newstat (char *filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int ret = vfs_stat(filename, &stat);
-
-	if (!ret)
-		ret = putstat(statbuf, &stat);
-
-	return ret;
-}
-
-asmlinkage long
-sys32_newlstat (char *filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int ret = vfs_lstat(filename, &stat);
-
-	if (!ret)
-		ret = putstat(statbuf, &stat);
-
-	return ret;
-}
-
-asmlinkage long
-sys32_newfstat (unsigned int fd, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int ret = vfs_fstat(fd, &stat);
-
-	if (!ret)
-		ret = putstat(statbuf, &stat);
-
-	return ret;
-}
-
 #if PAGE_SHIFT > IA32_PAGE_SHIFT
 
 
@@ -1872,11 +1835,11 @@
 
 struct ipc_perm32 {
 	key_t key;
-	__kernel_uid_t32 uid;
-	__kernel_gid_t32 gid;
-	__kernel_uid_t32 cuid;
-	__kernel_gid_t32 cgid;
-	__kernel_mode_t32 mode;
+	compat_uid_t uid;
+	compat_gid_t gid;
+	compat_uid_t cuid;
+	compat_gid_t cgid;
+	compat_mode_t mode;
 	unsigned short seq;
 };
 
@@ -1886,7 +1849,7 @@
 	__kernel_gid32_t32 gid;
 	__kernel_uid32_t32 cuid;
 	__kernel_gid32_t32 cgid;
-	__kernel_mode_t32 mode;
+	compat_mode_t mode;
 	unsigned short __pad1;
 	unsigned short seq;
 	unsigned short __pad2;
@@ -1943,8 +1906,8 @@
 	unsigned int msg_cbytes;
 	unsigned int msg_qnum;
 	unsigned int msg_qbytes;
-	__kernel_pid_t32 msg_lspid;
-	__kernel_pid_t32 msg_lrpid;
+	compat_pid_t msg_lspid;
+	compat_pid_t msg_lrpid;
 	unsigned int __unused4;
 	unsigned int __unused5;
 };
@@ -1969,8 +1932,8 @@
 	unsigned int __unused2;
 	compat_time_t   shm_ctime;
 	unsigned int __unused3;
-	__kernel_pid_t32 shm_cpid;
-	__kernel_pid_t32 shm_lpid;
+	compat_pid_t shm_cpid;
+	compat_pid_t shm_lpid;
 	unsigned int shm_nattch;
 	unsigned int __unused4;
 	unsigned int __unused5;
@@ -3552,16 +3515,16 @@
 struct ncp_mount_data32 {
 	int version;
 	unsigned int ncp_fd;
-	__kernel_uid_t32 mounted_uid;
+	compat_uid_t mounted_uid;
 	int wdog_pid;
 	unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
 	unsigned int time_out;
 	unsigned int retry_count;
 	unsigned int flags;
-	__kernel_uid_t32 uid;
-	__kernel_gid_t32 gid;
-	__kernel_mode_t32 file_mode;
-	__kernel_mode_t32 dir_mode;
+	compat_uid_t uid;
+	compat_gid_t gid;
+	compat_mode_t file_mode;
+	compat_mode_t dir_mode;
 };
 
 static void *
@@ -3583,11 +3546,11 @@
 
 struct smb_mount_data32 {
 	int version;
-	__kernel_uid_t32 mounted_uid;
-	__kernel_uid_t32 uid;
-	__kernel_gid_t32 gid;
-	__kernel_mode_t32 file_mode;
-	__kernel_mode_t32 dir_mode;
+	compat_uid_t mounted_uid;
+	compat_uid_t uid;
+	compat_gid_t gid;
+	compat_mode_t file_mode;
+	compat_mode_t dir_mode;
 };
 
 static void *
@@ -3705,52 +3668,52 @@
 
 extern asmlinkage long sys_setreuid(uid_t ruid, uid_t euid);
 
-asmlinkage long sys32_setreuid(__kernel_uid_t32 ruid, __kernel_uid_t32 euid)
+asmlinkage long sys32_setreuid(compat_uid_t ruid, compat_uid_t euid)
 {
 	uid_t sruid, seuid;
 
-	sruid = (ruid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)ruid);
-	seuid = (euid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)euid);
+	sruid = (ruid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)ruid);
+	seuid = (euid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)euid);
 	return sys_setreuid(sruid, seuid);
 }
 
 extern asmlinkage long sys_setresuid(uid_t ruid, uid_t euid, uid_t suid);
 
 asmlinkage long
-sys32_setresuid(__kernel_uid_t32 ruid, __kernel_uid_t32 euid,
-		__kernel_uid_t32 suid)
+sys32_setresuid(compat_uid_t ruid, compat_uid_t euid,
+		compat_uid_t suid)
 {
 	uid_t sruid, seuid, ssuid;
 
-	sruid = (ruid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)ruid);
-	seuid = (euid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)euid);
-	ssuid = (suid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)suid);
+	sruid = (ruid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)ruid);
+	seuid = (euid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)euid);
+	ssuid = (suid == (compat_uid_t)-1) ? ((uid_t)-1) : ((uid_t)suid);
 	return sys_setresuid(sruid, seuid, ssuid);
 }
 
 extern asmlinkage long sys_setregid(gid_t rgid, gid_t egid);
 
 asmlinkage long
-sys32_setregid(__kernel_gid_t32 rgid, __kernel_gid_t32 egid)
+sys32_setregid(compat_gid_t rgid, compat_gid_t egid)
 {
 	gid_t srgid, segid;
 
-	srgid = (rgid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)rgid);
-	segid = (egid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)egid);
+	srgid = (rgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)rgid);
+	segid = (egid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)egid);
 	return sys_setregid(srgid, segid);
 }
 
 extern asmlinkage long sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid);
 
 asmlinkage long
-sys32_setresgid(__kernel_gid_t32 rgid, __kernel_gid_t32 egid,
-		__kernel_gid_t32 sgid)
+sys32_setresgid(compat_gid_t rgid, compat_gid_t egid,
+		compat_gid_t sgid)
 {
 	gid_t srgid, segid, ssgid;
 
-	srgid = (rgid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)rgid);
-	segid = (egid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)egid);
-	ssgid = (sgid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)sgid);
+	srgid = (rgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)rgid);
+	segid = (egid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)egid);
+	ssgid = (sgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)sgid);
 	return sys_setresgid(srgid, segid, ssgid);
 }
 
@@ -3772,27 +3735,27 @@
 struct nfsctl_export32 {
 	s8			ex32_client[NFSCLNT_IDMAX+1];
 	s8			ex32_path[NFS_MAXPATHLEN+1];
-	__kernel_dev_t32	ex32_dev;
-	__kernel_ino_t32	ex32_ino;
+	compat_dev_t	ex32_dev;
+	compat_ino_t	ex32_ino;
 	s32			ex32_flags;
-	__kernel_uid_t32	ex32_anon_uid;
-	__kernel_gid_t32	ex32_anon_gid;
+	compat_uid_t	ex32_anon_uid;
+	compat_gid_t	ex32_anon_gid;
 };
 
 struct nfsctl_uidmap32 {
 	u32			ug32_ident;   /* char * */
-	__kernel_uid_t32	ug32_uidbase;
+	compat_uid_t	ug32_uidbase;
 	s32			ug32_uidlen;
 	u32			ug32_udimap;  /* uid_t * */
-	__kernel_uid_t32	ug32_gidbase;
+	compat_uid_t	ug32_gidbase;
 	s32			ug32_gidlen;
 	u32			ug32_gdimap;  /* gid_t * */
 };
 
 struct nfsctl_fhparm32 {
 	struct sockaddr		gf32_addr;
-	__kernel_dev_t32	gf32_dev;
-	__kernel_ino_t32	gf32_ino;
+	compat_dev_t	gf32_dev;
+	compat_ino_t	gf32_ino;
 	s32			gf32_version;
 };
 
@@ -3912,7 +3875,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_udimap[i],
-			      &(((__kernel_uid_t32 *)A(uaddr))[i]));
+			      &(((compat_uid_t *)A(uaddr))[i]));
 	err |= __get_user(karg->ca_umap.ug_gidbase,
 		      &arg32->ca32_umap.ug32_gidbase);
 	err |= __get_user(karg->ca_umap.ug_uidlen,
@@ -3927,7 +3890,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_gdimap[i],
-			      &(((__kernel_gid_t32 *)A(uaddr))[i]));
+			      &(((compat_gid_t *)A(uaddr))[i]));
 
 	return err;
 }
diff -ruN 2.5.51-32bit.1/include/asm-ia64/compat.h 2.5.51-32bit.2/include/asm-ia64/compat.h
--- 2.5.51-32bit.1/include/asm-ia64/compat.h	2002-12-10 16:37:41.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-ia64/compat.h	2002-12-12 16:59:16.000000000 +1100
@@ -3,7 +3,6 @@
 /*
  * Architecture specific compatibility types
  */
-
 #include <linux/types.h>
 
 #define COMPAT_USER_HZ	100
@@ -12,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u16		compat_uid_t;
+typedef u16		compat_gid_t;
+typedef u16		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u16		compat_dev_t;
+typedef s32		compat_off_t;
+typedef u16		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -23,4 +30,27 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;
+	u16		__pad1;
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;
+	compay_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	u16		__pad2;
+	u32		st_size;
+	u32		st_blksize;
+	u32		st_blocks;
+	u32		st_atime;
+	u32		__unused1;
+	u32		st_mtime;
+	u32		__unused2;
+	u32		st_ctime;
+	u32		__unused3;
+	u32		__unused4;
+	u32		__unused5;
+};
+
 #endif /* _ASM_IA64_COMPAT_H */
diff -ruN 2.5.51-32bit.1/include/asm-ia64/ia32.h 2.5.51-32bit.2/include/asm-ia64/ia32.h
--- 2.5.51-32bit.1/include/asm-ia64/ia32.h	2002-12-10 16:59:04.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-ia64/ia32.h	2002-12-12 15:08:44.000000000 +1100
@@ -13,19 +13,12 @@
  */
 
 /* 32bit compatibility types */
-typedef int		__kernel_pid_t32;
 typedef unsigned short	__kernel_ipc_pid_t32;
-typedef unsigned short	__kernel_uid_t32;
 typedef unsigned int	__kernel_uid32_t32;
-typedef unsigned short	__kernel_gid_t32;
 typedef unsigned int	__kernel_gid32_t32;
-typedef unsigned short	__kernel_dev_t32;
-typedef unsigned int	__kernel_ino_t32;
-typedef unsigned short	__kernel_mode_t32;
 typedef unsigned short	__kernel_umode_t32;
 typedef short		__kernel_nlink_t32;
 typedef int		__kernel_daddr_t32;
-typedef int		__kernel_off_t32;
 typedef unsigned int	__kernel_caddr_t32;
 typedef long		__kernel_loff_t32;
 typedef __kernel_fsid_t	__kernel_fsid_t32;
@@ -40,9 +33,9 @@
 struct flock32 {
        short l_type;
        short l_whence;
-       __kernel_off_t32 l_start;
-       __kernel_off_t32 l_len;
-       __kernel_pid_t32 l_pid;
+       compat_off_t l_start;
+       compat_off_t l_len;
+       compat_pid_t l_pid;
 };
 
 #define F_GETLK64	12
@@ -167,29 +160,6 @@
 	sigset_t	  uc_sigmask;	/* mask last for extensibility */
 };
 
-struct stat32 {
-       unsigned short st_dev;
-       unsigned short __pad1;
-       unsigned int st_ino;
-       unsigned short st_mode;
-       unsigned short st_nlink;
-       unsigned short st_uid;
-       unsigned short st_gid;
-       unsigned short st_rdev;
-       unsigned short __pad2;
-       unsigned int  st_size;
-       unsigned int  st_blksize;
-       unsigned int  st_blocks;
-       unsigned int  st_atime;
-       unsigned int  __unused1;
-       unsigned int  st_mtime;
-       unsigned int  __unused2;
-       unsigned int  st_ctime;
-       unsigned int  __unused3;
-       unsigned int  __unused4;
-       unsigned int  __unused5;
-};
-
 struct stat64 {
 	unsigned short	st_dev;
 	unsigned char	__pad0[10];

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - s390x
  2002-12-13  4:34 [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent Stephen Rothwell
                   ` (3 preceding siblings ...)
  2002-12-13  4:44 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - ia64 Stephen Rothwell
@ 2002-12-13  4:46 ` Stephen Rothwell
  2002-12-13  4:48 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - mips64 Stephen Rothwell
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-13  4:46 UTC (permalink / raw)
  To: schwidefsky; +Cc: linux-kernel

Hi Martin,

This is the s390x part of the patch.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/s390x/kernel/entry.S 2.5.51-32bit.2/arch/s390x/kernel/entry.S
--- 2.5.51-32bit.1/arch/s390x/kernel/entry.S	2002-12-10 17:05:19.000000000 +1100
+++ 2.5.51-32bit.2/arch/s390x/kernel/entry.S	2002-12-13 14:55:35.000000000 +1100
@@ -482,9 +482,9 @@
         .long  SYSCALL(sys_syslog,sys32_syslog_wrapper)
         .long  SYSCALL(sys_setitimer,compat_sys_setitimer_wrapper)
         .long  SYSCALL(sys_getitimer,compat_sys_getitimer_wrapper)   /* 105 */
-        .long  SYSCALL(sys_newstat,sys32_newstat_wrapper)
-        .long  SYSCALL(sys_newlstat,sys32_newlstat_wrapper)
-        .long  SYSCALL(sys_newfstat,sys32_newfstat_wrapper)
+        .long  SYSCALL(sys_newstat,compat_sys_newstat_wrapper)
+        .long  SYSCALL(sys_newlstat,compat_sys_newlstat_wrapper)
+        .long  SYSCALL(sys_newfstat,compat_sys_newfstat_wrapper)
         .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old uname syscall */
         .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* iopl for i386 */
         .long  SYSCALL(sys_vhangup,sys_vhangup)
diff -ruN 2.5.51-32bit.1/arch/s390x/kernel/ioctl32.c 2.5.51-32bit.2/arch/s390x/kernel/ioctl32.c
--- 2.5.51-32bit.1/arch/s390x/kernel/ioctl32.c	2002-12-10 15:26:49.000000000 +1100
+++ 2.5.51-32bit.2/arch/s390x/kernel/ioctl32.c	2002-12-12 14:05:42.000000000 +1100
@@ -12,6 +12,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/compat.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/sched.h>
@@ -378,9 +379,9 @@
 
 struct loop_info32 {
 	int			lo_number;      /* ioctl r/o */
-	__kernel_dev_t32	lo_device;      /* ioctl r/o */
+	compat_dev_t	lo_device;      /* ioctl r/o */
 	unsigned int		lo_inode;       /* ioctl r/o */
-	__kernel_dev_t32	lo_rdevice;     /* ioctl r/o */
+	compat_dev_t	lo_rdevice;     /* ioctl r/o */
 	int			lo_offset;
 	int			lo_encrypt_type;
 	int			lo_encrypt_key_size;    /* ioctl w/o */
diff -ruN 2.5.51-32bit.1/arch/s390x/kernel/linux32.c 2.5.51-32bit.2/arch/s390x/kernel/linux32.c
--- 2.5.51-32bit.1/arch/s390x/kernel/linux32.c	2002-12-10 17:05:51.000000000 +1100
+++ 2.5.51-32bit.2/arch/s390x/kernel/linux32.c	2002-12-13 14:44:28.000000000 +1100
@@ -268,7 +268,7 @@
         __kernel_gid32_t        gid;
         __kernel_uid32_t        cuid;
         __kernel_gid32_t        cgid;
-        __kernel_mode_t32       mode;
+        compat_mode_t       mode;
         unsigned short          __pad1;
         unsigned short          seq;
         unsigned short          __pad2;
@@ -279,11 +279,11 @@
 struct ipc_perm32
 {
 	key_t    	  key;
-        __kernel_uid_t32  uid;
-        __kernel_gid_t32  gid;
-        __kernel_uid_t32  cuid;
-        __kernel_gid_t32  cgid;
-        __kernel_mode_t32 mode;
+        compat_uid_t  uid;
+        compat_gid_t  gid;
+        compat_uid_t  cuid;
+        compat_gid_t  cgid;
+        compat_mode_t mode;
         unsigned short  seq;
 };
 
@@ -337,8 +337,8 @@
 	unsigned int  msg_cbytes;
 	unsigned int  msg_qnum;
 	unsigned int  msg_qbytes;
-	__kernel_pid_t32 msg_lspid;
-	__kernel_pid_t32 msg_lrpid;
+	compat_pid_t msg_lspid;
+	compat_pid_t msg_lrpid;
 	unsigned int  __unused1;
 	unsigned int  __unused2;
 };
@@ -364,8 +364,8 @@
 	unsigned int		__unused2;
 	compat_time_t  	shm_ctime;
 	unsigned int		__unused3;
-	__kernel_pid_t32	shm_cpid;
-	__kernel_pid_t32	shm_lpid;
+	compat_pid_t	shm_cpid;
+	compat_pid_t	shm_lpid;
 	unsigned int		shm_nattch;
 	unsigned int		__unused4;
 	unsigned int		__unused5;
@@ -1393,7 +1393,7 @@
 	return ret;
 }
 
-static int cp_new_stat32(struct kstat *stat, struct stat32 *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
 {
 	int err;
 
@@ -1420,39 +1420,6 @@
 	return err;
 }
 
-asmlinkage int sys32_newstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_stat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage int sys32_newlstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_lstat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage int sys32_newfstat(unsigned int fd, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_fstat(fd, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
 extern asmlinkage int sys_sysfs(int option, unsigned long arg1, unsigned long arg2);
 
 asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2)
@@ -1463,16 +1430,16 @@
 struct ncp_mount_data32 {
         int version;
         unsigned int ncp_fd;
-        __kernel_uid_t32 mounted_uid;
-        __kernel_pid_t32 wdog_pid;
+        compat_uid_t mounted_uid;
+        compat_pid_t wdog_pid;
         unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
         unsigned int time_out;
         unsigned int retry_count;
         unsigned int flags;
-        __kernel_uid_t32 uid;
-        __kernel_gid_t32 gid;
-        __kernel_mode_t32 file_mode;
-        __kernel_mode_t32 dir_mode;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
 };
 
 static void *do_ncp_super_data_conv(void *raw_data)
@@ -1492,11 +1459,11 @@
 
 struct smb_mount_data32 {
         int version;
-        __kernel_uid_t32 mounted_uid;
-        __kernel_uid_t32 uid;
-        __kernel_gid_t32 gid;
-        __kernel_mode_t32 file_mode;
-        __kernel_mode_t32 dir_mode;
+        compat_uid_t mounted_uid;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
 };
 
 static void *do_smb_super_data_conv(void *raw_data)
@@ -1655,7 +1622,7 @@
 	return err;
 }
 
-asmlinkage int sys32_wait4(__kernel_pid_t32 pid, unsigned int *stat_addr, int options, struct rusage32 *ru)
+asmlinkage int sys32_wait4(compat_pid_t pid, unsigned int *stat_addr, int options, struct rusage32 *ru)
 {
 	if (!ru)
 		return sys_wait4(pid, stat_addr, options, NULL);
@@ -1717,7 +1684,7 @@
 
 extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval);
 
-asmlinkage int sys32_sched_rr_get_interval(__kernel_pid_t32 pid,
+asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
 		struct compat_timespec *interval)
 {
 	struct timespec t;
@@ -3253,27 +3220,27 @@
 struct nfsctl_export32 {
 	s8			ex32_client[NFSCLNT_IDMAX+1];
 	s8			ex32_path[NFS_MAXPATHLEN+1];
-	__kernel_dev_t32	ex32_dev;
-	__kernel_ino_t32	ex32_ino;
+	compat_dev_t	ex32_dev;
+	compat_ino_t	ex32_ino;
 	s32			ex32_flags;
-	__kernel_uid_t32	ex32_anon_uid;
-	__kernel_gid_t32	ex32_anon_gid;
+	compat_uid_t	ex32_anon_uid;
+	compat_gid_t	ex32_anon_gid;
 };
 
 struct nfsctl_uidmap32 {
 	u32			ug32_ident;   /* char * */
-	__kernel_uid_t32	ug32_uidbase;
+	compat_uid_t	ug32_uidbase;
 	s32			ug32_uidlen;
 	u32			ug32_udimap;  /* uid_t * */
-	__kernel_uid_t32	ug32_gidbase;
+	compat_uid_t	ug32_gidbase;
 	s32			ug32_gidlen;
 	u32			ug32_gdimap;  /* gid_t * */
 };
 
 struct nfsctl_fhparm32 {
 	struct sockaddr		gf32_addr;
-	__kernel_dev_t32	gf32_dev;
-	__kernel_ino_t32	gf32_ino;
+	compat_dev_t	gf32_dev;
+	compat_ino_t	gf32_ino;
 	s32			gf32_version;
 };
 
@@ -3402,7 +3369,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_udimap[i],
-			      &(((__kernel_uid_t32 *)A(uaddr))[i]));
+			      &(((compat_uid_t *)A(uaddr))[i]));
 	err |= __get_user(karg->ca_umap.ug_gidbase,
 		      &arg32->ca32_umap.ug32_gidbase);
 	err |= __get_user(karg->ca_umap.ug_uidlen,
@@ -3416,7 +3383,7 @@
 		return -ENOMEM;
 	for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
 		err |= __get_user(karg->ca_umap.ug_gdimap[i],
-			      &(((__kernel_gid_t32 *)A(uaddr))[i]));
+			      &(((compat_gid_t *)A(uaddr))[i]));
 
 	return err;
 }
@@ -3680,7 +3647,7 @@
 
 extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
 
-asmlinkage int sys32_sendfile(int out_fd, int in_fd, __kernel_off_t32 *offset, s32 count)
+asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -4147,7 +4114,7 @@
 extern asmlinkage int sys_sched_setaffinity(pid_t pid, unsigned int len,
 					    unsigned long *user_mask_ptr);
 
-asmlinkage int sys32_sched_setaffinity(__kernel_pid_t32 pid, unsigned int len,
+asmlinkage int sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
 				       u32 *user_mask_ptr)
 {
 	unsigned long kernel_mask;
@@ -4171,7 +4138,7 @@
 extern asmlinkage int sys_sched_getaffinity(pid_t pid, unsigned int len,
 					    unsigned long *user_mask_ptr);
 
-asmlinkage int sys32_sched_getaffinity(__kernel_pid_t32 pid, unsigned int len,
+asmlinkage int sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
 				       u32 *user_mask_ptr)
 {
 	unsigned long kernel_mask;
diff -ruN 2.5.51-32bit.1/arch/s390x/kernel/linux32.h 2.5.51-32bit.2/arch/s390x/kernel/linux32.h
--- 2.5.51-32bit.1/arch/s390x/kernel/linux32.h	2002-12-10 15:40:49.000000000 +1100
+++ 2.5.51-32bit.2/arch/s390x/kernel/linux32.h	2002-12-12 16:11:15.000000000 +1100
@@ -16,17 +16,9 @@
 	((unsigned long)(__x))
 
 /* Now 32bit compatibility types */
-typedef int                    __kernel_pid_t32;
 typedef unsigned short         __kernel_ipc_pid_t32;
-typedef unsigned short         __kernel_uid_t32;
-typedef unsigned short         __kernel_gid_t32;
-typedef unsigned short         __kernel_dev_t32;
-typedef unsigned int           __kernel_ino_t32;
-typedef unsigned short         __kernel_mode_t32;
 typedef unsigned short         __kernel_umode_t32;
-typedef short                  __kernel_nlink_t32;
 typedef int                    __kernel_daddr_t32;
-typedef int                    __kernel_off_t32;
 typedef unsigned int           __kernel_caddr_t32;
 typedef long                   __kernel_loff_t32;
 typedef __kernel_fsid_t        __kernel_fsid_t32;  
@@ -43,35 +35,12 @@
 struct flock32 {
         short l_type;
         short l_whence;
-        __kernel_off_t32 l_start;
-        __kernel_off_t32 l_len;
-        __kernel_pid_t32 l_pid;
+        compat_off_t l_start;
+        compat_off_t l_len;
+        compat_pid_t l_pid;
         short __unused;
 }; 
 
-struct stat32 {
-	unsigned short	st_dev;
-	unsigned short	__pad1;
-	__u32		st_ino;
-	unsigned short	st_mode;
-	unsigned short	st_nlink;
-	unsigned short	st_uid;
-	unsigned short	st_gid;
-	unsigned short	st_rdev;
-	unsigned short	__pad2;
-	__u32		st_size;
-	__u32		st_blksize;
-	__u32		st_blocks;
-	__u32		st_atime;
-	__u32		__unused1;
-	__u32		st_mtime;
-	__u32		__unused2;
-	__u32		st_ctime;
-	__u32		__unused3;
-	__u32		__unused4;
-	__u32		__unused5;
-};
-
 struct statfs32 {
 	__s32			f_type;
 	__s32			f_bsize;
diff -ruN 2.5.51-32bit.1/arch/s390x/kernel/wrapper32.S 2.5.51-32bit.2/arch/s390x/kernel/wrapper32.S
--- 2.5.51-32bit.1/arch/s390x/kernel/wrapper32.S	2002-12-10 17:04:36.000000000 +1100
+++ 2.5.51-32bit.2/arch/s390x/kernel/wrapper32.S	2002-12-13 14:55:15.000000000 +1100
@@ -470,31 +470,31 @@
 	lgfr	%r2,%r2			# int
 	llgtr	%r3,%r3			# struct itimerval_emu31 *
 	llgtr	%r4,%r4			# struct itimerval_emu31 *
-	jg	compat_sys_setitimer		# branch to system call
+	jg	compat_sys_setitimer	# branch to system call
 
 	.globl  compat_sys_getitimer_wrapper 
 compat_sys_getitimer_wrapper:
 	lgfr	%r2,%r2			# int
 	llgtr	%r3,%r3			# struct itimerval_emu31 *
-	jg	compat_sys_getitimer		# branch to system call
+	jg	compat_sys_getitimer	# branch to system call
 
-	.globl  sys32_newstat_wrapper 
-sys32_newstat_wrapper:
+	.globl  compat_sys_newstat_wrapper 
+compat_sys_newstat_wrapper:
 	llgtr	%r2,%r2			# char *
 	llgtr	%r3,%r3			# struct stat_emu31 *
-	jg	sys32_newstat		# branch to system call
+	jg	compat_sys_newstat	# branch to system call
 
-	.globl  sys32_newlstat_wrapper 
-sys32_newlstat_wrapper:
+	.globl  compat_sys_newlstat_wrapper 
+compat_sys_newlstat_wrapper:
 	llgtr	%r2,%r2			# char *
 	llgtr	%r3,%r3			# struct stat_emu31 *
-	jg	sys32_newlstat		# branch to system call
+	jg	compat_sys_newlstat	# branch to system call
 
-	.globl  sys32_newfstat_wrapper 
-sys32_newfstat_wrapper:
+	.globl  compat_sys_newfstat_wrapper 
+compat_sys_newfstat_wrapper:
 	llgfr	%r2,%r2			# unsigned int
 	llgtr	%r3,%r3			# struct stat_emu31 *
-	jg	sys32_newfstat		# branch to system call
+	jg	compat_sys_newfstat	# branch to system call
 
 #sys32_vhangup_wrapper			# void 
 
diff -ruN 2.5.51-32bit.1/include/asm-s390x/compat.h 2.5.51-32bit.2/include/asm-s390x/compat.h
--- 2.5.51-32bit.1/include/asm-s390x/compat.h	2002-12-10 16:38:17.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-s390x/compat.h	2002-12-12 16:14:04.000000000 +1100
@@ -11,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u16		compat_uid_t;
+typedef u16		compat_gid_t;
+typedef u16		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u16		compat_dev_t;
+typedef s32		compat_off_t;
+typedef u16		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -22,4 +30,27 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;
+	u16		__pad1;
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	u16		__pad2;
+	u32		st_size;
+	u32		st_blksize;
+	u32		st_blocks;
+	u32		st_atime;
+	u32		__unused1;
+	u32		st_mtime;
+	u32		__unused2;
+	u32		st_ctime;
+	u32		__unused3;
+	u32		__unused4;
+	u32		__unused5;
+};
+
 #endif /* _ASM_S390X_COMPAT_H */

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - mips64
  2002-12-13  4:34 [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent Stephen Rothwell
                   ` (4 preceding siblings ...)
  2002-12-13  4:46 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - s390x Stephen Rothwell
@ 2002-12-13  4:48 ` 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
  7 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-13  4:48 UTC (permalink / raw)
  To: ralf; +Cc: linux-kernel

Hi Ralf,

Here is the mips64 part of the patch.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/mips64/kernel/linux32.c 2.5.51-32bit.2/arch/mips64/kernel/linux32.c
--- 2.5.51-32bit.1/arch/mips64/kernel/linux32.c	2002-12-10 17:00:58.000000000 +1100
+++ 2.5.51-32bit.2/arch/mips64/kernel/linux32.c	2002-12-12 17:23:21.000000000 +1100
@@ -40,9 +40,9 @@
  * Revalidate the inode. This is required for proper NFS attribute caching.
  */
 
-static int cp_new_stat32(struct kstat *stat, struct stat32 *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
 {
-	struct stat32 tmp;
+	struct compat_stat tmp;
 
 	memset(&tmp, 0, sizeof(tmp));
 	tmp.st_dev = stat->dev;
@@ -61,39 +61,6 @@
 	return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
 }
 
-asmlinkage int sys32_newstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_stat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage int sys32_newlstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_lstat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage long sys32_newfstat(unsigned int fd, struct stat32 * statbuf)
-{
-	struct kstat stat;
-	int error = vfs_fstat(fd, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
 asmlinkage int sys_mmap2(void) {return 0;}
 
 asmlinkage long sys_truncate(const char * path, unsigned long length);
@@ -479,7 +446,7 @@
 }
 
 asmlinkage int
-sys32_wait4(__kernel_pid_t32 pid, unsigned int * stat_addr, int options,
+sys32_wait4(compat_pid_t pid, unsigned int * stat_addr, int options,
 	    struct rusage32 * ru)
 {
 	if (!ru)
@@ -501,7 +468,7 @@
 }
 
 asmlinkage int
-sys32_waitpid(__kernel_pid_t32 pid, unsigned int *stat_addr, int options)
+sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options)
 {
 	return sys32_wait4(pid, stat_addr, options, NULL);
 }
@@ -1109,7 +1076,7 @@
 						struct timespec *interval);
 
 asmlinkage int
-sys32_sched_rr_get_interval(__kernel_pid_t32 pid, struct compat_timespec *interval)
+sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval)
 {
 	struct timespec t;
 	int ret;
@@ -1170,9 +1137,9 @@
 struct flock32 {
 	short l_type;
 	short l_whence;
-	__kernel_off_t32 l_start;
-	__kernel_off_t32 l_len;
-	__kernel_pid_t32 l_pid;
+	compat_off_t l_start;
+	compat_off_t l_len;
+	compat_pid_t l_pid;
 	short __unused;
 };
 
@@ -1249,11 +1216,11 @@
 struct ipc_perm32
 {
 	key_t    	  key;
-        __kernel_uid_t32  uid;
-        __kernel_gid_t32  gid;
-        __kernel_uid_t32  cuid;
-        __kernel_gid_t32  cgid;
-        __kernel_mode_t32 mode;
+        compat_uid_t  uid;
+        compat_gid_t  gid;
+        compat_uid_t  cuid;
+        compat_gid_t  cgid;
+        compat_mode_t mode;
         unsigned short  seq;
 };
 
diff -ruN 2.5.51-32bit.1/arch/mips64/kernel/scall_o32.S 2.5.51-32bit.2/arch/mips64/kernel/scall_o32.S
--- 2.5.51-32bit.1/arch/mips64/kernel/scall_o32.S	2002-12-10 17:02:02.000000000 +1100
+++ 2.5.51-32bit.2/arch/mips64/kernel/scall_o32.S	2002-12-13 14:54:29.000000000 +1100
@@ -339,9 +339,9 @@
 	sys	sys_syslog	3
 	sys	compat_sys_setitimer	3
 	sys	compat_sys_getitimer	2			/* 4105 */
-	sys	sys32_newstat	2
-	sys	sys32_newlstat	2
-	sys	sys32_newfstat	2
+	sys	compat_sys_newstat	2
+	sys	compat_sys_newlstat	2
+	sys	compat_sys_newfstat	2
 	sys	sys_ni_syscall	0	/* was sys_uname */
 	sys	sys_ni_syscall	0	/* sys_ioperm  *//* 4110 */
 	sys	sys_vhangup	0
diff -ruN 2.5.51-32bit.1/include/asm-mips64/compat.h 2.5.51-32bit.2/include/asm-mips64/compat.h
--- 2.5.51-32bit.1/include/asm-mips64/compat.h	2002-12-10 16:37:59.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-mips64/compat.h	2002-12-12 15:52:11.000000000 +1100
@@ -11,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef s32		compat_uid_t;
+typedef s32		compat_gid_t;
+typedef u32		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u32		compat_dev_t;
+typedef s32		compat_off_t;
+typedef u32		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -22,4 +30,27 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;
+	s32		st_pad1[3];
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	s32		st_pad2[2];
+	compat_off_t	st_size;
+	s32		st_pad3;
+	compat_time_t	st_atime;
+	s32		reserved0;
+	compat_time_t	st_mtime;
+	s32		reserved1;
+	compat_time_t	st_ctime;
+	s32		reserved2;
+	s32		st_blksize;
+	s32		st_blocks;
+	s32		st_pad4[14];
+};
+
 #endif /* _ASM_MIPS64_COMPAT_H */
diff -ruN 2.5.51-32bit.1/include/asm-mips64/posix_types.h 2.5.51-32bit.2/include/asm-mips64/posix_types.h
--- 2.5.51-32bit.1/include/asm-mips64/posix_types.h	2002-12-10 15:42:41.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-mips64/posix_types.h	2002-12-12 15:52:36.000000000 +1100
@@ -49,15 +49,7 @@
 } __kernel_fsid_t;
 
 /* Now 32bit compatibility types */
-typedef unsigned int	__kernel_dev_t32;
-typedef unsigned int	__kernel_ino_t32;
-typedef unsigned int	__kernel_mode_t32;
-typedef unsigned int	__kernel_nlink_t32;
-typedef int		__kernel_off_t32;
-typedef int		__kernel_pid_t32;
 typedef int		__kernel_ipc_pid_t32;
-typedef int		__kernel_uid_t32;
-typedef int		__kernel_gid_t32;
 typedef int		__kernel_daddr_t32;
 typedef unsigned int	__kernel_caddr_t32;
 typedef __kernel_fsid_t	__kernel_fsid_t32;
diff -ruN 2.5.51-32bit.1/include/asm-mips64/stat.h 2.5.51-32bit.2/include/asm-mips64/stat.h
--- 2.5.51-32bit.1/include/asm-mips64/stat.h	2002-12-10 15:26:49.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-mips64/stat.h	2002-12-12 15:20:36.000000000 +1100
@@ -10,7 +10,6 @@
 #define _ASM_STAT_H
 
 #include <linux/types.h>
-#include <linux/compat.h>
 
 struct __old_kernel_stat {
 	unsigned int	st_dev;
@@ -29,29 +28,6 @@
 	unsigned int	st_unused[2];
 };
 
-struct stat32 {
-	__kernel_dev_t32    st_dev;
-	int		    st_pad1[3];
-	__kernel_ino_t32    st_ino;
-	__kernel_mode_t32   st_mode;
-	__kernel_nlink_t32  st_nlink;
-	__kernel_uid_t32    st_uid;
-	__kernel_gid_t32    st_gid;
-	__kernel_dev_t32    st_rdev;
-	int		    st_pad2[2];
-	__kernel_off_t32    st_size;
-	int		    st_pad3;
-	compat_time_t     st_atime;
-	int		    reserved0;
-	compat_time_t     st_mtime;
-	int		    reserved1;
-	compat_time_t     st_ctime;
-	int		    reserved2;
-	int		    st_blksize;
-	int		    st_blocks;
-	int		    st_pad4[14];
-};
-
 /* The memory layout is the same as of struct stat64 of the 32-bit kernel.  */
 struct stat {
 	dev_t		st_dev;

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH][COMPAT] consolidate sys32_new[lf]stat - parisc
  2002-12-13  4:34 [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent Stephen Rothwell
                   ` (5 preceding siblings ...)
  2002-12-13  4:48 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - mips64 Stephen Rothwell
@ 2002-12-13  4:51 ` Stephen Rothwell
  2002-12-13  5:32 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent David S. Miller
  7 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-13  4:51 UTC (permalink / raw)
  To: willy; +Cc: linux-kernel

Hi Willy,

Here is the parisc part of the patch.  Unfortunately, I realise this
breaks on parisc (there is an assumption that the compatibility
syscall routine names start with sys32_).  I will fix this in the
next patch (hopefully).
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

diff -ruN 2.5.51-32bit.1/arch/parisc/kernel/ioctl32.c 2.5.51-32bit.2/arch/parisc/kernel/ioctl32.c
--- 2.5.51-32bit.1/arch/parisc/kernel/ioctl32.c	2002-12-10 15:26:49.000000000 +1100
+++ 2.5.51-32bit.2/arch/parisc/kernel/ioctl32.c	2002-12-12 14:05:05.000000000 +1100
@@ -1366,9 +1366,9 @@
 
 struct loop_info32 {
 	int			lo_number;      /* ioctl r/o */
-	__kernel_dev_t32	lo_device;      /* ioctl r/o */
+	compat_dev_t	lo_device;      /* ioctl r/o */
 	unsigned int		lo_inode;       /* ioctl r/o */
-	__kernel_dev_t32	lo_rdevice;     /* ioctl r/o */
+	compat_dev_t	lo_rdevice;     /* ioctl r/o */
 	int			lo_offset;
 	int			lo_encrypt_type;
 	int			lo_encrypt_key_size;    /* ioctl w/o */
@@ -1577,7 +1577,7 @@
 	set_fs(old_fs);
 
 	if (err >= 0)
-		err = put_user(kuid, (__kernel_uid_t32 *)arg);
+		err = put_user(kuid, (compat_uid_t *)arg);
 
 	return err;
 }
@@ -1864,7 +1864,7 @@
 } lv_status_byindex_req32_t;
 
 typedef struct {
-	__kernel_dev_t32 dev;
+	compat_dev_t dev;
 	u32   lv;
 } lv_status_bydev_req32_t;
 
@@ -3628,7 +3628,7 @@
 HANDLE_IOCTL(EXT2_IOC32_SETVERSION, do_ext2_ioctl)
 #if 0
 /* One SMB ioctl needs translations. */
-#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, __kernel_uid_t32)
+#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
 HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid)
 #endif
 HANDLE_IOCTL(ATM_GETLINKRATE32, do_atm_ioctl)
diff -ruN 2.5.51-32bit.1/arch/parisc/kernel/sys_parisc32.c 2.5.51-32bit.2/arch/parisc/kernel/sys_parisc32.c
--- 2.5.51-32bit.1/arch/parisc/kernel/sys_parisc32.c	2002-12-10 17:03:26.000000000 +1100
+++ 2.5.51-32bit.2/arch/parisc/kernel/sys_parisc32.c	2002-12-12 17:23:57.000000000 +1100
@@ -389,9 +389,9 @@
 struct flock32 {
 	short l_type;
 	short l_whence;
-	__kernel_off_t32 l_start;
-	__kernel_off_t32 l_len;
-	__kernel_pid_t32 l_pid;
+	compat_off_t l_start;
+	compat_off_t l_len;
+	compat_pid_t l_pid;
 };
 
 
@@ -674,7 +674,7 @@
 }
 
 asmlinkage int
-sys32_wait4(__kernel_pid_t32 pid, unsigned int * stat_addr, int options,
+sys32_wait4(compat_pid_t pid, unsigned int * stat_addr, int options,
 	    struct rusage32 * ru)
 {
 	if (!ru)
@@ -692,41 +692,13 @@
 	}
 }
 
-struct stat32 {
-	__kernel_dev_t32		st_dev;		/* dev_t is 32 bits on parisc */
-	__kernel_ino_t32		st_ino;		/* 32 bits */
-	__kernel_mode_t32	st_mode;	/* 16 bits */
-	__kernel_nlink_t32		st_nlink;	/* 16 bits */
-	unsigned short	st_reserved1;	/* old st_uid */
-	unsigned short	st_reserved2;	/* old st_gid */
-	__kernel_dev_t32		st_rdev;
-	__kernel_off_t32		st_size;
-	compat_time_t	st_atime;
-	unsigned int	st_spare1;
-	compat_time_t	st_mtime;
-	unsigned int	st_spare2;
-	compat_time_t	st_ctime;
-	unsigned int	st_spare3;
-	int		st_blksize;
-	int		st_blocks;
-	unsigned int	__unused1;	/* ACL stuff */
-	__kernel_dev_t32		__unused2;	/* network */
-	__kernel_ino_t32		__unused3;	/* network */
-	unsigned int	__unused4;	/* cnodes */
-	unsigned short	__unused5;	/* netsite */
-	short		st_fstype;
-	__kernel_dev_t32		st_realdev;
-	unsigned short	st_basemode;
-	unsigned short	st_spareshort;
-	__kernel_uid_t32		st_uid;
-	__kernel_gid_t32		st_gid;
-	unsigned int	st_spare4[3];
-};
-
-static int cp_new_stat32(struct kstat *stat, struct stat32 *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
 {
 	int err;
 
+	if (stat->size > MAX_NON_LFS)
+		return -EOVERFLOW;
+
 	err  = put_user(stat->dev, &statbuf->st_dev);
 	err |= put_user(stat->ino, &statbuf->st_ino);
 	err |= put_user(stat->mode, &statbuf->st_mode);
@@ -734,8 +706,6 @@
 	err |= put_user(0, &statbuf->st_reserved1);
 	err |= put_user(0, &statbuf->st_reserved2);
 	err |= put_user(stat->rdev, &statbuf->st_rdev);
-	if (stat->size > MAX_NON_LFS)
-		return -EOVERFLOW;
 	err |= put_user(stat->size, &statbuf->st_size);
 	err |= put_user(stat->atime, &statbuf->st_atime);
 	err |= put_user(0, &statbuf->st_spare1);
@@ -763,42 +733,9 @@
 	return err;
 }
 
-asmlinkage long sys32_newstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_stat(filename, &stat);
-
-	if (!error) 
-		error = cp_new_stat32(&stat, statbuf);
-	
-	return error;
-}
-
-asmlinkage long sys32_newlstat(char * filename, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_lstat(filename, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
-asmlinkage long sys32_newfstat(unsigned int fd, struct stat32 *statbuf)
-{
-	struct kstat stat;
-	int error = vfs_fstat(fd, &stat);
-
-	if (!error)
-		error = cp_new_stat32(&stat, statbuf);
-
-	return error;
-}
-
 struct linux32_dirent {
 	u32	d_ino;
-	__kernel_off_t32	d_off;
+	compat_off_t	d_off;
 	u16	d_reclen;
 	char	d_name[1];
 };
@@ -2619,7 +2556,7 @@
 	char			ex_client[NFSCLNT_IDMAX+1];
 	char			ex_path[NFS_MAXPATHLEN+1];
 	__kernel_dev_t		ex_dev;
-	__kernel_ino_t32	ex_ino;
+	compat_ino_t	ex_ino;
 	int			ex_flags;
 	__kernel_uid_t		ex_anon_uid;
 	__kernel_gid_t		ex_anon_gid;
@@ -2629,7 +2566,7 @@
 struct nfsctl_fhparm32 {
 	struct sockaddr		gf_addr;
 	__kernel_dev_t		gf_dev;
-	__kernel_ino_t32	gf_ino;
+	compat_ino_t	gf_ino;
 	int			gf_version;
 };
 
diff -ruN 2.5.51-32bit.1/include/asm-parisc/compat.h 2.5.51-32bit.2/include/asm-parisc/compat.h
--- 2.5.51-32bit.1/include/asm-parisc/compat.h	2002-12-10 16:38:08.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-parisc/compat.h	2002-12-12 16:14:20.000000000 +1100
@@ -11,6 +11,14 @@
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u32		compat_uid_t;
+typedef u32		compat_gid_t;
+typedef u16		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u32		compat_dev_t;
+typedef s32		compat_off_t;
+typedef u16		compat_nlink_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -22,4 +30,35 @@
 	s32		tv_usec;
 };
 
+struct compat_stat {
+	compat_dev_t	st_dev;		/* dev_t is 32 bits on parisc */
+	compat_ino_t	st_ino;		/* 32 bits */
+	compat_mode_t	st_mode;	/* 16 bits */
+	compat_nlink_t	st_nlink;	/* 16 bits */
+	u16		st_reserved1;	/* old st_uid */
+	u16		st_reserved2;	/* old st_gid */
+	compat_dev_t	st_rdev;
+	compat_off_t	st_size;
+	compat_time_t	st_atime;
+	u32		st_spare1;
+	compat_time_t	st_mtime;
+	u32		st_spare2;
+	compat_time_t	st_ctime;
+	u32		st_spare3;
+	s32		st_blksize;
+	s32		st_blocks;
+	u32		__unused1;	/* ACL stuff */
+	compat_dev_t	__unused2;	/* network */
+	compat_ino_t	__unused3;	/* network */
+	u32		__unused4;	/* cnodes */
+	u16		__unused5;	/* netsite */
+	short		st_fstype;
+	compat_dev_t	st_realdev;
+	u16		st_basemode;
+	u16		st_spareshort;
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	u32		st_spare4[3];
+};
+
 #endif /* _ASM_PARISC_COMPAT_H */
diff -ruN 2.5.51-32bit.1/include/asm-parisc/posix_types.h 2.5.51-32bit.2/include/asm-parisc/posix_types.h
--- 2.5.51-32bit.1/include/asm-parisc/posix_types.h	2002-12-10 15:42:51.000000000 +1100
+++ 2.5.51-32bit.2/include/asm-parisc/posix_types.h	2002-12-12 15:57:18.000000000 +1100
@@ -57,15 +57,7 @@
 
 #if defined(__KERNEL__) && defined(__LP64__)
 /* Now 32bit compatibility types */
-typedef unsigned int		__kernel_dev_t32;
-typedef unsigned int		__kernel_ino_t32;
-typedef unsigned short		__kernel_mode_t32;
-typedef unsigned short		__kernel_nlink_t32;
-typedef int			__kernel_off_t32;
-typedef int			__kernel_pid_t32;
 typedef unsigned short		__kernel_ipc_pid_t32;
-typedef unsigned int		__kernel_uid_t32;
-typedef unsigned int		__kernel_gid_t32;
 typedef int			__kernel_daddr_t32;
 typedef unsigned int		__kernel_caddr_t32;
 #endif

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent
  2002-12-13  4:34 [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent Stephen Rothwell
                   ` (6 preceding siblings ...)
  2002-12-13  4:51 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - parisc Stephen Rothwell
@ 2002-12-13  5:32 ` David S. Miller
  2002-12-13  6:18   ` Stephen Rothwell
  7 siblings, 1 reply; 10+ messages in thread
From: David S. Miller @ 2002-12-13  5:32 UTC (permalink / raw)
  To: sfr; +Cc: torvalds, linux-kernel, anton, ak, davidm, schwidefsky, ralf,
	willy

   From: Stephen Rothwell <sfr@canb.auug.org.au>
   Date: Fri, 13 Dec 2002 15:34:39 +1100

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

I'm totally fine with this stuff (and the sparc64 specific part), but
watch out, this patch removes the kernel/compat.c utimes stuff :-)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent
  2002-12-13  5:32 ` [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent David S. Miller
@ 2002-12-13  6:18   ` Stephen Rothwell
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-13  6:18 UTC (permalink / raw)
  To: David S. Miller
  Cc: torvalds, linux-kernel, anton, ak, davidm, schwidefsky, ralf,
	willy

On Thu, 12 Dec 2002 21:32:31 -0800 (PST) "David S. Miller" <davem@redhat.com> wrote:
> 
> I'm totally fine with this stuff (and the sparc64 specific part), but
> watch out, this patch removes the kernel/compat.c utimes stuff :-)

And adds it into fs/compat.c where it should have been in the first place ...

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-12-13  6:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-13  4:34 [PATCH][COMPAT] consolidate sys32_new[lf]stat - architecture independent Stephen Rothwell
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox