public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7
@ 2002-12-30  6:19 Stephen Rothwell
  2002-12-30  6:25 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 1/7 PPC64 Stephen Rothwell
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-30  6:19 UTC (permalink / raw)
  To: LKML; +Cc: anton, David S. Miller, ak, davidm, schwidefsky, ralf, willy

Hi all,

The following patches (one for each affected architecture) remove the
last of the __kernel_..._t32 typedefs.  These patches are relative to
2.5.53 and there are now only a couple of cases where none of the
compatibility syscall infrastructure has been integrated.

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

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

* [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 1/7 PPC64
  2002-12-30  6:19 [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7 Stephen Rothwell
@ 2002-12-30  6:25 ` Stephen Rothwell
  2003-01-02 15:58   ` Anton Blanchard
  2002-12-30  6:31 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 2/7 SPARC64 Stephen Rothwell
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-30  6:25 UTC (permalink / raw)
  To: anton; +Cc: linux-kernel

Hi Anton,

PPC64 specific stuff ...

This includes that compat_..stat and compat_times calls and fixes a
(pseudo) bug where the compatibility loff_t was defined as int (instead
of signed 64 bit).

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

diff -ruN 2.5.53/arch/ppc64/kernel/ioctl32.c 2.5.53-32bit.1/arch/ppc64/kernel/ioctl32.c
--- 2.5.53/arch/ppc64/kernel/ioctl32.c	2002-12-10 15:10:16.000000000 +1100
+++ 2.5.53-32bit.1/arch/ppc64/kernel/ioctl32.c	2002-12-30 15:42:02.000000000 +1100
@@ -442,13 +442,13 @@
                 struct  ifmap32 ifru_map;
                 char    ifru_slave[IFNAMSIZ];   /* Just fits the size */
 		char	ifru_newname[IFNAMSIZ];
-                __kernel_caddr_t32 ifru_data;
+                compat_caddr_t ifru_data;
         } ifr_ifru;
 };
 
 struct ifconf32 {
         int     ifc_len;                        /* size of buffer       */
-        __kernel_caddr_t32  ifcbuf;
+        compat_caddr_t  ifcbuf;
 };
 
 #ifdef CONFIG_NET
@@ -884,7 +884,7 @@
 	unsigned char	rate;
 	unsigned char	spec1;
 	unsigned char	fmt_gap;
-	const __kernel_caddr_t32 name;
+	const compat_caddr_t name;
 };
 
 struct floppy_drive_params32 {
@@ -923,7 +923,7 @@
 	int		fd_ref;
 	int		fd_device;
 	int		last_checked;
-	__kernel_caddr_t32 dmabuf;
+	compat_caddr_t dmabuf;
 	int		bufblocks;
 };
 
@@ -1413,7 +1413,7 @@
 }
 
 struct ppp_option_data32 {
-	__kernel_caddr_t32	ptr;
+	compat_caddr_t	ptr;
 	__u32			length;
 	int			transmit;
 };
@@ -1494,8 +1494,8 @@
 	__u32	mt_dsreg;
 	__u32	mt_gstat;
 	__u32	mt_erreg;
-	__kernel_daddr_t32	mt_fileno;
-	__kernel_daddr_t32	mt_blkno;
+	compat_daddr_t	mt_fileno;
+	compat_daddr_t	mt_blkno;
 };
 #define MTIOCGET32	_IOR('m', 2, struct mtget32)
 
@@ -1613,7 +1613,7 @@
 
 struct cdrom_read32 {
 	int			cdread_lba;
-	__kernel_caddr_t32	cdread_bufaddr;
+	compat_caddr_t	cdread_bufaddr;
 	int			cdread_buflen;
 };
 
@@ -1621,16 +1621,16 @@
 	union cdrom_addr	addr;
 	u_char			addr_format;
 	int			nframes;
-	__kernel_caddr_t32	buf;
+	compat_caddr_t	buf;
 };
 
 struct cdrom_generic_command32 {
 	unsigned char		cmd[CDROM_PACKET_SIZE];
-	__kernel_caddr_t32	buffer;
+	compat_caddr_t	buffer;
 	unsigned int		buflen;
 	int			stat;
-	__kernel_caddr_t32	sense;
-	__kernel_caddr_t32	reserved[3];
+	compat_caddr_t	sense;
+	compat_caddr_t	reserved[3];
 };
 
 static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
@@ -1639,7 +1639,7 @@
 	struct cdrom_read cdread;
 	struct cdrom_read_audio cdreadaudio;
 	struct cdrom_generic_command cgc;
-	__kernel_caddr_t32 addr;
+	compat_caddr_t addr;
 	char *data = 0;
 	void *karg;
 	int err = 0;
@@ -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;
 }
