Provide example copy_in_user implementation

Pavel Machek (pavel@ucw.cz)
Tue, 24 Jun 2003 12:06:10 +0200


Hi!

This patch adds example copy_in_user implementation (copy_in_user is
needed for new ioctl32 implementation, all 64bit archs will need
it)... Please apply,

Pavel

Index: linux/include/asm-generic/uaccess.h
===================================================================
--- linux.orig/include/asm-generic/uaccess.h 2003-06-17 17:10:44.000000000 +0200
+++ linux/include/asm-generic/uaccess.h 2003-06-16 16:09:52.000000000 +0200
@@ -0,0 +1,13 @@
+static inline unsigned long copy_in_user(void *dst, const void *src, unsigned size)
+{
+ unsigned i, ret;
+ unsigned char c;
+ for (i=0; i<size; i++) {
+ if (copy_from_user(&c, src+i, 1))
+ return size-i;
+ if (copy_to_user(dst+i, &c, 1))
+ return size-i;
+ }
+ return 0;
+}
+

-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
-
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/