mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][COMPAT] move struct flock32 1/8 generic
@ 2003-01-03  5:41 Stephen Rothwell
  2003-01-03  5:55 ` [PATCH][COMPAT] move struct flock32 2/8 ppc64 Stephen Rothwell
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Stephen Rothwell @ 2003-01-03  5:41 UTC (permalink / raw)
  To: Linus
  Cc: LKML, anton, David S. Miller, ak, davidm, schwidefsky, ralf, matthew

Hi Linus,

This patch moves struct flock32 to struct compat_flock and consolidates
the functions used to copy it to/from user mode.

The overall diffstat looks like this:
 arch/ia64/ia32/sys_ia32.c         |   36 ++----------------------------------
 arch/mips64/kernel/linux32.c      |   37 ++-----------------------------------
 arch/parisc/kernel/sys_parisc32.c |   37 ++-----------------------------------
 arch/ppc64/kernel/sys_ppc32.c     |   28 ++--------------------------
 arch/s390x/kernel/linux32.c       |   30 +++---------------------------
 arch/s390x/kernel/linux32.h       |    9 ---------
 arch/sparc64/kernel/sys_sparc32.c |   28 ++--------------------------
 arch/x86_64/ia32/sys_ia32.c       |   28 ++--------------------------
 fs/compat.c                       |   31 +++++++++++++++++++++++++++++++
 include/asm-ia64/compat.h         |    8 ++++++++
 include/asm-ia64/ia32.h           |    9 ---------
 include/asm-mips64/compat.h       |    9 +++++++++
 include/asm-parisc/compat.h       |    8 ++++++++
 include/asm-ppc64/compat.h        |    9 +++++++++
 include/asm-ppc64/ppc32.h         |    9 ---------
 include/asm-s390x/compat.h        |    9 +++++++++
 include/asm-sparc64/compat.h      |    9 +++++++++
 include/asm-sparc64/fcntl.h       |   13 -------------
 include/asm-x86_64/compat.h       |    8 ++++++++
 include/asm-x86_64/ia32.h         |   10 ----------
 include/linux/compat.h            |    3 +++
 21 files changed, 109 insertions(+), 259 deletions(-)

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

diff -ruN 2.5.54-200301031304-32bit.1/fs/compat.c 2.5.54-200301031304-32bit.2/fs/compat.c
--- 2.5.54-200301031304-32bit.1/fs/compat.c	2002-12-16 14:49:52.000000000 +1100
+++ 2.5.54-200301031304-32bit.2/fs/compat.c	2003-01-03 16:24:56.000000000 +1100
@@ -16,6 +16,7 @@
 #include <linux/errno.h>
 #include <linux/time.h>
 #include <linux/fs.h>
+#include <linux/fcntl.h>
 
 #include <asm/uaccess.h>
 
@@ -70,3 +71,33 @@
 		error = cp_compat_stat(&stat, statbuf);
 	return error;
 }
+
+int get_compat_flock(struct flock *kfl, struct compat_flock *ufl)
+{
+	int err;
+
+	if (!access_ok(VERIFY_READ, ufl, sizeof(*ufl)))
+		return -EFAULT;
+
+	err = __get_user(kfl->l_type, &ufl->l_type);
+	err |= __get_user(kfl->l_whence, &ufl->l_whence);
+	err |= __get_user(kfl->l_start, &ufl->l_start);
+	err |= __get_user(kfl->l_len, &ufl->l_len);
+	err |= __get_user(kfl->l_pid, &ufl->l_pid);
+	return err;
+}
+
+int put_compat_flock(struct flock *kfl, struct compat_flock *ufl)
+{
+	int err;
+
+	if (!access_ok(VERIFY_WRITE, ufl, sizeof(*ufl)))
+		return -EFAULT;
+
+	err = __put_user(kfl->l_type, &ufl->l_type);
+	err |= __put_user(kfl->l_whence, &ufl->l_whence);
+	err |= __put_user(kfl->l_start, &ufl->l_start);
+	err |= __put_user(kfl->l_len, &ufl->l_len);
+	err |= __put_user(kfl->l_pid, &ufl->l_pid);
+	return err;
+}
diff -ruN 2.5.54-200301031304-32bit.1/include/linux/compat.h 2.5.54-200301031304-32bit.2/include/linux/compat.h
--- 2.5.54-200301031304-32bit.1/include/linux/compat.h	2003-01-03 14:08:45.000000000 +1100
+++ 2.5.54-200301031304-32bit.2/include/linux/compat.h	2003-01-03 16:25:50.000000000 +1100
@@ -10,6 +10,7 @@
 
 #include <linux/stat.h>
 #include <linux/param.h>	/* for HZ */
+#include <linux/fcntl.h>	/* for struct flock */
 #include <asm/compat.h>
 
 #define compat_jiffies_to_clock_t(x)	\
@@ -33,6 +34,8 @@
 };
 
 extern int cp_compat_stat(struct kstat *, struct compat_stat *);
+extern int get_compat_flock(struct flock *, struct compat_flock *);
+extern int put_compat_flock(struct flock *, struct compat_flock *);
 
 #endif /* CONFIG_COMPAT */
 #endif /* _LINUX_COMPAT_H */

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

end of thread, other threads:[~2003-01-06  7:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-03  5:41 [PATCH][COMPAT] move struct flock32 1/8 generic Stephen Rothwell
2003-01-03  5:55 ` [PATCH][COMPAT] move struct flock32 2/8 ppc64 Stephen Rothwell
2003-01-03  6:21 ` [PATCH][COMPAT] move struct flock32 3/8 sparc64 Stephen Rothwell
2003-01-04  2:56   ` David S. Miller
2003-01-04  6:18     ` Stephen Rothwell
2003-01-06  7:00       ` David S. Miller
2003-01-03  6:25 ` [PATCH][COMPAT] move struct flock32 4/8 x86_64 Stephen Rothwell
2003-01-03  6:28 ` [PATCH][COMPAT] move struct flock32 5/8 ia64 Stephen Rothwell
2003-01-03  6:35 ` [PATCH][COMPAT] move struct flock32 6/8 s390x Stephen Rothwell
2003-01-03  6:39 ` [PATCH][COMPAT] move struct flock32 7/8 mips64 Stephen Rothwell
2003-01-03  6:42 ` [PATCH][COMPAT] move struct flock32 8/8 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

Powered by JetHome