@@ -2062,7 +2062,7 @@
 struct ncp_ioctl_request_32 {
 	unsigned int function;
 	unsigned int size;
-	__kernel_caddr_t32 data;
+	compat_caddr_t data;
 };
 
 struct ncp_fs_info_v2_32 {
@@ -2083,13 +2083,13 @@
 {
 	int		auth_type;
 	unsigned int	object_name_len;
-	__kernel_caddr_t32	object_name;	/* an userspace data, in most cases user name */
+	compat_caddr_t	object_name;	/* an userspace data, in most cases user name */
 };
 
 struct ncp_privatedata_ioctl_32
 {
 	unsigned int	len;
-	__kernel_caddr_t32	data;		/* ~1000 for NDS */
+	compat_caddr_t	data;		/* ~1000 for NDS */
 };
 
 #define	NCP_IOC_NCPREQUEST_32		_IOR('n', 1, struct ncp_ioctl_request_32)
@@ -2362,12 +2362,12 @@
 struct atmif_sioc32 {
         int                number;
         int                length;
-        __kernel_caddr_t32 arg;
+        compat_caddr_t arg;
 };
 
 struct atm_iobuf32 {
 	int                length;
-	__kernel_caddr_t32 buffer;
+	compat_caddr_t buffer;
 };
 
 #define ATM_GETLINKRATE32 _IOW('a', ATMIOC_ITF+1, struct atmif_sioc32)
@@ -2428,7 +2428,7 @@
 
 	iobuf.length = iobuf32.length;
 
-	if (iobuf32.buffer == (__kernel_caddr_t32) NULL || iobuf32.length == 0) {
+	if (iobuf32.buffer == (compat_caddr_t) NULL || iobuf32.length == 0) {
 		iobuf.buffer = (void*)(unsigned long)iobuf32.buffer;
 	} else {
 		iobuf.buffer = kmalloc(iobuf.length, GFP_KERNEL);
@@ -2482,7 +2482,7 @@
         sioc.number = sioc32.number;
         sioc.length = sioc32.length;
         
-	if (sioc32.arg == (__kernel_caddr_t32) NULL || sioc32.length == 0) {
+	if (sioc32.arg == (compat_caddr_t) NULL || sioc32.length == 0) {
 		sioc.arg = (void*)(unsigned long)sioc32.arg;
         } else {
                 sioc.arg = kmalloc(sioc.length, GFP_KERNEL);
@@ -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.53/arch/ppc64/kernel/misc.S 2.5.53-32bit.1/arch/ppc64/kernel/misc.S
--- 2.5.53/arch/ppc64/kernel/misc.S	2002-12-10 15:10:16.000000000 +1100
+++ 2.5.53-32bit.1/arch/ppc64/kernel/misc.S	2002-12-16 14:51:53.000000000 +1100
@@ -551,7 +551,7 @@
 	.llong .sys_rmdir		/* 40 */
 	.llong .sys_dup
 	.llong .sys_pipe
-	.llong .sys32_times
+	.llong .compat_sys_times
 	.llong .sys_ni_syscall		/* old prof syscall */
 	.llong .sys_brk			/* 45 */
 	.llong .sys_setgid
@@ -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.53/arch/ppc64/kernel/sys_ppc32.c 2.5.53-32bit.1/arch/ppc64/kernel/sys_ppc32.c
--- 2.5.53/arch/ppc64/kernel/sys_ppc32.c	2002-12-10 15:10:16.000000000 +1100
+++ 2.5.53-32bit.1/arch/ppc64/kernel/sys_ppc32.c	2002-12-30 16:10:12.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;
 }
@@ -2076,37 +2044,6 @@
 }
 
 
-struct tms32 {
-	__kernel_clock_t32 tms_utime;
-	__kernel_clock_t32 tms_stime;
-	__kernel_clock_t32 tms_cutime;
-	__kernel_clock_t32 tms_cstime;
-};
-                                
-extern asmlinkage long sys_times(struct tms * tbuf);
-
-asmlinkage long sys32_times(struct tms32 *tbuf)
-{
-	struct tms t;
-	long ret;
-	mm_segment_t old_fs = get_fs ();
-	int err;
-	
-	set_fs (KERNEL_DS);
-	ret = sys_times(tbuf ? &t : NULL);
-	set_fs (old_fs);
-	if (tbuf) {
-		err = put_user (t.tms_utime, &tbuf->tms_utime);
-		err |= __put_user (t.tms_stime, &tbuf->tms_stime);
-		err |= __put_user (t.tms_cutime, &tbuf->tms_cutime);
-		err |= __put_user (t.tms_cstime, &tbuf->tms_cstime);
-		if (err)
-			ret = -EFAULT;
-	}
-	
-	return ret;
-}
-
 struct msgbuf32 { s32 mtype; char mtext[1]; };
 
 struct semid_ds32 {
@@ -2144,8 +2081,8 @@
 	unsigned short msg_cbytes;
 	unsigned short msg_qnum;
 	unsigned short msg_qbytes;
-	__kernel_ipc_pid_t32 msg_lspid;
-	__kernel_ipc_pid_t32 msg_lrpid;
+	compat_ipc_pid_t msg_lspid;
+	compat_ipc_pid_t msg_lrpid;
 };
 
 struct msqid64_ds32 {
@@ -2159,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;
 };
@@ -2171,8 +2108,8 @@
 	compat_time_t shm_atime;
 	compat_time_t shm_dtime;
 	compat_time_t shm_ctime;
-	__kernel_ipc_pid_t32 shm_cpid;
-	__kernel_ipc_pid_t32 shm_lpid;
+	compat_ipc_pid_t shm_cpid;
+	compat_ipc_pid_t shm_lpid;
 	unsigned short shm_nattch;
 	unsigned short __unused;
 	unsigned int __unused2;
@@ -2189,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;
@@ -2712,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;
@@ -2733,7 +2670,7 @@
 
 extern asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t *offset, size_t count);
 
-asmlinkage int sys32_sendfile64(int out_fd, int in_fd, __kernel_loff_t32 *offset, s32 count)
+asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -4296,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;
@@ -4320,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.53/include/asm-ppc64/compat.h 2.5.53-32bit.1/include/asm-ppc64/compat.h
--- 2.5.53/include/asm-ppc64/compat.h	2002-12-10 15:10:39.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-ppc64/compat.h	2002-12-30 16:27:03.000000000 +1100
@@ -5,9 +5,25 @@
  */
 #include <linux/types.h>
 
+#define COMPAT_USER_HZ	100
+
 typedef u32		compat_size_t;
 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 s64		compat_loff_t;
+typedef s16		compat_nlink_t;
+typedef u16		compat_ipc_pid_t;
+typedef s32		compat_daddr_t;
+typedef u32		compat_caddr_t;
+typedef __kernel_fsid_t	compat_fsid_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -19,4 +35,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.53/include/asm-ppc64/ppc32.h 2.5.53-32bit.1/include/asm-ppc64/ppc32.h
--- 2.5.53/include/asm-ppc64/ppc32.h	2002-12-10 15:10:39.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-ppc64/ppc32.h	2002-12-30 16:27:32.000000000 +1100
@@ -14,11 +14,6 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#ifndef __KERNEL_STRICT_NAMES
-#include <linux/types.h>
-typedef __kernel_fsid_t __kernel_fsid_t32;
-#endif
-
 /* Use this to get at 32-bit user passed pointers. */
 /* Things to consider: the low-level assembly stub does
    srl x, 0, x for first four arguments, so if you have
@@ -44,21 +39,6 @@
 })
 
 /* These are here to support 32-bit syscalls on a 64-bit kernel. */
-typedef int		__kernel_ptrdiff_t32;
-typedef int		__kernel_clock_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 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;
 
 struct statfs32 {
 	int f_type;
@@ -68,7 +48,7 @@
 	int f_bavail;
 	int f_files;
 	int f_ffree;
-	__kernel_fsid_t32 f_fsid;
+	compat_fsid_t f_fsid;
 	int f_namelen;  /* SunOS ignores this field. */
 	int f_spare[6];
 };
@@ -88,8 +68,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 */
@@ -100,18 +80,18 @@
 
 		/* 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 */
-			__kernel_clock_t32 _utime;
-			__kernel_clock_t32 _stime;
+			compat_clock_t _utime;
+			compat_clock_t _stime;
 		} _sigchld;
 
 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
@@ -164,32 +144,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] Eliminate the rest of the __kernel_..._t32 typedefs 2/7 SPARC64
  2002-12-30  6:19 [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7 Stephen Rothwell
  2002-12-30  6:25 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 1/7 PPC64 Stephen Rothwell
@ 2002-12-30  6:31 ` Stephen Rothwell
  2002-12-30  6:33 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 3/7 X86_64 Stephen Rothwell
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-30  6:31 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel

Hi Dave,

SPARC64 specific stuff ...

I am not sure if I should be changing the sunos compatibility code
as will as the sparc32 code.  You may want another separate set of
types there.

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

diff -ruN 2.5.53/arch/sparc64/kernel/ioctl32.c 2.5.53-32bit.1/arch/sparc64/kernel/ioctl32.c
--- 2.5.53/arch/sparc64/kernel/ioctl32.c	2002-12-27 15:15:40.000000000 +1100
+++ 2.5.53-32bit.1/arch/sparc64/kernel/ioctl32.c	2002-12-30 15:41:34.000000000 +1100
@@ -450,13 +450,13 @@
                 struct  ifmap32 ifru_map;
                 char    ifru_slave[IFNAMSIZ];   /* Just fits the size */
 		char	ifru_newname[IFNAMSIZ];
-                __kernel_caddr_t32 ifru_data;
+                compat_caddr_t ifru_data;
         } ifr_ifru;
 };
 
 struct ifconf32 {
         int     ifc_len;                        /* size of buffer       */
-        __kernel_caddr_t32  ifcbuf;
+        compat_caddr_t  ifcbuf;
 };
 
 #ifdef CONFIG_NET
@@ -1009,7 +1009,7 @@
 
 struct fb_fix_screeninfo32 {
 	char			id[16];
-        __kernel_caddr_t32	smem_start;
+        compat_caddr_t	smem_start;
 	__u32			smem_len;
 	__u32			type;
 	__u32			type_aux;
@@ -1018,7 +1018,7 @@
 	__u16			ypanstep;
 	__u16			ywrapstep;
 	__u32			line_length;
-        __kernel_caddr_t32	mmio_start;
+        compat_caddr_t	mmio_start;
 	__u32			mmio_len;
 	__u32			accel;
 	__u16			reserved[3];
@@ -1027,10 +1027,10 @@
 struct fb_cmap32 {
 	__u32			start;
 	__u32			len;
-	__kernel_caddr_t32	red;
-	__kernel_caddr_t32	green;
-	__kernel_caddr_t32	blue;
-	__kernel_caddr_t32	transp;
+	compat_caddr_t	red;
+	compat_caddr_t	green;
+	compat_caddr_t	blue;
+	compat_caddr_t	transp;
 };
 
 static int fb_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
@@ -1169,7 +1169,7 @@
 	unsigned char	rate;
 	unsigned char	spec1;
 	unsigned char	fmt_gap;
-	const __kernel_caddr_t32 name;
+	const compat_caddr_t name;
 };
 
 struct floppy_drive_params32 {
@@ -1208,7 +1208,7 @@
 	int		fd_ref;
 	int		fd_device;
 	int		last_checked;
-	__kernel_caddr_t32 dmabuf;
+	compat_caddr_t dmabuf;
 	int		bufblocks;
 };
 
@@ -1732,7 +1732,7 @@
 }
 
 struct ppp_option_data32 {
-	__kernel_caddr_t32	ptr;
+	compat_caddr_t	ptr;
 	__u32			length;
 	int			transmit;
 };
@@ -1813,8 +1813,8 @@
 	__u32	mt_dsreg;
 	__u32	mt_gstat;
 	__u32	mt_erreg;
-	__kernel_daddr_t32	mt_fileno;
-	__kernel_daddr_t32	mt_blkno;
+	compat_daddr_t	mt_fileno;
+	compat_daddr_t	mt_blkno;
 };
 #define MTIOCGET32	_IOR('m', 2, struct mtget32)
 
@@ -1932,7 +1932,7 @@
 
 struct cdrom_read32 {
 	int			cdread_lba;
-	__kernel_caddr_t32	cdread_bufaddr;
+	compat_caddr_t	cdread_bufaddr;
 	int			cdread_buflen;
 };
 
@@ -1940,16 +1940,16 @@
 	union cdrom_addr	addr;
 	u_char			addr_format;
 	int			nframes;
-	__kernel_caddr_t32	buf;
+	compat_caddr_t	buf;
 };
 
 struct cdrom_generic_command32 {
 	unsigned char		cmd[CDROM_PACKET_SIZE];
-	__kernel_caddr_t32	buffer;
+	compat_caddr_t	buffer;
 	unsigned int		buflen;
 	int			stat;
-	__kernel_caddr_t32	sense;
-	__kernel_caddr_t32	reserved[3];
+	compat_caddr_t	sense;
+	compat_caddr_t	reserved[3];
 };
 
 static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
@@ -1958,7 +1958,7 @@
 	struct cdrom_read cdread;
 	struct cdrom_read_audio cdreadaudio;
 	struct cdrom_generic_command cgc;
-	__kernel_caddr_t32 addr;
+	compat_caddr_t addr;
 	char *data = 0;
 	void *karg;
 	int err = 0;
@@ -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;
 }
@@ -2256,7 +2256,7 @@
 struct ncp_ioctl_request_32 {
 	unsigned int function;
 	unsigned int size;
-	__kernel_caddr_t32 data;
+	compat_caddr_t data;
 };
 
 struct ncp_fs_info_v2_32 {
@@ -2277,13 +2277,13 @@
 {
 	int		auth_type;
 	unsigned int	object_name_len;
-	__kernel_caddr_t32	object_name;	/* an userspace data, in most cases user name */
+	compat_caddr_t	object_name;	/* an userspace data, in most cases user name */
 };
 
 struct ncp_privatedata_ioctl_32
 {
 	unsigned int	len;
-	__kernel_caddr_t32	data;		/* ~1000 for NDS */
+	compat_caddr_t	data;		/* ~1000 for NDS */
 };
 
 #define	NCP_IOC_NCPREQUEST_32		_IOR('n', 1, struct ncp_ioctl_request_32)
@@ -2557,12 +2557,12 @@
 struct atmif_sioc32 {
         int                number;
         int                length;
-        __kernel_caddr_t32 arg;
+        compat_caddr_t arg;
 };
 
 struct atm_iobuf32 {
 	int                length;
-	__kernel_caddr_t32 buffer;
+	compat_caddr_t buffer;
 };
 
 #define ATM_GETLINKRATE32 _IOW('a', ATMIOC_ITF+1, struct atmif_sioc32)
@@ -2623,7 +2623,7 @@
 
 	iobuf.length = iobuf32.length;
 
-	if (iobuf32.buffer == (__kernel_caddr_t32) NULL || iobuf32.length == 0) {
+	if (iobuf32.buffer == (compat_caddr_t) NULL || iobuf32.length == 0) {
 		iobuf.buffer = (void*)(unsigned long)iobuf32.buffer;
 	} else {
 		iobuf.buffer = kmalloc(iobuf.length, GFP_KERNEL);
@@ -2677,7 +2677,7 @@
         sioc.number = sioc32.number;
         sioc.length = sioc32.length;
         
-	if (sioc32.arg == (__kernel_caddr_t32) NULL || sioc32.length == 0) {
+	if (sioc32.arg == (compat_caddr_t) NULL || sioc32.length == 0) {
 		sioc.arg = (void*)(unsigned long)sioc32.arg;
         } else {
                 sioc.arg = kmalloc(sioc.length, GFP_KERNEL);
@@ -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;
 
@@ -5128,7 +5128,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.53/arch/sparc64/kernel/sunos_ioctl32.c 2.5.53-32bit.1/arch/sparc64/kernel/sunos_ioctl32.c
--- 2.5.53/arch/sparc64/kernel/sunos_ioctl32.c	2000-08-05 11:16:11.000000000 +1000
+++ 2.5.53-32bit.1/arch/sparc64/kernel/sunos_ioctl32.c	2002-12-30 15:40:52.000000000 +1100
@@ -22,6 +22,7 @@
 #include <linux/mm.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
+#include <linux/compat.h>
 #include <asm/kbio.h>
 
 /* Use this to get at 32-bit user passed pointers. */
@@ -80,13 +81,13 @@
                 int     ifru_mtu;
                 struct  ifmap32 ifru_map;
                 char    ifru_slave[IFNAMSIZ];   /* Just fits the size */
-                __kernel_caddr_t32 ifru_data;
+                compat_caddr_t ifru_data;
         } ifr_ifru;
 };
 
 struct ifconf32 {
         int     ifc_len;                        /* size of buffer       */
-        __kernel_caddr_t32  ifcbuf;
+        compat_caddr_t  ifcbuf;
 };
 
 extern asmlinkage int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
diff -ruN 2.5.53/arch/sparc64/kernel/sys_sparc32.c 2.5.53-32bit.1/arch/sparc64/kernel/sys_sparc32.c
--- 2.5.53/arch/sparc64/kernel/sys_sparc32.c	2002-12-27 15:15:40.000000000 +1100
+++ 2.5.53-32bit.1/arch/sparc64/kernel/sys_sparc32.c	2002-12-30 16:09:47.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;
 };
 
@@ -332,8 +332,8 @@
         unsigned short msg_cbytes;
         unsigned short msg_qnum;  
         unsigned short msg_qbytes;
-        __kernel_ipc_pid_t32 msg_lspid;
-        __kernel_ipc_pid_t32 msg_lrpid;
+        compat_ipc_pid_t msg_lspid;
+        compat_ipc_pid_t msg_lrpid;
 };
 
 struct msqid64_ds32 {
@@ -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;
 };
@@ -360,8 +360,8 @@
 	compat_time_t         shm_atime;
 	compat_time_t         shm_dtime;
 	compat_time_t         shm_ctime;
-	__kernel_ipc_pid_t32    shm_cpid; 
-	__kernel_ipc_pid_t32    shm_lpid; 
+	compat_ipc_pid_t    shm_cpid; 
+	compat_ipc_pid_t    shm_lpid; 
 	unsigned short          shm_nattch;
 };
 
@@ -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;
@@ -1401,6 +1401,9 @@
 {
 	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);
@@ -1435,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 {
@@ -1515,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)
@@ -1679,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);
@@ -1741,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;
@@ -3050,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;
 };
 
@@ -3199,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,
@@ -3213,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);
 }
@@ -3505,7 +3506,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;
@@ -3526,7 +3527,7 @@
 
 extern asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t *offset, size_t count);
 
-asmlinkage int sys32_sendfile64(int out_fd, int in_fd, __kernel_loff_t32 *offset, s32 count)
+asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -3760,7 +3761,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;
@@ -3784,7 +3785,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.53/arch/sparc64/kernel/sys_sunos32.c 2.5.53-32bit.1/arch/sparc64/kernel/sys_sunos32.c
--- 2.5.53/arch/sparc64/kernel/sys_sunos32.c	2002-12-10 15:10:17.000000000 +1100
+++ 2.5.53-32bit.1/arch/sparc64/kernel/sys_sunos32.c	2002-12-30 13:29:41.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;
 };
 
@@ -952,8 +952,8 @@
         unsigned short msg_cbytes;
         unsigned short msg_qnum;  
         unsigned short msg_qbytes;
-        __kernel_ipc_pid_t32 msg_lspid;
-        __kernel_ipc_pid_t32 msg_lrpid;
+        compat_ipc_pid_t msg_lspid;
+        compat_ipc_pid_t msg_lrpid;
 };
 
 static inline int sunos_msqid_get(struct msqid_ds32 *user,
@@ -1084,8 +1084,8 @@
         compat_time_t         shm_atime;
         compat_time_t         shm_dtime;
         compat_time_t         shm_ctime;
-        __kernel_ipc_pid_t32    shm_cpid; 
-        __kernel_ipc_pid_t32    shm_lpid; 
+        compat_ipc_pid_t    shm_cpid; 
+        compat_ipc_pid_t    shm_lpid; 
         unsigned short          shm_nattch;
 };
                                                         
diff -ruN 2.5.53/include/asm-sparc64/compat.h 2.5.53-32bit.1/include/asm-sparc64/compat.h
--- 2.5.53/include/asm-sparc64/compat.h	2002-12-27 15:16:02.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-sparc64/compat.h	2002-12-30 16:26:50.000000000 +1100
@@ -5,32 +5,25 @@
  */
 #include <linux/types.h>
 
-#define COMPAT_USER_HZ 100
+#define COMPAT_USER_HZ	100
 
 typedef u32		compat_size_t;
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
 typedef s32		compat_clock_t;
-
-struct compat_stat {
-	__kernel_dev_t32	st_dev;
-	__kernel_ino_t32	st_ino;
-	__kernel_mode_t32	st_mode;
-	s16			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;
-	u32			__unused1;
-	compat_time_t		st_mtime;
-	u32			__unused2;
-	compat_time_t		st_ctime;
-	u32			__unused3;
-	__kernel_off_t32	st_blksize;
-	__kernel_off_t32	st_blocks;
-	u32			__unused4[2];
-};
+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 s64		compat_loff_t;
+typedef s16		compat_nlink_t;
+typedef u16		compat_ipc_pid_t;
+typedef s32		compat_daddr_t;
+typedef u32		compat_caddr_t;
+typedef __kernel_fsid_t	compat_fsid_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
@@ -42,4 +35,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.53/include/asm-sparc64/fcntl.h 2.5.53-32bit.1/include/asm-sparc64/fcntl.h
--- 2.5.53/include/asm-sparc64/fcntl.h	2001-09-21 07:11:58.000000000 +1000
+++ 2.5.53-32bit.1/include/asm-sparc64/fcntl.h	2002-12-16 14:51:53.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.53/include/asm-sparc64/posix_types.h 2.5.53-32bit.1/include/asm-sparc64/posix_types.h
--- 2.5.53/include/asm-sparc64/posix_types.h	2002-12-27 15:16:02.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-sparc64/posix_types.h	2002-12-30 16:25:40.000000000 +1100
@@ -47,23 +47,6 @@
 #endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
 } __kernel_fsid_t;
 
-/* Now 32bit compatibility types */
-typedef int                    __kernel_ptrdiff_t32;
-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;
-
 #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
 
 #undef __FD_SET
diff -ruN 2.5.53/include/asm-sparc64/siginfo.h 2.5.53-32bit.1/include/asm-sparc64/siginfo.h
--- 2.5.53/include/asm-sparc64/siginfo.h	2002-12-27 15:16:02.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-sparc64/siginfo.h	2002-12-16 14:51:53.000000000 +1100
@@ -13,7 +13,7 @@
 
 #ifdef __KERNEL__
 
-#include <asm/compat.h>
+#include <linux/compat.h>
 
 typedef union sigval32 {
 	int sival_int;
@@ -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.53/include/asm-sparc64/statfs.h 2.5.53-32bit.1/include/asm-sparc64/statfs.h
--- 2.5.53/include/asm-sparc64/statfs.h	1997-04-24 12:01:28.000000000 +1000
+++ 2.5.53-32bit.1/include/asm-sparc64/statfs.h	2002-12-30 16:26:43.000000000 +1100
@@ -5,6 +5,7 @@
 #ifndef __KERNEL_STRICT_NAMES
 
 #include <linux/types.h>
+#include <linux/compat.h>	/* for compat_fsid_t */
 
 typedef __kernel_fsid_t	fsid_t;
 
@@ -18,7 +19,7 @@
 	int f_bavail;
 	int f_files;
 	int f_ffree;
-	__kernel_fsid_t32 f_fsid;
+	compat_fsid_t f_fsid;
 	int f_namelen;  /* SunOS ignores this field. */
 	int f_spare[6];
 };

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

* [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 3/7 X86_64
  2002-12-30  6:19 [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7 Stephen Rothwell
  2002-12-30  6:25 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 1/7 PPC64 Stephen Rothwell
  2002-12-30  6:31 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 2/7 SPARC64 Stephen Rothwell
@ 2002-12-30  6:33 ` Stephen Rothwell
  2002-12-30  6:35 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 4/7 IA64 Stephen Rothwell
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-30  6:33 UTC (permalink / raw)
  To: ak; +Cc: linux-kernel

Hi Andi,

X86_64 specific stuff ...

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

diff -ruN 2.5.53/arch/x86_64/ia32/ia32_ioctl.c 2.5.53-32bit.1/arch/x86_64/ia32/ia32_ioctl.c
--- 2.5.53/arch/x86_64/ia32/ia32_ioctl.c	2002-12-27 15:15:41.000000000 +1100
+++ 2.5.53-32bit.1/arch/x86_64/ia32/ia32_ioctl.c	2002-12-30 15:42:35.000000000 +1100
@@ -450,13 +450,13 @@
                 struct  ifmap32 ifru_map;
                 char    ifru_slave[IFNAMSIZ];   /* Just fits the size */
 		char	ifru_newname[IFNAMSIZ];
-                __kernel_caddr_t32 ifru_data;
+                compat_caddr_t ifru_data;
         } ifr_ifru;
 };
 
 struct ifconf32 {
         int     ifc_len;                        /* size of buffer       */
-        __kernel_caddr_t32  ifcbuf;
+        compat_caddr_t  ifcbuf;
 };
 
 #ifdef CONFIG_NET
