linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: davidm@hpl.hp.com
Cc: linux-kernel@vger.kernel.org, Linus <torvalds@transmeta.com>
Subject: [PATCH][COMPAT] compat_sys_fcntl{,64} 5/9 ia64 part
Date: Tue, 4 Mar 2003 17:10:34 +1100	[thread overview]
Message-ID: <20030304171034.40b12e85.sfr@canb.auug.org.au> (raw)
In-Reply-To: <20030304165812.7141f7c0.sfr@canb.auug.org.au>

Hi David,

Here is the IA64 part of the patch.

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

diff -ruN 2.5.63-32bit.1/arch/ia64/ia32/ia32_entry.S 2.5.63-32bit.2/arch/ia64/ia32/ia32_entry.S
--- 2.5.63-32bit.1/arch/ia64/ia32/ia32_entry.S	2003-02-25 14:35:17.000000000 +1100
+++ 2.5.63-32bit.2/arch/ia64/ia32/ia32_entry.S	2003-02-25 14:35:59.000000000 +1100
@@ -253,7 +253,7 @@
 	data8 sys_umount	  /* recycled never used phys( */
 	data8 sys32_ni_syscall	  /* old lock syscall holder */
 	data8 sys32_ioctl
-	data8 sys32_fcntl	  /* 55 */
+	data8 compat_sys_fcntl	  /* 55 */
 	data8 sys32_ni_syscall	  /* old mpx syscall holder */
 	data8 sys_setpgid
 	data8 sys32_ni_syscall	  /* old ulimit syscall holder */
@@ -419,7 +419,7 @@
 	data8 sys_mincore
 	data8 sys_madvise
 	data8 sys_getdents64	  /* 220 */
-	data8 sys32_fcntl64
+	data8 compat_sys_fcntl64
 	data8 sys_ni_syscall		/* reserved for TUX */
 	data8 sys_ni_syscall		/* reserved for Security */
 	data8 sys_gettid
diff -ruN 2.5.63-32bit.1/arch/ia64/ia32/sys_ia32.c 2.5.63-32bit.2/arch/ia64/ia32/sys_ia32.c
--- 2.5.63-32bit.1/arch/ia64/ia32/sys_ia32.c	2003-02-25 12:59:25.000000000 +1100
+++ 2.5.63-32bit.2/arch/ia64/ia32/sys_ia32.c	2003-02-25 14:35:59.000000000 +1100
@@ -2966,38 +2966,6 @@
 	return ret;
 }
 
-extern asmlinkage long sys_fcntl (unsigned int fd, unsigned int cmd, unsigned long arg);
-
-asmlinkage long
-sys32_fcntl (unsigned int fd, unsigned int cmd, unsigned int arg)
-{
-	mm_segment_t old_fs;
-	struct flock f;
-	long ret;
-
-	switch (cmd) {
-	      case F_GETLK:
-	      case F_SETLK:
-	      case F_SETLKW:
-		if (get_compat_flock(&f, (struct compat_flock *) A(arg)))
-			return -EFAULT;
-		old_fs = get_fs();
-		set_fs(KERNEL_DS);
-		ret = sys_fcntl(fd, cmd, (unsigned long) &f);
-		set_fs(old_fs);
-		if (cmd == F_GETLK && put_compat_flock(&f, (struct compat_flock *) A(arg)))
-			return -EFAULT;
-		return ret;
-
-	      default:
-		/*
-		 *  `sys_fcntl' lies about arg, for the F_SETOWN
-		 *  sub-function arg can have a negative value.
-		 */
-		return sys_fcntl(fd, cmd, arg);
-	}
-}
-
 asmlinkage long sys_ni_syscall(void);
 
 asmlinkage long
@@ -3288,66 +3256,6 @@
 	return ret;
 }
 
-/*
- * Unfortunately, the x86 compiler aligns variables of type "long long" to a 4 byte boundary
- * only, which means that the x86 version of "struct flock64" doesn't match the ia64 version
- * of struct flock.
- */
-
-static inline long
-ia32_put_flock (struct flock *l, unsigned long addr)
-{
-	return (put_user(l->l_type, (short *) addr)
-		| put_user(l->l_whence, (short *) (addr + 2))
-		| put_user(l->l_start, (long *) (addr + 4))
-		| put_user(l->l_len, (long *) (addr + 12))
-		| put_user(l->l_pid, (int *) (addr + 20)));
-}
-
-static inline long
-ia32_get_flock (struct flock *l, unsigned long addr)
-{
-	unsigned int start_lo, start_hi, len_lo, len_hi;
-	int err = (get_user(l->l_type, (short *) addr)
-		   | get_user(l->l_whence, (short *) (addr + 2))
-		   | get_user(start_lo, (int *) (addr + 4))
-		   | get_user(start_hi, (int *) (addr + 8))
-		   | get_user(len_lo, (int *) (addr + 12))
-		   | get_user(len_hi, (int *) (addr + 16))
-		   | get_user(l->l_pid, (int *) (addr + 20)));
-	l->l_start = ((unsigned long) start_hi << 32) | start_lo;
-	l->l_len = ((unsigned long) len_hi << 32) | len_lo;
-	return err;
-}
-
-asmlinkage long
-sys32_fcntl64 (unsigned int fd, unsigned int cmd, unsigned int arg)
-{
-	mm_segment_t old_fs;
-	struct flock f;
-	long ret;
-
-	switch (cmd) {
-	      case F_GETLK64:
-	      case F_SETLK64:
-	      case F_SETLKW64:
-		if (ia32_get_flock(&f, arg))
-			return -EFAULT;
-		old_fs = get_fs();
-		set_fs(KERNEL_DS);
-		ret = sys_fcntl(fd, cmd, (unsigned long) &f);
-		set_fs(old_fs);
-		if (cmd == F_GETLK && ia32_put_flock(&f, arg))
-			return -EFAULT;
-		break;
-
-	      default:
-		ret = sys32_fcntl(fd, cmd, arg);
-		break;
-	}
-	return ret;
-}
-
 asmlinkage long
 sys32_truncate64 (unsigned int path, unsigned int len_lo, unsigned int len_hi)
 {
diff -ruN 2.5.63-32bit.1/include/asm-ia64/compat.h 2.5.63-32bit.2/include/asm-ia64/compat.h
--- 2.5.63-32bit.1/include/asm-ia64/compat.h	2003-02-11 09:39:57.000000000 +1100
+++ 2.5.63-32bit.2/include/asm-ia64/compat.h	2003-02-25 14:35:59.000000000 +1100
@@ -68,6 +68,22 @@
 	compat_pid_t	l_pid;
 };
 
