lkml.org 
[lkml]   [2003]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH][COMPAT] move struct flock32 1/8 generic
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 */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.100 / U:1.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site