@@ -876,7 +876,7 @@
 
 struct fb_fix_screeninfo32 {
 	char			id[16];
-        __kernel_caddr_t32	smem_start;
+        compat_caddr_t	smem_start;
 	__u32			smem_len;
 	__u32			type;
 	__u32			type_aux;
@@ -885,7 +885,7 @@
 	__u16			ypanstep;
 	__u16			ywrapstep;
 	__u32			line_length;
-        __kernel_caddr_t32	mmio_start;
+        compat_caddr_t	mmio_start;
 	__u32			mmio_len;
 	__u32			accel;
 	__u16			reserved[3];
@@ -894,10 +894,10 @@
 struct fb_cmap32 {
 	__u32			start;
 	__u32			len;
-	__kernel_caddr_t32	red;
-	__kernel_caddr_t32	green;
-	__kernel_caddr_t32	blue;
-	__kernel_caddr_t32	transp;
+	compat_caddr_t	red;
+	compat_caddr_t	green;
+	compat_caddr_t	blue;
+	compat_caddr_t	transp;
 };
 
 static int fb_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
@@ -1036,7 +1036,7 @@
 	unsigned char	rate;
 	unsigned char	spec1;
 	unsigned char	fmt_gap;
-	const __kernel_caddr_t32 name;
+	const compat_caddr_t name;
 };
 
 struct floppy_drive_params32 {
@@ -1075,7 +1075,7 @@
 	int		fd_ref;
 	int		fd_device;
 	int		last_checked;
-	__kernel_caddr_t32 dmabuf;
+	compat_caddr_t dmabuf;
 	int		bufblocks;
 };
 
@@ -1600,7 +1600,7 @@
 }
 
 struct ppp_option_data32 {
-	__kernel_caddr_t32	ptr;
+	compat_caddr_t	ptr;
 	__u32			length;
 	int			transmit;
 };
@@ -1681,8 +1681,8 @@
 	__u32	mt_dsreg;
 	__u32	mt_gstat;
 	__u32	mt_erreg;
-	__kernel_daddr_t32	mt_fileno;
-	__kernel_daddr_t32	mt_blkno;
+	compat_daddr_t	mt_fileno;
+	compat_daddr_t	mt_blkno;
 };
 #define MTIOCGET32	_IOR('m', 2, struct mtget32)
 
@@ -1800,7 +1800,7 @@
 
 struct cdrom_read32 {
 	int			cdread_lba;
-	__kernel_caddr_t32	cdread_bufaddr;
+	compat_caddr_t	cdread_bufaddr;
 	int			cdread_buflen;
 };
 
@@ -1808,16 +1808,16 @@
 	union cdrom_addr	addr;
 	u_char			addr_format;
 	int			nframes;
-	__kernel_caddr_t32	buf;
+	compat_caddr_t	buf;
 };
 
 struct cdrom_generic_command32 {
 	unsigned char		cmd[CDROM_PACKET_SIZE];
-	__kernel_caddr_t32	buffer;
+	compat_caddr_t	buffer;
 	unsigned int		buflen;
 	int			stat;
-	__kernel_caddr_t32	sense;
-	__kernel_caddr_t32	reserved[3];
+	compat_caddr_t	sense;
+	compat_caddr_t	reserved[3];
 };
 
 static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
@@ -1826,7 +1826,7 @@
 	struct cdrom_read cdread;
 	struct cdrom_read_audio cdreadaudio;
 	struct cdrom_generic_command cgc;
-	__kernel_caddr_t32 addr;
+	compat_caddr_t addr;
 	char *data = 0;
 	void *karg;
 	int err = 0;
@@ -2124,12 +2124,12 @@
 struct atmif_sioc32 {
         int                number;
         int                length;
-        __kernel_caddr_t32 arg;
+        compat_caddr_t arg;
 };
 
 struct atm_iobuf32 {
 	int                length;
-	__kernel_caddr_t32 buffer;
+	compat_caddr_t buffer;
 };
 
 #define ATM_GETLINKRATE32 _IOW('a', ATMIOC_ITF+1, struct atmif_sioc32)
@@ -2190,7 +2190,7 @@
 
 	iobuf.length = iobuf32.length;
 