+#define F_GETLK64	12
+#define F_SETLK64	13
+#define F_SETLKW64	14
+
+/*
+ * IA32 uses 4 byte alignment for 64 bit quantities,
+ * so we need to pack this structure.
+ */
+struct compat_flock64 {
+	short		l_type;
+	short		l_whence;
+	compat_loff_t	l_start;
+	compat_loff_t	l_len;
+	compat_pid_t	l_pid;
+} __attribute__((packed));
+
 struct compat_statfs {
 	int		f_type;
 	int		f_bsize;
@@ -88,4 +104,7 @@
 
 typedef u32		compat_sigset_word;
 
+#define COMPAT_OFF_T_MAX	0x7fffffff
+#define COMPAT_LOFF_T_MAX	0x7fffffffffffffffL
+
 #endif /* _ASM_IA64_COMPAT_H */
diff -ruN 2.5.63-32bit.1/include/asm-ia64/fcntl.h 2.5.63-32bit.2/include/asm-ia64/fcntl.h
--- 2.5.63-32bit.1/include/asm-ia64/fcntl.h	2000-10-10 11:54:58.000000000 +1100
+++ 2.5.63-32bit.2/include/asm-ia64/fcntl.h	2003-02-25 14:35:59.000000000 +1100
@@ -78,9 +78,6 @@
 	pid_t l_pid;
 };
 
-#ifdef __KERNEL__
-# define flock64	flock
-#endif
-
 #define F_LINUX_SPECIFIC_BASE	1024
+
 #endif /* _ASM_IA64_FCNTL_H */
diff -ruN 2.5.63-32bit.1/include/asm-ia64/ia32.h 2.5.63-32bit.2/include/asm-ia64/ia32.h
--- 2.5.63-32bit.1/include/asm-ia64/ia32.h	2003-02-11 09:39:57.000000000 +1100
+++ 2.5.63-32bit.2/include/asm-ia64/ia32.h	2003-02-25 14:35:59.000000000 +1100
@@ -18,10 +18,6 @@
 #define IA32_PAGE_ALIGN(addr)	(((addr) + IA32_PAGE_SIZE - 1) & IA32_PAGE_MASK)
 #define IA32_CLOCKS_PER_SEC	100	/* Cast in stone for IA32 Linux */
 
-#define F_GETLK64	12
-#define F_SETLK64	13
-#define F_SETLKW64	14
-
 /* sigcontext.h */
 /*
  * As documented in the iBCS2 standard..

  parent reply	other threads:[~2003-03-04  6:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-04  5:58 [PATCH][COMPAT] compat_sys_fcntl{,64} 1/9 Generic part Stephen Rothwell
2003-03-04  6:00 ` [PATCH][COMPAT] compat_sys_fcntl{,64} 2/9 PPC64 part Stephen Rothwell
2003-03-04  6:02 ` [PATCH][COMPAT] compat_sys_fcntl{,64} 3/9 SPARC64 part Stephen Rothwell
2003-03-04  6:06 ` [PATCH][COMPAT] compat_sys_fcntl{,64} 4/9 x86_64 part Stephen Rothwell
2003-03-04  6:10 ` Stephen Rothwell [this message]
2003-03-04  6:12 ` [PATCH][COMPAT] compat_sys_fcntl{,64} 6/9 s390x part Stephen Rothwell
2003-03-04  6:15 ` [PATCH][COMPAT] compat_sys_fcntl{,64} 7/9 MIPS64 part Stephen Rothwell
2003-03-04  6:17 ` [PATCH][COMPAT] compat_sys_fcntl{,64} 8/9 PARISC part Stephen Rothwell
2003-03-04  6:20 ` [PATCH][COMPAT] compat_sys_fcntl{,64} 9/9 Alpha part Stephen Rothwell
2003-03-11  0:41 [PATCH][COMPAT] compat_sys_fcntl{,64} 1/9 Generic part Stephen Rothwell
2003-03-11  0:54 ` [PATCH][COMPAT] compat_sys_fcntl{,64} 5/9 ia64 part Stephen Rothwell

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20030304171034.40b12e85.sfr@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=davidm@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).