-	if (iobuf32.buffer == (__kernel_caddr_t32) NULL || iobuf32.length == 0) {
+	if (iobuf32.buffer == (compat_caddr_t) NULL || iobuf32.length == 0) {
 		iobuf.buffer = (void*)(unsigned long)iobuf32.buffer;
 	} else {
 		iobuf.buffer = kmalloc(iobuf.length, GFP_KERNEL);
@@ -2244,7 +2244,7 @@
         sioc.number = sioc32.number;
         sioc.length = sioc32.length;
         
-	if (sioc32.arg == (__kernel_caddr_t32) NULL || sioc32.length == 0) {
+	if (sioc32.arg == (compat_caddr_t) NULL || sioc32.length == 0) {
 		sioc.arg = (void*)(unsigned long)sioc32.arg;
         } else {
                 sioc.arg = kmalloc(sioc.length, GFP_KERNEL);
diff -ruN 2.5.53/arch/x86_64/ia32/ipc32.c 2.5.53-32bit.1/arch/x86_64/ia32/ipc32.c
--- 2.5.53/arch/x86_64/ia32/ipc32.c	2002-12-27 15:15:41.000000000 +1100
+++ 2.5.53-32bit.1/arch/x86_64/ia32/ipc32.c	2002-12-30 16:33:41.000000000 +1100
@@ -40,10 +40,10 @@
 
 struct ipc64_perm32 {
         unsigned key;
-	__kernel_uid32_t32 uid;
-	__kernel_gid32_t32 gid;
-	__kernel_uid32_t32 cuid;
-	__kernel_gid32_t32 cgid;
+	compat_uid32_t uid;
+	compat_gid32_t gid;
+	compat_uid32_t cuid;
+	compat_gid32_t cgid;
 	unsigned short mode;
 	unsigned short __pad1;
 	unsigned short seq;
@@ -86,8 +86,8 @@
 	unsigned short msg_cbytes;
 	unsigned short msg_qnum;
 	unsigned short msg_qbytes;
-	__kernel_ipc_pid_t32 msg_lspid;
-	__kernel_ipc_pid_t32 msg_lrpid;
+	compat_ipc_pid_t msg_lspid;
+	compat_ipc_pid_t msg_lrpid;
 };
 
 struct msqid64_ds32 {
@@ -113,8 +113,8 @@
 	compat_time_t shm_atime;
 	compat_time_t shm_dtime;
 	compat_time_t shm_ctime;
-	__kernel_ipc_pid_t32 shm_cpid;
-	__kernel_ipc_pid_t32 shm_lpid;
+	compat_ipc_pid_t shm_cpid;
+	compat_ipc_pid_t shm_lpid;
 	unsigned short shm_nattch;
 };
 
diff -ruN 2.5.53/include/asm-x86_64/compat.h 2.5.53-32bit.1/include/asm-x86_64/compat.h
--- 2.5.53/include/asm-x86_64/compat.h	2002-12-27 15:16:02.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-x86_64/compat.h	2002-12-30 16:32:03.000000000 +1100
@@ -10,16 +10,22 @@
 typedef u32		compat_size_t;
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
-typedef s32		compat_suseconds_t;
 typedef s32		compat_clock_t;
 typedef s32		compat_pid_t;
 typedef u16		compat_uid_t;
 typedef u16		compat_gid_t;
+typedef u32		compat_uid32_t;
+typedef u32		compat_gid32_t;
 typedef u16		compat_mode_t;
 typedef u32		compat_ino_t;
 typedef u16		compat_dev_t;
 typedef s32		compat_off_t;
+typedef s64		compat_loff_t;
 typedef u16		compat_nlink_t;
+typedef u16		compat_ipc_pid_t;
+typedef s32		compat_daddr_t;
+typedef u32		compat_caddr_t;
+typedef __kernel_fsid_t	compat_fsid_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
diff -ruN 2.5.53/include/asm-x86_64/ia32.h 2.5.53-32bit.1/include/asm-x86_64/ia32.h
--- 2.5.53/include/asm-x86_64/ia32.h	2002-12-27 15:16:02.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-x86_64/ia32.h	2002-12-30 16:32:19.000000000 +1100
@@ -11,17 +11,6 @@
  * 32 bit structures for IA32 support.
  */
 
-/* 32bit compatibility types */
-typedef unsigned short	       __kernel_ipc_pid_t32;
-typedef unsigned 				__kernel_uid32_t32;
-typedef unsigned 				__kernel_gid32_t32;
-typedef unsigned short	       __kernel_umode_t32;
-typedef int		       __kernel_daddr_t32;
-typedef unsigned int	       __kernel_caddr_t32;
-typedef long		       __kernel_loff_t32;
-typedef __kernel_fsid_t	       __kernel_fsid_t32;
-
-
 /* fcntl.h */
 struct flock32 {
        short l_type;
@@ -130,7 +119,7 @@
        int f_bavail;
        int f_files;
        int f_ffree;
-       __kernel_fsid_t32 f_fsid;
+       compat_fsid_t f_fsid;
        int f_namelen;  /* SunOS ignores this field. */
        int f_spare[6];
 };

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

* [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 4/7 IA64
  2002-12-30  6:19 [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7 Stephen Rothwell
                   ` (2 preceding siblings ...)
  2002-12-30  6:33 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 3/7 X86_64 Stephen Rothwell
@ 2002-12-30  6:35 ` Stephen Rothwell
  2002-12-30  6:38 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7 Stephen Rothwell
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-30  6:35 UTC (permalink / raw)
  To: davidm; +Cc: linux-kernel

Hi David,

IA64 specific stuff ...

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

diff -ruN 2.5.53/arch/ia64/ia32/sys_ia32.c 2.5.53-32bit.1/arch/ia64/ia32/sys_ia32.c
--- 2.5.53/arch/ia64/ia32/sys_ia32.c	2002-12-27 15:15:38.000000000 +1100
+++ 2.5.53-32bit.1/arch/ia64/ia32/sys_ia32.c	2002-12-30 16:33:33.000000000 +1100
@@ -1848,10 +1848,10 @@
 
 struct ipc64_perm32 {
 	key_t key;
-	__kernel_uid32_t32 uid;
-	__kernel_gid32_t32 gid;
-	__kernel_uid32_t32 cuid;
-	__kernel_gid32_t32 cgid;
+	compat_uid32_t uid;
+	compat_gid32_t gid;
+	compat_uid32_t cuid;
+	compat_gid32_t cgid;
 	compat_mode_t mode;
 	unsigned short __pad1;
 	unsigned short seq;
@@ -1894,8 +1894,8 @@
 	unsigned short msg_cbytes;
 	unsigned short msg_qnum;
 	unsigned short msg_qbytes;
-	__kernel_ipc_pid_t32 msg_lspid;
-	__kernel_ipc_pid_t32 msg_lrpid;
+	compat_ipc_pid_t msg_lspid;
+	compat_ipc_pid_t msg_lrpid;
 };
 
 struct msqid64_ds32 {
@@ -1921,8 +1921,8 @@
 	compat_time_t   shm_atime;
 	compat_time_t   shm_dtime;
 	compat_time_t   shm_ctime;
-	__kernel_ipc_pid_t32 shm_cpid;
-	__kernel_ipc_pid_t32 shm_lpid;
+	compat_ipc_pid_t shm_cpid;
+	compat_ipc_pid_t shm_lpid;
 	unsigned short shm_nattch;
 };
 
diff -ruN 2.5.53/include/asm-ia64/compat.h 2.5.53-32bit.1/include/asm-ia64/compat.h
--- 2.5.53/include/asm-ia64/compat.h	2002-12-27 15:15:58.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-ia64/compat.h	2002-12-30 16:31:12.000000000 +1100
@@ -14,11 +14,18 @@
 typedef s32		compat_pid_t;
 typedef u16		compat_uid_t;
 typedef u16		compat_gid_t;
+typedef u32		compat_uid32_t;
+typedef u32		compat_gid32_t;
 typedef u16		compat_mode_t;
 typedef u32		compat_ino_t;
 typedef u16		compat_dev_t;
 typedef s32		compat_off_t;
+typedef s64		compat_loff_t;
 typedef u16		compat_nlink_t;
+typedef u16		compat_ipc_pid_t;
+typedef s32		compat_daddr_t;
+typedef u32		compat_caddr_t;
+typedef __kernel_fsid_t	compat_fsid_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
diff -ruN 2.5.53/include/asm-ia64/ia32.h 2.5.53-32bit.1/include/asm-ia64/ia32.h
--- 2.5.53/include/asm-ia64/ia32.h	2002-12-27 15:15:58.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-ia64/ia32.h	2002-12-30 16:31:36.000000000 +1100
@@ -12,17 +12,6 @@
  * 32 bit structures for IA32 support.
  */
 
-/* 32bit compatibility types */
-typedef unsigned short	__kernel_ipc_pid_t32;
-typedef unsigned int	__kernel_uid32_t32;
-typedef unsigned int	__kernel_gid32_t32;
-typedef unsigned short	__kernel_umode_t32;
-typedef short		__kernel_nlink_t32;
-typedef int		__kernel_daddr_t32;
-typedef unsigned int	__kernel_caddr_t32;
-typedef long		__kernel_loff_t32;
-typedef __kernel_fsid_t	__kernel_fsid_t32;
-
 #define IA32_PAGE_SHIFT		12	/* 4KB pages */
 #define IA32_PAGE_SIZE		(1UL << IA32_PAGE_SHIFT)
 #define IA32_PAGE_MASK		(~(IA32_PAGE_SIZE - 1))
@@ -231,7 +220,7 @@
        int f_bavail;
        int f_files;
        int f_ffree;
-       __kernel_fsid_t32 f_fsid;
+       compat_fsid_t f_fsid;
        int f_namelen;  /* SunOS ignores this field. */
        int f_spare[6];
 };

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

* Re: [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7
  2002-12-30  6:19 [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7 Stephen Rothwell
                   ` (3 preceding siblings ...)
  2002-12-30  6:35 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 4/7 IA64 Stephen Rothwell
@ 2002-12-30  6:38 ` Stephen Rothwell
  2002-12-30  6:41   ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 5/7 S390X Stephen Rothwell
  2002-12-30  6:43 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 6/7 MIPS64 Stephen Rothwell
  2002-12-30  6:46 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 7/7 PARISC Stephen Rothwell
  6 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-30  6:38 UTC (permalink / raw)
  To: schwidefsky; +Cc: linux-kernel

Hi Martin,

S390X specific stuff ...

This is basically the whole compatibility syscall infrastructure.
Are there parts of this that I can merge directly to Linus?

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

diff -ruN 2.5.53/arch/s390x/Kconfig 2.5.53-32bit.1/arch/s390x/Kconfig
--- 2.5.53/arch/s390x/Kconfig	2002-12-10 15:10:17.000000000 +1100
+++ 2.5.53-32bit.1/arch/s390x/Kconfig	2002-12-16 14:51:53.000000000 +1100
@@ -92,6 +92,11 @@
 	  (and some other stuff like libraries and such) is needed for
 	  executing 31 bit applications.  It is safe to say "Y".
 
+config COMPAT
+	bool
+	depends on S390_SUPPORT
+	default y
+
 config BINFMT_ELF32
 	tristate "Kernel support for 31 bit ELF binaries"
 	depends on S390_SUPPORT
diff -ruN 2.5.53/arch/s390x/kernel/binfmt_elf32.c 2.5.53-32bit.1/arch/s390x/kernel/binfmt_elf32.c
--- 2.5.53/arch/s390x/kernel/binfmt_elf32.c	2002-09-01 12:00:02.000000000 +1000
+++ 2.5.53-32bit.1/arch/s390x/kernel/binfmt_elf32.c	2002-12-16 14:51:53.000000000 +1100
@@ -115,14 +115,10 @@
 #include <linux/config.h>
 #include <linux/elfcore.h>
 #include <linux/binfmts.h>
+#include <linux/compat.h>
 
 int setup_arg_pages32(struct linux_binprm *bprm);
 
-struct timeval32
-{
-    int tv_sec, tv_usec;
-};
-
 #define elf_prstatus elf_prstatus32
 struct elf_prstatus32
 {
@@ -134,10 +130,10 @@
 	pid_t	pr_ppid;
 	pid_t	pr_pgrp;
 	pid_t	pr_sid;
-	struct timeval32 pr_utime;	/* User time */
-	struct timeval32 pr_stime;	/* System time */
-	struct timeval32 pr_cutime;	/* Cumulative user time */
-	struct timeval32 pr_cstime;	/* Cumulative system time */
+	struct compat_timeval pr_utime;	/* User time */
+	struct compat_timeval pr_stime;	/* System time */
+	struct compat_timeval pr_cutime;	/* Cumulative user time */
+	struct compat_timeval pr_cstime;	/* Cumulative system time */
 	elf_gregset_t pr_reg;	/* GP registers */
 	int pr_fpvalid;		/* True if math co-processor being used.  */
 };
diff -ruN 2.5.53/arch/s390x/kernel/entry.S 2.5.53-32bit.1/arch/s390x/kernel/entry.S
--- 2.5.53/arch/s390x/kernel/entry.S	2002-12-16 14:49:47.000000000 +1100
+++ 2.5.53-32bit.1/arch/s390x/kernel/entry.S	2002-12-16 14:51:53.000000000 +1100
@@ -421,7 +421,7 @@
         .long  SYSCALL(sys_alarm,sys32_alarm_wrapper)
         .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old fstat syscall */
         .long  SYSCALL(sys_pause,sys32_pause)
-        .long  SYSCALL(sys_utime,sys32_utime_wrapper)           /* 30 */
+        .long  SYSCALL(sys_utime,compat_sys_utime_wrapper)           /* 30 */
         .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old stty syscall */
         .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old gtty syscall */
         .long  SYSCALL(sys_access,sys32_access_wrapper)
@@ -434,7 +434,7 @@
         .long  SYSCALL(sys_rmdir,sys32_rmdir_wrapper)           /* 40 */
         .long  SYSCALL(sys_dup,sys32_dup_wrapper)
         .long  SYSCALL(sys_pipe,sys32_pipe_wrapper)
-        .long  SYSCALL(sys_times,sys32_times_wrapper)
+        .long  SYSCALL(sys_times,compat_sys_times_wrapper)
         .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old prof syscall */
         .long  SYSCALL(sys_brk,sys32_brk_wrapper)               /* 45 */
         .long  SYSCALL(sys_ni_syscall,sys32_setgid16)   /* old setgid16 syscall*/
@@ -495,11 +495,11 @@
         .long  SYSCALL(sys_ni_syscall,sys_ni_syscall)
         .long  SYSCALL(sys_socketcall,sys32_socketcall_wrapper)
         .long  SYSCALL(sys_syslog,sys32_syslog_wrapper)
-        .long  SYSCALL(sys_setitimer,sys32_setitimer_wrapper)
-        .long  SYSCALL(sys_getitimer,sys32_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_setitimer,compat_sys_setitimer_wrapper)
+        .long  SYSCALL(sys_getitimer,compat_sys_getitimer_wrapper)   /* 105 */
+        .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)
@@ -553,7 +553,7 @@
         .long  SYSCALL(sys_sched_get_priority_max,sys32_sched_get_priority_max_wrapper)
         .long  SYSCALL(sys_sched_get_priority_min,sys32_sched_get_priority_min_wrapper)
         .long  SYSCALL(sys_sched_rr_get_interval,sys32_sched_rr_get_interval_wrapper)
-        .long  SYSCALL(sys_nanosleep,sys32_nanosleep_wrapper)
+        .long  SYSCALL(sys_nanosleep,compat_sys_nanosleep_wrapper)
         .long  SYSCALL(sys_mremap,sys32_mremap_wrapper)
         .long  SYSCALL(sys_ni_syscall,sys32_setresuid16_wrapper) /* old setresuid16 syscall */
         .long  SYSCALL(sys_ni_syscall,sys32_getresuid16_wrapper) /* old getresuid16 syscall */
diff -ruN 2.5.53/arch/s390x/kernel/ioctl32.c 2.5.53-32bit.1/arch/s390x/kernel/ioctl32.c
--- 2.5.53/arch/s390x/kernel/ioctl32.c	2002-11-28 10:34:42.000000000 +1100
+++ 2.5.53-32bit.1/arch/s390x/kernel/ioctl32.c	2002-12-16 14:51:53.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>
@@ -70,11 +71,6 @@
 	return ret;
 }
 
-struct timeval32 {
-	int tv_sec;
-	int tv_usec;
-};
-
 #define EXT2_IOC32_GETFLAGS               _IOR('f', 1, int)
 #define EXT2_IOC32_SETFLAGS               _IOW('f', 2, int)
 #define EXT2_IOC32_GETVERSION             _IOR('v', 1, int)
@@ -383,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.53/arch/s390x/kernel/linux32.c 2.5.53-32bit.1/arch/s390x/kernel/linux32.c
--- 2.5.53/arch/s390x/kernel/linux32.c	2002-11-28 10:34:42.000000000 +1100
+++ 2.5.53-32bit.1/arch/s390x/kernel/linux32.c	2002-12-30 16:09:33.000000000 +1100
@@ -22,7 +22,6 @@
 #include <linux/mm.h> 
 #include <linux/file.h> 
 #include <linux/signal.h>
-#include <linux/utime.h>
 #include <linux/resource.h>
 #include <linux/times.h>
 #include <linux/utsname.h>
@@ -57,6 +56,7 @@
 #include <linux/icmpv6.h>
 #include <linux/sysctl.h>
 #include <linux/binfmts.h>
+#include <linux/compat.h>
 
 #include <asm/types.h>
 #include <asm/ipc.h>
@@ -245,49 +245,20 @@
 
 /* 32-bit timeval and related flotsam.  */
 
-struct timeval32
-{
-    int tv_sec, tv_usec;
-};
-
-struct itimerval32
-{
-    struct timeval32 it_interval;
-    struct timeval32 it_value;
-};
-
-static inline long get_tv32(struct timeval *o, struct timeval32 *i)
+static inline long get_tv32(struct timeval *o, struct compat_timeval *i)
 {
 	return (!access_ok(VERIFY_READ, tv32, sizeof(*tv32)) ||
 		(__get_user(o->tv_sec, &i->tv_sec) |
 		 __get_user(o->tv_usec, &i->tv_usec)));
 }
 
-static inline long put_tv32(struct timeval32 *o, struct timeval *i)
+static inline long put_tv32(struct compat_timeval *o, struct timeval *i)
 {
 	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
 		(__put_user(i->tv_sec, &o->tv_sec) |
 		 __put_user(i->tv_usec, &o->tv_usec)));
 }
 
-static inline long get_it32(struct itimerval *o, struct itimerval32 *i)
-{
-	return (!access_ok(VERIFY_READ, i32, sizeof(*i32)) ||
-		(__get_user(o->it_interval.tv_sec, &i->it_interval.tv_sec) |
-		 __get_user(o->it_interval.tv_usec, &i->it_interval.tv_usec) |
-		 __get_user(o->it_value.tv_sec, &i->it_value.tv_sec) |
-		 __get_user(o->it_value.tv_usec, &i->it_value.tv_usec)));
-}
-
-static inline long put_it32(struct itimerval32 *o, struct itimerval *i)
-{
-	return (!access_ok(VERIFY_WRITE, i32, sizeof(*i32)) ||
-		(__put_user(i->it_interval.tv_sec, &o->it_interval.tv_sec) |
-		 __put_user(i->it_interval.tv_usec, &o->it_interval.tv_usec) |
-		 __put_user(i->it_value.tv_sec, &o->it_value.tv_sec) |
-		 __put_user(i->it_value.tv_usec, &o->it_value.tv_usec)));
-}
-
 struct msgbuf32 { s32 mtype; char mtext[1]; };
 
 struct ipc64_perm_ds32
@@ -297,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;
@@ -308,18 +279,18 @@
 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;
 };
 
 struct semid_ds32 {
         struct ipc_perm32 sem_perm;               /* permissions .. see ipc.h */
-        __kernel_time_t32 sem_otime;              /* last semop time */
-        __kernel_time_t32 sem_ctime;              /* last change time */
+        compat_time_t   sem_otime;              /* last semop time */
+        compat_time_t   sem_ctime;              /* last change time */
         u32 sem_base;              /* ptr to first semaphore in array */
         u32 sem_pending;          /* pending operations to be processed */
         u32 sem_pending_last;    /* last pending operation */
@@ -330,9 +301,9 @@
 struct semid64_ds32 {
 	struct ipc64_perm_ds32 sem_perm;
 	unsigned int	  __pad1;
-	__kernel_time_t32 sem_otime;
+	compat_time_t   sem_otime;
 	unsigned int	  __pad2;
-	__kernel_time_t32 sem_ctime;
+	compat_time_t   sem_ctime;
 	u32 sem_nsems;
 	u32 __unused1;
 	u32 __unused2;
@@ -343,31 +314,31 @@
         struct ipc_perm32 msg_perm;
         u32 msg_first;
         u32 msg_last;
-        __kernel_time_t32 msg_stime;
-        __kernel_time_t32 msg_rtime;
-        __kernel_time_t32 msg_ctime;
+        compat_time_t   msg_stime;
+        compat_time_t   msg_rtime;
+        compat_time_t   msg_ctime;
         u32 wwait;
         u32 rwait;
         unsigned short msg_cbytes;
         unsigned short msg_qnum;  
         unsigned short msg_qbytes;
-        __kernel_ipc_pid_t32 msg_lspid;
-        __kernel_ipc_pid_t32 msg_lrpid;
+        compat_ipc_pid_t msg_lspid;
+        compat_ipc_pid_t msg_lrpid;
 };
 
 struct msqid64_ds32 {
 	struct ipc64_perm_ds32 msg_perm;
 	unsigned int   __pad1;
-	__kernel_time_t32 msg_stime;
+	compat_time_t msg_stime;
 	unsigned int   __pad2;
-	__kernel_time_t32 msg_rtime;
+	compat_time_t msg_rtime;
 	unsigned int   __pad3;
-	__kernel_time_t32 msg_ctime;
+	compat_time_t msg_ctime;
 	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;
 };
@@ -376,25 +347,25 @@
 struct shmid_ds32 {
 	struct ipc_perm32       shm_perm;
 	int                     shm_segsz;
-	__kernel_time_t32       shm_atime;
-	__kernel_time_t32       shm_dtime;
-	__kernel_time_t32       shm_ctime;
-	__kernel_ipc_pid_t32    shm_cpid; 
-	__kernel_ipc_pid_t32    shm_lpid; 
+	compat_time_t         shm_atime;
+	compat_time_t         shm_dtime;
+	compat_time_t         shm_ctime;
+	compat_ipc_pid_t    shm_cpid; 
+	compat_ipc_pid_t    shm_lpid; 
 	unsigned short          shm_nattch;
 };
 
 struct shmid64_ds32 {
 	struct ipc64_perm_ds32	shm_perm;
-	__kernel_size_t32	shm_segsz;
-	__kernel_time_t32	shm_atime;
+	compat_size_t	shm_segsz;
+	compat_time_t  	shm_atime;
 	unsigned int		__unused1;
-	__kernel_time_t32	shm_dtime;
+	compat_time_t  	shm_dtime;
 	unsigned int		__unused2;
-	__kernel_time_t32	shm_ctime;
+	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;
@@ -1010,37 +981,7 @@
 		return sys_ftruncate(fd, (high << 32) | low);
 }
 
-extern asmlinkage int sys_utime(char * filename, struct utimbuf * times);
-
-struct utimbuf32 {
-	__kernel_time_t32 actime, modtime;
-};
-
-asmlinkage int sys32_utime(char * filename, struct utimbuf32 *times)
-{
-	struct utimbuf t;
-	mm_segment_t old_fs;
-	int ret;
-	char *filenam;
-	
-	if (!times)
-		return sys_utime(filename, NULL);
-	if (get_user (t.actime, &times->actime) ||
-	    __get_user (t.modtime, &times->modtime))
-		return -EFAULT;
-	filenam = getname (filename);
-	ret = PTR_ERR(filenam);
-	if (!IS_ERR(filenam)) {
-		old_fs = get_fs();
-		set_fs (KERNEL_DS); 
-		ret = sys_utime(filenam, &t);
-		set_fs (old_fs);
-		putname (filenam);
-	}
-	return ret;
-}
-
-struct iovec32 { u32 iov_base; __kernel_size_t32 iov_len; };
+struct iovec32 { u32 iov_base; compat_size_t iov_len; };
 
 typedef ssize_t (*io_fn_t)(struct file *, char *, size_t, loff_t *);
 typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long, loff_t *);
@@ -1363,7 +1304,7 @@
 asmlinkage int sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, u32 tvp_x)
 {
 	fd_set_bits fds;
-	struct timeval32 *tvp = (struct timeval32 *)AA(tvp_x);
+	struct compat_timeval *tvp = (struct compat_timeval *)AA(tvp_x);
 	char *bits;
 	unsigned long nn;
 	long timeout;
@@ -1452,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;
 
@@ -1479,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)
@@ -1522,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)
@@ -1551,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)
@@ -1671,8 +1579,8 @@
 }
 
 struct rusage32 {
-        struct timeval32 ru_utime;
-        struct timeval32 ru_stime;
+        struct compat_timeval ru_utime;
+        struct compat_timeval ru_stime;
         s32    ru_maxrss;
         s32    ru_ixrss;
         s32    ru_idrss;
@@ -1714,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);
@@ -1774,14 +1682,10 @@
 	return ret;
 }
 
-struct timespec32 {
-	s32    tv_sec;
-	s32    tv_nsec;
-};
-                
 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 timespec32 *interval)
+asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
+		struct compat_timespec *interval)
 {
 	struct timespec t;
 	int ret;
@@ -1796,28 +1700,6 @@
 	return ret;
 }
 
-extern asmlinkage int sys_nanosleep(struct timespec *rqtp, struct timespec *rmtp);
-
-asmlinkage int sys32_nanosleep(struct timespec32 *rqtp, struct timespec32 *rmtp)
-{
-	struct timespec t;
-	int ret;
-	mm_segment_t old_fs = get_fs ();
-	
-	if (get_user (t.tv_sec, &rqtp->tv_sec) ||
-	    __get_user (t.tv_nsec, &rqtp->tv_nsec))
-		return -EFAULT;
-	set_fs (KERNEL_DS);
-	ret = sys_nanosleep(&t, rmtp ? &t : NULL);
-	set_fs (old_fs);
-	if (rmtp && ret == -EINTR) {
-		if (__put_user (t.tv_sec, &rmtp->tv_sec) ||
-	    	    __put_user (t.tv_nsec, &rmtp->tv_nsec))
-			return -EFAULT;
-	}
-	return ret;
-}
-
 extern asmlinkage int sys_sigprocmask(int how, old_sigset_t *set, old_sigset_t *oset);
 
 asmlinkage int sys32_sigprocmask(int how, old_sigset_t32 *set, old_sigset_t32 *oset)
@@ -1837,7 +1719,7 @@
 
 extern asmlinkage int sys_rt_sigprocmask(int how, sigset_t *set, sigset_t *oset, size_t sigsetsize);
 
-asmlinkage int sys32_rt_sigprocmask(int how, sigset_t32 *set, sigset_t32 *oset, __kernel_size_t32 sigsetsize)
+asmlinkage int sys32_rt_sigprocmask(int how, sigset_t32 *set, sigset_t32 *oset, compat_size_t sigsetsize)
 {
 	sigset_t s;
 	sigset_t32 s32;
@@ -1888,7 +1770,7 @@
 
 extern asmlinkage int sys_rt_sigpending(sigset_t *set, size_t sigsetsize);
 
-asmlinkage int sys32_rt_sigpending(sigset_t32 *set, __kernel_size_t32 sigsetsize)
+asmlinkage int sys32_rt_sigpending(sigset_t32 *set, compat_size_t sigsetsize)
 {
 	sigset_t s;
 	sigset_t32 s32;
@@ -1916,7 +1798,7 @@
 
 asmlinkage int
 sys32_rt_sigtimedwait(sigset_t32 *uthese, siginfo_t32 *uinfo,
-		      struct timespec32 *uts, __kernel_size_t32 sigsetsize)
+		      struct compat_timespec *uts, compat_size_t sigsetsize)
 {
 	int ret, sig;
 	sigset_t these;
@@ -2015,36 +1897,6 @@
 	return ret;
 }
 
-struct tms32 {
-	__kernel_clock_t32 tms_utime;
-	__kernel_clock_t32 tms_stime;
-	__kernel_clock_t32 tms_cutime;
-	__kernel_clock_t32 tms_cstime;
-};
-                                
-extern asmlinkage long sys_times(struct tms * tbuf);
-
-asmlinkage long sys32_times(struct tms32 *tbuf)
-{
-	struct tms t;
-	long ret;
-	mm_segment_t old_fs = get_fs ();
-	int err;
-	
-	set_fs (KERNEL_DS);
-	ret = sys_times(tbuf ? &t : NULL);
-	set_fs (old_fs);
-	if (tbuf) {
-		err = put_user (t.tms_utime, &tbuf->tms_utime);
-		err |= __put_user (t.tms_stime, &tbuf->tms_stime);
-		err |= __put_user (t.tms_cutime, &tbuf->tms_cutime);
-		err |= __put_user (t.tms_cstime, &tbuf->tms_cstime);
-		if (err)
-			ret = -EFAULT;
-	}
-	return ret;
-}
-
 #define RLIM_OLD_INFINITY32	0x7fffffff
 #define RLIM_INFINITY32		0xffffffff
 #define RESOURCE32_OLD(x)	((x > RLIM_OLD_INFINITY32) ? RLIM_OLD_INFINITY32 : x)
@@ -2136,14 +1988,14 @@
         u32               msg_name;
         int               msg_namelen;
         u32               msg_iov;
-        __kernel_size_t32 msg_iovlen;
+        compat_size_t msg_iovlen;
         u32               msg_control;
-        __kernel_size_t32 msg_controllen;
+        compat_size_t msg_controllen;
         unsigned          msg_flags;
 };
 
 struct cmsghdr32 {
-        __kernel_size_t32 cmsg_len;
+        compat_size_t cmsg_len;
         int               cmsg_level;
         int               cmsg_type;
 };
@@ -2277,7 +2129,7 @@
 {
 	struct cmsghdr32 *ucmsg;
 	struct cmsghdr *kcmsg, *kcmsg_base;
-	__kernel_size_t32 ucmlen;
+	compat_size_t ucmlen;
 	__kernel_size_t kcmlen, tmp;
 
 	kcmlen = 0;
@@ -2498,12 +2350,12 @@
 			 * from 64-bit time values to 32-bit time values
 			*/
 		case SO_TIMESTAMP: {
-			__kernel_time_t32* ptr_time32 = CMSG32_DATA(kcmsg32);
+			compat_time_t* ptr_time32 = CMSG32_DATA(kcmsg32);
 			__kernel_time_t*   ptr_time   = CMSG_DATA(ucmsg);
 			get_user(*ptr_time32, ptr_time);
 			get_user(*(ptr_time32+1), ptr_time+1);
 			kcmsg32->cmsg_len -= 2*(sizeof(__kernel_time_t) -
-						sizeof(__kernel_time_t32));
+						sizeof(compat_time_t));
 		}
 		default:;
 		}
@@ -2746,7 +2598,7 @@
 	err = __put_user(msg_sys.msg_flags, &msg->msg_flags);
 	if (err)
 		goto out_freeiov;
-	err = __put_user((__kernel_size_t32) ((unsigned long)msg_sys.msg_control - cmsg_ptr), &msg->msg_controllen);
+	err = __put_user((compat_size_t) ((unsigned long)msg_sys.msg_control - cmsg_ptr), &msg->msg_controllen);
 	if (err)
 		goto out_freeiov;
 	err = len;
@@ -2848,7 +2700,7 @@
 		struct timeval tmp;
 		mm_segment_t old_fs;
 
-		if (get_tv32(&tmp, (struct timeval32 *)optval ))
+		if (get_tv32(&tmp, (struct compat_timeval *)optval ))
 			return -EFAULT;
 		old_fs = get_fs();
 		set_fs(KERNEL_DS);
@@ -3126,7 +2978,7 @@
 }
 
 static int
-qm_modules(char *buf, size_t bufsize, __kernel_size_t32 *ret)
+qm_modules(char *buf, size_t bufsize, compat_size_t *ret)
 {
 	struct module *mod;
 	size_t nmod, space, len;
@@ -3161,7 +3013,7 @@
 }
 
 static int
-qm_deps(struct module *mod, char *buf, size_t bufsize, __kernel_size_t32 *ret)
+qm_deps(struct module *mod, char *buf, size_t bufsize, compat_size_t *ret)
 {
 	size_t i, space, len;
 
@@ -3198,7 +3050,7 @@
 }
 
 static int
-qm_refs(struct module *mod, char *buf, size_t bufsize, __kernel_size_t32 *ret)
+qm_refs(struct module *mod, char *buf, size_t bufsize, compat_size_t *ret)
 {
 	size_t nrefs, space, len;
 	struct module_ref *ref;
@@ -3242,7 +3094,7 @@
 }
 
 static inline int
-qm_symbols(struct module *mod, char *buf, size_t bufsize, __kernel_size_t32 *ret)
+qm_symbols(struct module *mod, char *buf, size_t bufsize, compat_size_t *ret)
 {
 	size_t i, space, len;
 	struct module_symbol *s;
@@ -3301,7 +3153,7 @@
 }
 
 static inline int
-qm_info(struct module *mod, char *buf, size_t bufsize, __kernel_size_t32 *ret)
+qm_info(struct module *mod, char *buf, size_t bufsize, compat_size_t *ret)
 {
 	int error = 0;
 
@@ -3368,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;
 };
 
@@ -3517,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,
@@ -3531,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;
 }
@@ -3683,7 +3535,7 @@
 extern struct timezone sys_tz;
 extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz);
 
-asmlinkage int sys32_gettimeofday(struct timeval32 *tv, struct timezone *tz)
+asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
 {
 	if (tv) {
 		struct timeval ktv;
@@ -3698,7 +3550,7 @@
 	return 0;
 }
 
-asmlinkage int sys32_settimeofday(struct timeval32 *tv, struct timezone *tz)
+asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
 {
 	struct timeval ktv;
 	struct timezone ktz;
@@ -3715,46 +3567,9 @@
 	return do_sys_settimeofday(tv ? &ktv : NULL, tz ? &ktz : NULL);
 }
 
-extern int do_getitimer(int which, struct itimerval *value);
-
-asmlinkage int sys32_getitimer(int which, struct itimerval32 *it)
-{
-	struct itimerval kit;
-	int error;
-
-	error = do_getitimer(which, &kit);
-	if (!error && put_it32(it, &kit))
-		error = -EFAULT;
-
-	return error;
-}
-
-extern int do_setitimer(int which, struct itimerval *, struct itimerval *);
-
-asmlinkage int sys32_setitimer(int which, struct itimerval32 *in, struct itimerval32 *out)
-{
-	struct itimerval kin, kout;
-	int error;
-
-	if (in) {
-		if (get_it32(&kin, in))
-			return -EFAULT;
-	} else
-		memset(&kin, 0, sizeof(kin));
-
-	error = do_setitimer(which, &kin, out ? &kout : NULL);
-	if (error || !out)
-		return error;
-	if (put_it32(out, &kout))
-		return -EFAULT;
-
-	return 0;
-
-}
-
 asmlinkage int sys_utimes(char *, struct timeval *);
 
-asmlinkage int sys32_utimes(char *filename, struct timeval32 *tvs)
+asmlinkage int sys32_utimes(char *filename, struct compat_timeval *tvs)
 {
 	char *kfilename;
 	struct timeval ktvs[2];
@@ -3807,34 +3622,32 @@
 extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf,
 				     size_t count, loff_t pos);
 
-typedef __kernel_ssize_t32 ssize_t32;
-
-asmlinkage ssize_t32 sys32_pread64(unsigned int fd, char *ubuf,
-				 __kernel_size_t32 count, u32 poshi, u32 poslo)
+asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf,
+				 compat_size_t count, u32 poshi, u32 poslo)
 {
-	if ((ssize_t32) count < 0)
+	if ((compat_ssize_t) count < 0)
 		return -EINVAL;
 	return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
 }
 
-asmlinkage ssize_t32 sys32_pwrite64(unsigned int fd, char *ubuf,
-				  __kernel_size_t32 count, u32 poshi, u32 poslo)
+asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char *ubuf,
+				  compat_size_t count, u32 poshi, u32 poslo)
 {
-	if ((ssize_t32) count < 0)
+	if ((compat_ssize_t) count < 0)
 		return -EINVAL;
 	return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
 }
 
 extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count);
 
-asmlinkage ssize_t32 sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count)
+asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count)
 {
 	return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
 }
 
 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;
@@ -3857,7 +3670,7 @@
 					 loff_t *offset, size_t count);
 
 asmlinkage int sys32_sendfile64(int out_fd, int in_fd, 
-				__kernel_loff_t32 *offset, s32 count)
+				compat_loff_t *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -3882,7 +3695,7 @@
 	u32 modes;
 	s32 offset, freq, maxerror, esterror;
 	s32 status, constant, precision, tolerance;
-	struct timeval32 time;
+	struct compat_timeval time;
 	s32 tick;
 	s32 ppsfreq, jitter, shift, stabil;
 	s32 jitcnt, calcnt, errcnt, stbcnt;
@@ -4301,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;
@@ -4325,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;
@@ -4353,7 +4166,7 @@
 
 asmlinkage int
 sys32_futex(void *uaddr, int op, int val, 
-		 struct timespec32 *timeout32)
+		 struct compat_timespec *timeout32)
 {
 	struct timespec tmp;
 	mm_segment_t old_fs;
@@ -4373,9 +4186,9 @@
 
 asmlinkage ssize_t sys_read(unsigned int fd, char * buf, size_t count);
 
-asmlinkage ssize_t32 sys32_read(unsigned int fd, char * buf, size_t count)
+asmlinkage compat_ssize_t sys32_read(unsigned int fd, char * buf, size_t count)
 {
-	if ((ssize_t32) count < 0)
+	if ((compat_ssize_t) count < 0)
 		return -EINVAL; 
 
 	return sys_read(fd, buf, count);
@@ -4383,9 +4196,9 @@
 
 asmlinkage ssize_t sys_write(unsigned int fd, const char * buf, size_t count);
 
-asmlinkage ssize_t32 sys32_write(unsigned int fd, char * buf, size_t count)
+asmlinkage compat_ssize_t sys32_write(unsigned int fd, char * buf, size_t count)
 {
-	if ((ssize_t32) count < 0)
+	if ((compat_ssize_t) count < 0)
 		return -EINVAL; 
 
 	return sys_write(fd, buf, count);
diff -ruN 2.5.53/arch/s390x/kernel/linux32.h 2.5.53-32bit.1/arch/s390x/kernel/linux32.h
--- 2.5.53/arch/s390x/kernel/linux32.h	2002-10-08 12:02:40.000000000 +1000
+++ 2.5.53-32bit.1/arch/s390x/kernel/linux32.h	2002-12-30 16:28:47.000000000 +1100
@@ -2,6 +2,7 @@
 #define _ASM_S390X_S390_H
 
 #include <linux/config.h>
+#include <linux/compat.h>
 #include <linux/socket.h>
 #include <linux/nfs_fs.h>
 #include <linux/sunrpc/svc.h>
@@ -15,26 +16,6 @@
 	((unsigned long)(__x))
 
 /* Now 32bit compatibility types */
-typedef unsigned int           __kernel_size_t32;
-typedef int                    __kernel_ssize_t32;
-typedef int                    __kernel_ptrdiff_t32;
-typedef int                    __kernel_time_t32;
-typedef int                    __kernel_clock_t32;
-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;  
-
 struct ipc_kludge_32 {
         __u32   msgp;                           /* pointer              */
         __s32   msgtyp;
@@ -47,35 +28,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;
@@ -141,8 +99,8 @@
 			pid_t			_pid;	/* which child */
 			uid_t			_uid;	/* sender's uid */
 			int			_status;/* exit code */
-			__kernel_clock_t32	_utime;
-			__kernel_clock_t32	_stime;
+			compat_clock_t		_utime;
+			compat_clock_t		_stime;
 		} _sigchld;
 
 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
@@ -253,7 +211,7 @@
 typedef struct {
 	__u32			ss_sp;		/* pointer */
 	int			ss_flags;
-	__kernel_size_t32	ss_size;
+	compat_size_t		ss_size;
 } stack_t32;
 
 /* asm/ucontext.h */
diff -ruN 2.5.53/arch/s390x/kernel/wrapper32.S 2.5.53-32bit.1/arch/s390x/kernel/wrapper32.S
--- 2.5.53/arch/s390x/kernel/wrapper32.S	2002-11-28 10:34:42.000000000 +1100
+++ 2.5.53-32bit.1/arch/s390x/kernel/wrapper32.S	2002-12-16 14:51:53.000000000 +1100
@@ -130,11 +130,11 @@
 
 #sys32_pause_wrapper			# void 
 
-	.globl  sys32_utime_wrapper 
-sys32_utime_wrapper:
+	.globl  compat_sys_utime_wrapper 
+compat_sys_utime_wrapper:
 	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# struct utimbuf_emu31 *
-	jg	sys32_utime		# branch to system call
+	llgtr	%r3,%r3			# struct compat_utimbuf *
+	jg	compat_sys_utime		# branch to system call
 
 	.globl  sys32_access_wrapper 
 sys32_access_wrapper:
@@ -182,10 +182,10 @@
 	llgtr	%r2,%r2			# u32 *
 	jg	sys_pipe		# branch to system call
 
-	.globl  sys32_times_wrapper 
-sys32_times_wrapper:
-	llgtr	%r2,%r2			# struct tms_emu31 *
-	jg	sys32_times		# branch to system call
+	.globl  compat_sys_times_wrapper 
+compat_sys_times_wrapper:
+	llgtr	%r2,%r2			# struct compat_tms *
+	jg	compat_sys_times	# branch to system call
 
 	.globl  sys32_brk_wrapper 
 sys32_brk_wrapper:
@@ -465,36 +465,36 @@
 	lgfr	%r4,%r4			# int
 	jg	sys_syslog		# branch to system call
 
-	.globl  sys32_setitimer_wrapper 
-sys32_setitimer_wrapper:
+	.globl  compat_sys_setitimer_wrapper 
+compat_sys_setitimer_wrapper:
 	lgfr	%r2,%r2			# int
 	llgtr	%r3,%r3			# struct itimerval_emu31 *
 	llgtr	%r4,%r4			# struct itimerval_emu31 *
-	jg	sys32_setitimer		# branch to system call
+	jg	compat_sys_setitimer	# branch to system call
 
-	.globl  sys32_getitimer_wrapper 
-sys32_getitimer_wrapper:
+	.globl  compat_sys_getitimer_wrapper 
+compat_sys_getitimer_wrapper:
 	lgfr	%r2,%r2			# int
 	llgtr	%r3,%r3			# struct itimerval_emu31 *
-	jg	sys32_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 
 
@@ -743,14 +743,14 @@
 	.globl  sys32_sched_rr_get_interval_wrapper 
 sys32_sched_rr_get_interval_wrapper:
 	lgfr	%r2,%r2			# pid_t
-	llgtr	%r3,%r3			# struct timespec_emu31 *
+	llgtr	%r3,%r3			# struct compat_timespec *
 	jg	sys32_sched_rr_get_interval	# branch to system call
 
-	.globl  sys32_nanosleep_wrapper 
-sys32_nanosleep_wrapper:
-	llgtr	%r2,%r2			# struct timespec_emu31 *
-	llgtr	%r3,%r3			# struct timespec_emu31 *
-	jg	sys32_nanosleep		# branch to system call
+	.globl  compat_sys_nanosleep_wrapper 
+compat_sys_nanosleep_wrapper:
+	llgtr	%r2,%r2			# struct compat_timespec *
+	llgtr	%r3,%r3			# struct compat_timespec *
+	jg	compat_sys_nanosleep		# branch to system call
 
 	.globl  sys32_mremap_wrapper 
 sys32_mremap_wrapper:
@@ -839,7 +839,7 @@
 sys32_rt_sigtimedwait_wrapper:
 	llgtr	%r2,%r2			# const sigset_emu31_t *
 	llgtr	%r3,%r3			# siginfo_emu31_t *
-	llgtr	%r4,%r4			# const struct timespec_emu31 *
+	llgtr	%r4,%r4			# const struct compat_timespec *
 	llgfr	%r5,%r5			# size_t
 	jg	sys32_rt_sigtimedwait	# branch to system call
 
diff -ruN 2.5.53/include/asm-s390x/compat.h 2.5.53-32bit.1/include/asm-s390x/compat.h
--- 2.5.53/include/asm-s390x/compat.h	1970-01-01 10:00:00.000000000 +1000
+++ 2.5.53-32bit.1/include/asm-s390x/compat.h	2002-12-30 16:28:37.000000000 +1100
@@ -0,0 +1,61 @@
+#ifndef _ASM_S390X_COMPAT_H
+#define _ASM_S390X_COMPAT_H
+/*
+ * Architecture specific compatibility types
+ */
+#include <linux/types.h>
+
+#define COMPAT_USER_HZ	100
+
+typedef u32		compat_size_t;
+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 s64		compat_loff_t;
+typedef u16		compat_nlink_t;
+typedef u16		compat_ipc_pid_t;
+typedef s32		compat_daddr_t;
+typedef u32		compat_caddr_t;
+typedef __kernel_fsid_t	compat_fsid_t;
+
+struct compat_timespec {
+	compat_time_t	tv_sec;
+	s32		tv_nsec;
+};
+
+struct compat_timeval {
+	compat_time_t	tv_sec;
+	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] Eliminate the rest of the __kernel_..._t32 typedefs 5/7 S390X
  2002-12-30  6:38 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7 Stephen Rothwell
@ 2002-12-30  6:41   ` Stephen Rothwell
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-30  6:41 UTC (permalink / raw)
  To: schwidefsky; +Cc: linux-kernel

Of course, I forgot to change the Subject on the S390X patch
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

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

* [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 6/7 MIPS64
  2002-12-30  6:19 [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7 Stephen Rothwell
                   ` (4 preceding siblings ...)
  2002-12-30  6:38 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7 Stephen Rothwell
@ 2002-12-30  6:43 ` Stephen Rothwell
  2002-12-30  6:46 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 7/7 PARISC Stephen Rothwell
  6 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-30  6:43 UTC (permalink / raw)
  To: ralf; +Cc: linux-kernel

Hi Ralf,

MIPS64 specific stuff ...

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

diff -ruN 2.5.53/arch/mips64/kernel/ioctl32.c 2.5.53-32bit.1/arch/mips64/kernel/ioctl32.c
--- 2.5.53/arch/mips64/kernel/ioctl32.c	2002-12-16 14:49:47.000000000 +1100
+++ 2.5.53-32bit.1/arch/mips64/kernel/ioctl32.c	2002-12-30 15:37:15.000000000 +1100
@@ -116,13 +116,13 @@
                 struct  ifmap32 ifru_map;
                 char    ifru_slave[IFNAMSIZ];   /* Just fits the size */
 		char	ifru_newname[IFNAMSIZ];
-                __kernel_caddr_t32 ifru_data;
+                compat_caddr_t ifru_data;
         } ifr_ifru;
 };
 
 struct ifconf32 {
         int     ifc_len;                        /* size of buffer       */
-        __kernel_caddr_t32  ifcbuf;
+        compat_caddr_t  ifcbuf;
 };
 
 #ifdef CONFIG_NET
@@ -433,8 +433,8 @@
 	__u32	mt_dsreg;
 	__u32	mt_gstat;
 	__u32	mt_erreg;
-	__kernel_daddr_t32	mt_fileno;
-	__kernel_daddr_t32	mt_blkno;
+	compat_daddr_t	mt_fileno;
+	compat_daddr_t	mt_blkno;
 };
 #define MTIOCGET32	_IOR('m', 2, struct mtget32)
 
diff -ruN 2.5.53/arch/mips64/kernel/linux32.c 2.5.53-32bit.1/arch/mips64/kernel/linux32.c
--- 2.5.53/arch/mips64/kernel/linux32.c	2002-12-16 14:49:47.000000000 +1100
+++ 2.5.53-32bit.1/arch/mips64/kernel/linux32.c	2002-12-30 16:28:24.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);
 }
@@ -565,7 +532,7 @@
 	int	f_files;
 	int	f_ffree;
 	int	f_bavail;
-	__kernel_fsid_t32	f_fsid;
+	compat_fsid_t	f_fsid;
 	int	f_namelen;
 	int	f_spare[6];
 };
@@ -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;
@@ -1125,35 +1092,6 @@
 }
 
 
-struct tms32 {
-	int tms_utime;
-	int tms_stime;
-	int tms_cutime;
-	int tms_cstime;
-};
-
-extern asmlinkage long sys_times(struct tms * tbuf);
-asmlinkage long sys32_times(struct tms32 *tbuf)
-{
-	struct tms t;
-	long ret;
-	mm_segment_t old_fs = get_fs();
-	int err;
-
-	set_fs(KERNEL_DS);
-	ret = sys_times(tbuf ? &t : NULL);
-	set_fs(old_fs);
-	if (tbuf) {
-		err = put_user (t.tms_utime, &tbuf->tms_utime);
-		err |= __put_user (t.tms_stime, &tbuf->tms_stime);
-		err |= __put_user (t.tms_cutime, &tbuf->tms_cutime);
-		err |= __put_user (t.tms_cstime, &tbuf->tms_cstime);
-		if (err)
-			ret = -EFAULT;
-	}
-	return ret;
-}
-
 extern asmlinkage int sys_setsockopt(int fd, int level, int optname,
 				     char *optval, int optlen);
 
@@ -1199,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;
 };
 
@@ -1278,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;
 };
 
@@ -1310,8 +1248,8 @@
         unsigned short msg_cbytes;
         unsigned short msg_qnum;  
         unsigned short msg_qbytes;
-        __kernel_ipc_pid_t32 msg_lspid;
-        __kernel_ipc_pid_t32 msg_lrpid;
+        compat_ipc_pid_t msg_lspid;
+        compat_ipc_pid_t msg_lrpid;
 };
 
 struct shmid_ds32 {
@@ -1320,8 +1258,8 @@
         compat_time_t         shm_atime;
         compat_time_t         shm_dtime;
         compat_time_t         shm_ctime;
-        __kernel_ipc_pid_t32    shm_cpid; 
-        __kernel_ipc_pid_t32    shm_lpid; 
+        compat_ipc_pid_t    shm_cpid; 
+        compat_ipc_pid_t    shm_lpid; 
         unsigned short          shm_nattch;
 };
 
@@ -1684,11 +1622,11 @@
 
 struct sysctl_args32
 {
-	__kernel_caddr_t32 name;
+	compat_caddr_t name;
 	int nlen;
-	__kernel_caddr_t32 oldval;
-	__kernel_caddr_t32 oldlenp;
-	__kernel_caddr_t32 newval;
+	compat_caddr_t oldval;
+	compat_caddr_t oldlenp;
+	compat_caddr_t newval;
 	compat_size_t newlen;
 	unsigned int __unused[4];
 };
diff -ruN 2.5.53/arch/mips64/kernel/scall_o32.S 2.5.53-32bit.1/arch/mips64/kernel/scall_o32.S
--- 2.5.53/arch/mips64/kernel/scall_o32.S	2002-12-16 14:49:47.000000000 +1100
+++ 2.5.53-32bit.1/arch/mips64/kernel/scall_o32.S	2002-12-16 14:51:53.000000000 +1100
@@ -276,7 +276,7 @@
 	sys	sys_rmdir	1			/* 4040 */
 	sys	sys_dup		1
 	sys	sys_pipe	0
-	sys	sys32_times	1
+	sys	compat_sys_times	1
 	sys	sys_ni_syscall	0
 	sys	sys_brk		1			/* 4045 */
 	sys	sys_setgid	1
@@ -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.53/include/asm-mips64/compat.h 2.5.53-32bit.1/include/asm-mips64/compat.h
--- 2.5.53/include/asm-mips64/compat.h	2002-12-16 14:49:54.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-mips64/compat.h	2002-12-30 16:24:38.000000000 +1100
@@ -5,14 +5,56 @@
  */
 #include <linux/types.h>
 
+#define COMPAT_USER_HZ	100
+
 typedef u32		compat_size_t;
 typedef s32		compat_ssize_t;
 typedef s32		compat_time_t;
-typedef s32		compat_suseconds_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;
+typedef s32		compat_ipc_pid_t;
+typedef s32		compat_daddr_t;
+typedef u32		compat_caddr_t;
+typedef __kernel_fsid_t	compat_fsid_t;
 
 struct compat_timespec {
 	compat_time_t	tv_sec;
 	s32		tv_nsec;
 };
 
+struct compat_timeval {
+	compat_time_t	tv_sec;
+	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.53/include/asm-mips64/posix_types.h 2.5.53-32bit.1/include/asm-mips64/posix_types.h
--- 2.5.53/include/asm-mips64/posix_types.h	2002-12-16 14:49:54.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-mips64/posix_types.h	2002-12-30 16:25:00.000000000 +1100
@@ -48,23 +48,6 @@
         int    val[2];
 } __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_ptrdiff_t32;
-typedef int		__kernel_suseconds_t32;
-typedef int		__kernel_clock_t32;
-typedef int		__kernel_daddr_t32;
-typedef unsigned int	__kernel_caddr_t32;
-typedef __kernel_fsid_t	__kernel_fsid_t32;
-
 #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
 
 #undef __FD_SET
diff -ruN 2.5.53/include/asm-mips64/stat.h 2.5.53-32bit.1/include/asm-mips64/stat.h
--- 2.5.53/include/asm-mips64/stat.h	2002-12-16 14:49:54.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-mips64/stat.h	2002-12-16 14:51:53.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] Eliminate the rest of the __kernel_..._t32 typedefs 7/7  PARISC
  2002-12-30  6:19 [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7 Stephen Rothwell
                   ` (5 preceding siblings ...)
  2002-12-30  6:43 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 6/7 MIPS64 Stephen Rothwell
@ 2002-12-30  6:46 ` Stephen Rothwell
  6 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2002-12-30  6:46 UTC (permalink / raw)
  To: willy; +Cc: linux-kernel

Hi Willy,

PARISC specific stuff ...

Is this stuff helpful to you guys?  I know thet the PARISC tree
is somewhat different to the rest of the architectures, but I hope
some of this is possible.

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

diff -ruN 2.5.53/arch/parisc/Kconfig 2.5.53-32bit.1/arch/parisc/Kconfig
--- 2.5.53/arch/parisc/Kconfig	2002-12-10 15:10:16.000000000 +1100
+++ 2.5.53-32bit.1/arch/parisc/Kconfig	2002-12-16 14:51:53.000000000 +1100
@@ -107,6 +107,11 @@
 	  enable this option otherwise. The 64bit kernel is significantly bigger
 	  and slower than the 32bit one.
 
+config COMPAT
+	bool
+	depends PARISC64
+	default y
+
 config PDC_NARROW
 	bool "32-bit firmware"
 	depends on PARISC64
diff -ruN 2.5.53/arch/parisc/kernel/binfmt_elf32.c 2.5.53-32bit.1/arch/parisc/kernel/binfmt_elf32.c
--- 2.5.53/arch/parisc/kernel/binfmt_elf32.c	2002-10-31 14:05:12.000000000 +1100
+++ 2.5.53-32bit.1/arch/parisc/kernel/binfmt_elf32.c	2002-12-16 14:51:53.000000000 +1100
@@ -19,7 +19,7 @@
 #include <linux/module.h>
 #include <linux/config.h>
 #include <linux/elfcore.h>
-#include "sys32.h"		/* struct timeval32 */
+#include <linux/compat.h>		/* struct compat_timeval */
 
 #define elf_prstatus elf_prstatus32
 struct elf_prstatus32
@@ -32,10 +32,10 @@
 	pid_t	pr_ppid;
 	pid_t	pr_pgrp;
 	pid_t	pr_sid;
-	struct timeval32 pr_utime;	/* User time */
-	struct timeval32 pr_stime;	/* System time */
-	struct timeval32 pr_cutime;	/* Cumulative user time */
-	struct timeval32 pr_cstime;	/* Cumulative system time */
+	struct compat_timeval pr_utime;	/* User time */
+	struct compat_timeval pr_stime;	/* System time */
+	struct compat_timeval pr_cutime;	/* Cumulative user time */
+	struct compat_timeval pr_cstime;	/* Cumulative system time */
 	elf_gregset_t pr_reg;	/* GP registers */
 	int pr_fpvalid;		/* True if math co-processor being used.  */
 };
diff -ruN 2.5.53/arch/parisc/kernel/ioctl32.c 2.5.53-32bit.1/arch/parisc/kernel/ioctl32.c
--- 2.5.53/arch/parisc/kernel/ioctl32.c	2002-10-31 14:05:12.000000000 +1100
+++ 2.5.53-32bit.1/arch/parisc/kernel/ioctl32.c	2002-12-30 15:39:44.000000000 +1100
@@ -10,6 +10,7 @@
 
 #include <linux/config.h>
 #include <linux/types.h>
+#include <linux/compat.h>
 #include "sys32.h"
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -164,7 +165,7 @@
  
 static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct timeval32 *up = (struct timeval32 *)arg;
+	struct compat_timeval *up = (struct compat_timeval *)arg;
 	struct timeval ktv;
 	mm_segment_t old_fs = get_fs();
 	int err;
@@ -206,13 +207,13 @@
                 struct  ifmap32 ifru_map;
                 char    ifru_slave[IFNAMSIZ];   /* Just fits the size */
 		char	ifru_newname[IFNAMSIZ];
-                __kernel_caddr_t32 ifru_data;
+                compat_caddr_t ifru_data;
         } ifr_ifru;
 };
 
 struct ifconf32 {
         int     ifc_len;                        /* size of buffer       */
-        __kernel_caddr_t32  ifcbuf;
+        compat_caddr_t  ifcbuf;
 };
 
 static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg)
@@ -576,7 +577,7 @@
 
 struct fb_fix_screeninfo32 {
 	char			id[16];
-        __kernel_caddr_t32	smem_start;
+        compat_caddr_t	smem_start;
 	__u32			smem_len;
 	__u32			type;
 	__u32			type_aux;
@@ -585,7 +586,7 @@
 	__u16			ypanstep;
 	__u16			ywrapstep;
 	__u32			line_length;
-        __kernel_caddr_t32	mmio_start;
+        compat_caddr_t	mmio_start;
 	__u32			mmio_len;
 	__u32			accel;
 	__u16			reserved[3];
@@ -594,10 +595,10 @@
 struct fb_cmap32 {
 	__u32			start;
 	__u32			len;
-	__kernel_caddr_t32	red;
-	__kernel_caddr_t32	green;
-	__kernel_caddr_t32	blue;
-	__kernel_caddr_t32	transp;
+	compat_caddr_t	red;
+	compat_caddr_t	green;
+	compat_caddr_t	blue;
+	compat_caddr_t	transp;
 };
 
 static int fb_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
@@ -752,7 +753,7 @@
 	unsigned char	rate;
 	unsigned char	spec1;
 	unsigned char	fmt_gap;
-	const __kernel_caddr_t32 name;
+	const compat_caddr_t name;
 };
 
 struct floppy_drive_params32 {
@@ -791,7 +792,7 @@
 	int		fd_ref;
 	int		fd_device;
 	int		last_checked;
-	__kernel_caddr_t32 dmabuf;
+	compat_caddr_t dmabuf;
 	int		bufblocks;
 };
 
@@ -1053,15 +1054,15 @@
 }
 
 struct ppp_option_data32 {
-	__kernel_caddr_t32	ptr;
+	compat_caddr_t	ptr;
 	__u32			length;
 	int			transmit;
 };
 #define PPPIOCSCOMPRESS32	_IOW('t', 77, struct ppp_option_data32)
 
 struct ppp_idle32 {
-	__kernel_time_t32 xmit_idle;
-	__kernel_time_t32 recv_idle;
+	compat_time_t xmit_idle;
+	compat_time_t recv_idle;
 };
 #define PPPIOCGIDLE32		_IOR('t', 63, struct ppp_idle32)
 
@@ -1135,8 +1136,8 @@
 	__u32	mt_dsreg;
 	__u32	mt_gstat;
 	__u32	mt_erreg;
-	__kernel_daddr_t32	mt_fileno;
-	__kernel_daddr_t32	mt_blkno;
+	compat_daddr_t	mt_fileno;
+	compat_daddr_t	mt_blkno;
 };
 #define MTIOCGET32	_IOR('m', 2, struct mtget32)
 
@@ -1255,7 +1256,7 @@
 
 struct cdrom_read32 {
 	int			cdread_lba;
-	__kernel_caddr_t32	cdread_bufaddr;
+	compat_caddr_t	cdread_bufaddr;
 	int			cdread_buflen;
 };
 
@@ -1263,16 +1264,16 @@
 	union cdrom_addr	addr;
 	u_char			addr_format;
 	int			nframes;
-	__kernel_caddr_t32	buf;
+	compat_caddr_t	buf;
 };
 
 struct cdrom_generic_command32 {
 	unsigned char		cmd[CDROM_PACKET_SIZE];
-	__kernel_caddr_t32	buffer;
+	compat_caddr_t	buffer;
 	unsigned int		buflen;
 	int			stat;
-	__kernel_caddr_t32	sense;
-	__kernel_caddr_t32	reserved[3];
+	compat_caddr_t	sense;
+	compat_caddr_t	reserved[3];
 };
 
 static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
@@ -1281,7 +1282,7 @@
 	struct cdrom_read cdread;
 	struct cdrom_read_audio cdreadaudio;
 	struct cdrom_generic_command cgc;
-	__kernel_caddr_t32 addr;
+	compat_caddr_t addr;
 	char *data = 0;
 	void *karg;
 	int err = 0;
@@ -1365,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 */
@@ -1576,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;
 }
@@ -1585,12 +1586,12 @@
 struct atmif_sioc32 {
         int                number;
         int                length;
-        __kernel_caddr_t32 arg;
+        compat_caddr_t arg;
 };
 
 struct atm_iobuf32 {
 	int                length;
-	__kernel_caddr_t32 buffer;
+	compat_caddr_t buffer;
 };
 
 #define ATM_GETLINKRATE32 _IOW('a', ATMIOC_ITF+1, struct atmif_sioc32)
@@ -1651,7 +1652,7 @@
 
 	iobuf.length = iobuf32.length;
 
-	if (iobuf32.buffer == (__kernel_caddr_t32) NULL || iobuf32.length == 0) {
+	if (iobuf32.buffer == (compat_caddr_t) NULL || iobuf32.length == 0) {
 		iobuf.buffer = (void*)(unsigned long)iobuf32.buffer;
 	} else {
 		iobuf.buffer = kmalloc(iobuf.length, GFP_KERNEL);
@@ -1705,7 +1706,7 @@
         sioc.number = sioc32.number;
         sioc.length = sioc32.length;
         
-	if (sioc32.arg == (__kernel_caddr_t32) NULL || sioc32.length == 0) {
+	if (sioc32.arg == (compat_caddr_t) NULL || sioc32.length == 0) {
 		sioc.arg = (void*)(unsigned long)sioc32.arg;
         } else {
                 sioc.arg = kmalloc(sioc.length, GFP_KERNEL);
@@ -1863,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;
 
@@ -3627,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.53/arch/parisc/kernel/signal32.c 2.5.53-32bit.1/arch/parisc/kernel/signal32.c
--- 2.5.53/arch/parisc/kernel/signal32.c	2002-10-31 14:05:13.000000000 +1100
+++ 2.5.53-32bit.1/arch/parisc/kernel/signal32.c	2002-12-16 14:51:53.000000000 +1100
@@ -8,6 +8,7 @@
 #include <linux/sched.h>
 #include <linux/types.h>
 #include <linux/errno.h>
+#include <linux/compat.h>
 
 #include <asm/uaccess.h>
 #include "sys32.h"
@@ -175,7 +176,7 @@
 typedef struct {
 	unsigned int ss_sp;
 	int ss_flags;
-	__kernel_size_t32 ss_size;
+	compat_size_t ss_size;
 } stack_t32;
 
 int 
diff -ruN 2.5.53/arch/parisc/kernel/sys32.h 2.5.53-32bit.1/arch/parisc/kernel/sys32.h
--- 2.5.53/arch/parisc/kernel/sys32.h	2002-10-31 14:05:13.000000000 +1100
+++ 2.5.53-32bit.1/arch/parisc/kernel/sys32.h	2002-12-16 14:51:53.000000000 +1100
@@ -12,11 +12,6 @@
     set_fs (old_fs); \
 }
 
-struct timeval32 {
-	int tv_sec;
-	int tv_usec;
-};
-
 typedef __u32 __sighandler_t32;
 
 #include <linux/signal.h>
diff -ruN 2.5.53/arch/parisc/kernel/sys_parisc32.c 2.5.53-32bit.1/arch/parisc/kernel/sys_parisc32.c
--- 2.5.53/arch/parisc/kernel/sys_parisc32.c	2002-11-18 15:47:40.000000000 +1100
+++ 2.5.53-32bit.1/arch/parisc/kernel/sys_parisc32.c	2002-12-30 15:38:41.000000000 +1100
@@ -16,7 +16,6 @@
 #include <linux/mm.h> 
 #include <linux/file.h> 
 #include <linux/signal.h>
-#include <linux/utime.h>
 #include <linux/resource.h>
 #include <linux/times.h>
 #include <linux/utsname.h>
@@ -52,6 +51,7 @@
 #include <linux/mman.h>
 #include <linux/binfmts.h>
 #include <linux/namei.h>
+#include <linux/compat.h>
 
 #include <asm/types.h>
 #include <asm/uaccess.h>
@@ -386,74 +386,12 @@
  * code available in case it's useful to others. -PB
  */
 
-/* from utime.h */
-struct utimbuf32 {
-	__kernel_time_t32 actime;
-	__kernel_time_t32 modtime;
-};
-
-asmlinkage long sys32_utime(char *filename, struct utimbuf32 *times)
-{
-    struct utimbuf32 times32;
-    struct utimbuf times64;
-    extern long sys_utime(char *filename, struct utimbuf *times);
-    char *fname;
-    long ret;
-
-    if (!times)
-    	return sys_utime(filename, NULL);
-
-    /* get the 32-bit struct from user space */
-    if (copy_from_user(&times32, times, sizeof times32))
-    	return -EFAULT;
-
-    /* convert it into the 64-bit one */
-    times64.actime = times32.actime;
-    times64.modtime = times32.modtime;
-
-    /* grab the file name */
-    fname = getname(filename);
-
-    KERNEL_SYSCALL(ret, sys_utime, fname, &times64);
-
-    /* free the file name */
-    putname(fname);
-
-    return ret;
-}
-
-struct tms32 {
-	__kernel_clock_t32 tms_utime;
-	__kernel_clock_t32 tms_stime;
-	__kernel_clock_t32 tms_cutime;
-	__kernel_clock_t32 tms_cstime;
-};
-                                
-asmlinkage long sys32_times(struct tms32 *tbuf)
-{
-	struct tms t;
-	long ret;
-	extern asmlinkage long sys_times(struct tms * tbuf);
-int err;
-	
-	KERNEL_SYSCALL(ret, sys_times, tbuf ? &t : NULL);
-	if (tbuf) {
-		err = put_user (t.tms_utime, &tbuf->tms_utime);
-		err |= __put_user (t.tms_stime, &tbuf->tms_stime);
-		err |= __put_user (t.tms_cutime, &tbuf->tms_cutime);
-		err |= __put_user (t.tms_cstime, &tbuf->tms_cstime);
-		if (err)
-			ret = -EFAULT;
-	}
-	return ret;
-}
-
 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;
 };
 
 
@@ -584,71 +522,42 @@
 }
 #endif /* CONFIG_SYSCTL */
 
-struct timespec32 {
-	s32    tv_sec;
-	s32    tv_nsec;
-};
-                
 static int
-put_timespec32(struct timespec32 *u, struct timespec *t)
+put_compat_timespec(struct compat_timespec *u, struct timespec *t)
 {
-	struct timespec32 t32;
+	struct compat_timespec t32;
 	t32.tv_sec = t->tv_sec;
 	t32.tv_nsec = t->tv_nsec;
 	return copy_to_user(u, &t32, sizeof t32);
 }
 
-asmlinkage int sys32_nanosleep(struct timespec32 *rqtp, struct timespec32 *rmtp)
-{
-	struct timespec t;
-	struct timespec32 t32;
-	int ret;
-	extern asmlinkage int sys_nanosleep(struct timespec *rqtp, struct timespec *rmtp);
-	
-	if (copy_from_user(&t32, rqtp, sizeof t32))
-		return -EFAULT;
-	t.tv_sec = t32.tv_sec;
-	t.tv_nsec = t32.tv_nsec;
-
-	DBG(("sys32_nanosleep({%d, %d})\n", t32.tv_sec, t32.tv_nsec));
-
-	KERNEL_SYSCALL(ret, sys_nanosleep, &t, rmtp ? &t : NULL);
-	if (rmtp && ret == -EINTR) {
-		if (put_timespec32(rmtp, &t))
-			return -EFAULT;
-	}
-	return ret;
-}
-
 asmlinkage long sys32_sched_rr_get_interval(pid_t pid,
-	struct timespec32 *interval)
+	struct compat_timespec *interval)
 {
 	struct timespec t;
 	int ret;
 	extern asmlinkage long sys_sched_rr_get_interval(pid_t pid, struct timespec *interval);
 	
 	KERNEL_SYSCALL(ret, sys_sched_rr_get_interval, pid, &t);
-	if (put_timespec32(interval, &t))
+	if (put_compat_timespec(interval, &t))
 		return -EFAULT;
 	return ret;
 }
 
-typedef __kernel_time_t32 time_t32;
-
 static int
-put_timeval32(struct timeval32 *u, struct timeval *t)
+put_compat_timeval(struct compat_timeval *u, struct timeval *t)
 {
-	struct timeval32 t32;
+	struct compat_timeval t32;
 	t32.tv_sec = t->tv_sec;
 	t32.tv_usec = t->tv_usec;
 	return copy_to_user(u, &t32, sizeof t32);
 }
 
 static int
-get_timeval32(struct timeval32 *u, struct timeval *t)
+get_compat_timeval(struct compat_timeval *u, struct timeval *t)
 {
 	int err;
-	struct timeval32 t32;
+	struct compat_timeval t32;
 
 	if ((err = copy_from_user(&t32, u, sizeof t32)) == 0)
 	{
@@ -658,10 +567,10 @@
 	return err;
 }
 
-asmlinkage long sys32_time(time_t32 *tloc)
+asmlinkage long sys32_time(compat_time_t *tloc)
 {
     time_t now = get_seconds();
-    time_t32 now32 = now;
+    compat_time_t now32 = now;
 
     if (tloc)
     	if (put_user(now32, tloc))
@@ -671,14 +580,14 @@
 }
 
 asmlinkage int
-sys32_gettimeofday(struct timeval32 *tv, struct timezone *tz)
+sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
 {
     extern void do_gettimeofday(struct timeval *tv);
 
     if (tv) {
 	    struct timeval ktv;
 	    do_gettimeofday(&ktv);
-	    if (put_timeval32(tv, &ktv))
+	    if (put_compat_timeval(tv, &ktv))
 		    return -EFAULT;
     }
     if (tz) {
@@ -690,14 +599,14 @@
 }
 
 asmlinkage int
-sys32_settimeofday(struct timeval32 *tv, struct timezone *tz)
+sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
 {
     struct timeval ktv;
     struct timezone ktz;
     extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz);
 
     if (tv) {
-	    if (get_timeval32(tv, &ktv))
+	    if (get_compat_timeval(tv, &ktv))
 		    return -EFAULT;
     }
     if (tz) {
@@ -708,67 +617,9 @@
     return do_sys_settimeofday(tv ? &ktv : NULL, tz ? &ktz : NULL);
 }
 
-struct	itimerval32 {
-	struct	timeval32 it_interval;	/* timer interval */
-	struct	timeval32 it_value;	/* current value */
-};
-
-asmlinkage long sys32_getitimer(int which, struct itimerval32 *ov32)
-{
-	int error = -EFAULT;
-	struct itimerval get_buffer;
-	extern int do_getitimer(int which, struct itimerval *value);
-
-	if (ov32) {
-		error = do_getitimer(which, &get_buffer);
-		if (!error) {
-			struct itimerval32 gb32;
-			gb32.it_interval.tv_sec = get_buffer.it_interval.tv_sec;
-			gb32.it_interval.tv_usec = get_buffer.it_interval.tv_usec;
-			gb32.it_value.tv_sec = get_buffer.it_value.tv_sec;
-			gb32.it_value.tv_usec = get_buffer.it_value.tv_usec;
-			if (copy_to_user(ov32, &gb32, sizeof(gb32)))
-				error = -EFAULT; 
-		}
-	}
-	return error;
-}
-
-asmlinkage long sys32_setitimer(int which, struct itimerval32 *v32,
-			      struct itimerval32 *ov32)
-{
-	struct itimerval set_buffer, get_buffer;
-	struct itimerval32 sb32, gb32;
-	extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ov32);
-	int error;
-
-	if (v32) {
-		if(copy_from_user(&sb32, v32, sizeof(sb32)))
-			return -EFAULT;
-
-		set_buffer.it_interval.tv_sec = sb32.it_interval.tv_sec;
-		set_buffer.it_interval.tv_usec = sb32.it_interval.tv_usec;
-		set_buffer.it_value.tv_sec = sb32.it_value.tv_sec;
-		set_buffer.it_value.tv_usec = sb32.it_value.tv_usec;
-	} else
-		memset((char *) &set_buffer, 0, sizeof(set_buffer));
-
-	error = do_setitimer(which, &set_buffer, ov32 ? &get_buffer : 0);
-	if (error || !ov32)
-		return error;
-
-	gb32.it_interval.tv_sec = get_buffer.it_interval.tv_sec;
-	gb32.it_interval.tv_usec = get_buffer.it_interval.tv_usec;
-	gb32.it_value.tv_sec = get_buffer.it_value.tv_sec;
-	gb32.it_value.tv_usec = get_buffer.it_value.tv_usec;
-	if (copy_to_user(ov32, &gb32, sizeof(gb32)))
-		return -EFAULT; 
-	return 0;
-}
-
 struct rusage32 {
-        struct timeval32 ru_utime;
-        struct timeval32 ru_stime;
+        struct compat_timeval ru_utime;
+        struct compat_timeval ru_stime;
         int    ru_maxrss;
         int    ru_ixrss;
         int    ru_idrss;
@@ -823,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)
@@ -841,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;
-	__kernel_time_t32	st_atime;
-	unsigned int	st_spare1;
-	__kernel_time_t32	st_mtime;
-	unsigned int	st_spare2;
-	__kernel_time_t32	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);
@@ -883,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);
@@ -912,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];
 };
@@ -1302,7 +1090,7 @@
 }
 
 static int
-qm_modules(char *buf, size_t bufsize, __kernel_size_t32 *ret)
+qm_modules(char *buf, size_t bufsize, compat_size_t *ret)
 {
 	struct module *mod;
 	size_t nmod, space, len;
@@ -1337,7 +1125,7 @@
 }
 
 static int
-qm_deps(struct module *mod, char *buf, size_t bufsize, __kernel_size_t32 *ret)
+qm_deps(struct module *mod, char *buf, size_t bufsize, compat_size_t *ret)
 {
 	size_t i, space, len;
 
@@ -1374,7 +1162,7 @@
 }
 
 static int
-qm_refs(struct module *mod, char *buf, size_t bufsize, __kernel_size_t32 *ret)
+qm_refs(struct module *mod, char *buf, size_t bufsize, compat_size_t *ret)
 {
 	size_t nrefs, space, len;
 	struct module_ref *ref;
@@ -1418,7 +1206,7 @@
 }
 
 static inline int
-qm_symbols(struct module *mod, char *buf, size_t bufsize, __kernel_size_t32 *ret)
+qm_symbols(struct module *mod, char *buf, size_t bufsize, compat_size_t *ret)
 {
 	size_t i, space, len;
 	struct module_symbol *s;
@@ -1477,7 +1265,7 @@
 }
 
 static inline int
-qm_info(struct module *mod, char *buf, size_t bufsize, __kernel_size_t32 *ret)
+qm_info(struct module *mod, char *buf, size_t bufsize, compat_size_t *ret)
 {
 	int error = 0;
 
@@ -1505,7 +1293,7 @@
 	return error;
 }
 
-asmlinkage int sys32_query_module(char *name_user, int which, char *buf, __kernel_size_t32 bufsize, __kernel_size_t32 *ret)
+asmlinkage int sys32_query_module(char *name_user, int which, char *buf, compat_size_t bufsize, compat_size_t *ret)
 {
 	struct module *mod;
 	int err;
@@ -1776,14 +1564,14 @@
         u32               msg_name;
         int               msg_namelen;
         u32               msg_iov;
-        __kernel_size_t32 msg_iovlen;
+        compat_size_t msg_iovlen;
         u32               msg_control;
-        __kernel_size_t32 msg_controllen;
+        compat_size_t msg_controllen;
         unsigned          msg_flags;
 };
 
 struct cmsghdr32 {
-        __kernel_size_t32 cmsg_len;
+        compat_size_t cmsg_len;
         int               cmsg_level;
         int               cmsg_type;
 };
@@ -1917,7 +1705,7 @@
 {
 	struct cmsghdr32 *ucmsg;
 	struct cmsghdr *kcmsg, *kcmsg_base;
-	__kernel_size_t32 ucmlen;
+	compat_size_t ucmlen;
 	__kernel_size_t kcmlen, tmp;
 
 	kcmlen = 0;
@@ -2283,7 +2071,7 @@
 		err = move_addr_to_user(addr, kern_msg.msg_namelen, uaddr, uaddr_len);
 	if(cmsg_ptr != 0 && err >= 0) {
 		unsigned long ucmsg_ptr = ((unsigned long)kern_msg.msg_control);
-		__kernel_size_t32 uclen = (__kernel_size_t32) (ucmsg_ptr - cmsg_ptr);
+		compat_size_t uclen = (compat_size_t) (ucmsg_ptr - cmsg_ptr);
 		err |= __put_user(uclen, &user_msg->msg_controllen);
 	}
 	if(err >= 0)
@@ -2590,7 +2378,7 @@
 #define DIVIDE_ROUND_UP(x,y) (((x)+(y)-1)/(y))
 
 asmlinkage long
-sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, struct timeval32 *tvp)
+sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, struct compat_timeval *tvp)
 {
 	fd_set_bits fds;
 	char *bits;
@@ -2599,7 +2387,7 @@
 
 	timeout = MAX_SCHEDULE_TIMEOUT;
 	if (tvp) {
-		struct timeval32 tv32;
+		struct compat_timeval tv32;
 		time_t sec, usec;
 
 		if ((ret = copy_from_user(&tv32, tvp, sizeof tv32)))
@@ -2768,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;
@@ -2778,19 +2566,19 @@
 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;
 };
 
 /* UGIDUPDATE */
 struct nfsctl_uidmap32 {
-	__kernel_caddr_t32	ug_ident;
+	compat_caddr_t	ug_ident;
 	__kernel_uid_t		ug_uidbase;
 	int			ug_uidlen;
-	__kernel_caddr_t32	ug_udimap;
+	compat_caddr_t	ug_udimap;
 	__kernel_gid_t		ug_gidbase;
 	int			ug_gidlen;
-	__kernel_caddr_t32	ug_gdimap;
+	compat_caddr_t	ug_gdimap;
 };
 
 struct nfsctl_arg32 {
@@ -2903,8 +2691,8 @@
     __u32 dqb_ihardlimit;
     __u32 dqb_isoftlimit;
     __u32 dqb_curinodes;
-    __kernel_time_t32 dqb_btime;
-    __kernel_time_t32 dqb_itime;
+    compat_time_t dqb_btime;
+    compat_time_t dqb_itime;
 };
                                 
 
@@ -2965,7 +2753,7 @@
 	int tolerance;		/* clock frequency tolerance (ppm)
 				 * (read only)
 				 */
-	struct timeval32 time;	/* (read only) */
+	struct compat_timeval time;	/* (read only) */
 	int tick;		/* (modified) usecs between clock ticks */
 
 	int ppsfreq;           /* pps frequency (scaled ppm) (ro) */
diff -ruN 2.5.53/include/asm-parisc/compat.h 2.5.53-32bit.1/include/asm-parisc/compat.h
--- 2.5.53/include/asm-parisc/compat.h	1970-01-01 10:00:00.000000000 +1000
+++ 2.5.53-32bit.1/include/asm-parisc/compat.h	2002-12-30 15:44:32.000000000 +1100
@@ -0,0 +1,67 @@
+#ifndef _ASM_PARISC_COMPAT_H
+#define _ASM_PARISC_COMPAT_H
+/*
+ * Architecture specific compatibility types
+ */
+#include <linux/types.h>
+
+#define COMPAT_USER_HZ	100
+
+typedef u32		compat_size_t;
+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;
+typedef u16		compat_ipc_pid_t;
+typedef s32		compat_daddr_t;
+typedef u32		compat_caddr_t;
+
+struct compat_timespec {
+	compat_time_t	tv_sec;
+	s32		tv_nsec;
+};
+
+struct compat_timeval {
+	compat_time_t	tv_sec;
+	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.53/include/asm-parisc/posix_types.h 2.5.53-32bit.1/include/asm-parisc/posix_types.h
--- 2.5.53/include/asm-parisc/posix_types.h	2002-10-31 14:06:07.000000000 +1100
+++ 2.5.53-32bit.1/include/asm-parisc/posix_types.h	2002-12-30 15:44:48.000000000 +1100
@@ -55,27 +55,6 @@
 typedef __kernel_uid_t __kernel_old_uid_t;
 typedef __kernel_gid_t __kernel_old_gid_t;
 
-#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 unsigned int		__kernel_size_t32;
-typedef int			__kernel_ssize_t32;
-typedef int			__kernel_ptrdiff_t32;
-typedef int			__kernel_time_t32;
-typedef int			__kernel_suseconds_t32;
-typedef int			__kernel_clock_t32;
-typedef int			__kernel_daddr_t32;
-typedef unsigned int		__kernel_caddr_t32;
-#endif
-
 #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
 
 #undef __FD_SET

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

* Re: [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 1/7 PPC64
  2002-12-30  6:25 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 1/7 PPC64 Stephen Rothwell
@ 2003-01-02 15:58   ` Anton Blanchard
  0 siblings, 0 replies; 10+ messages in thread
From: Anton Blanchard @ 2003-01-02 15:58 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-kernel


> This includes that compat_..stat and compat_times calls and fixes a
> (pseudo) bug where the compatibility loff_t was defined as int (instead
> of signed 64 bit).

Thanks Stephen, Ive applied the ppc64 bits.

Anton

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

end of thread, other threads:[~2003-01-02 15:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-30  6:19 [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7 Stephen Rothwell
2002-12-30  6:25 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 1/7 PPC64 Stephen Rothwell
2003-01-02 15:58   ` Anton Blanchard
2002-12-30  6:31 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 2/7 SPARC64 Stephen Rothwell
2002-12-30  6:33 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 3/7 X86_64 Stephen Rothwell
2002-12-30  6:35 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 4/7 IA64 Stephen Rothwell
2002-12-30  6:38 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 0/7 Stephen Rothwell
2002-12-30  6:41   ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 5/7 S390X Stephen Rothwell
2002-12-30  6:43 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 6/7 MIPS64 Stephen Rothwell
2002-12-30  6:46 ` [PATCH][COMPAT] Eliminate the rest of the __kernel_..._t32 typedefs 7/7 PARISC Stephen Rothwell

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