summaryrefslogtreecommitdiffstats
path: root/include/asm-mips/checksum.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-16 01:07:24 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-16 01:07:24 +0000
commit95db6b748fc86297827fbd9c9ef174d491c9ad89 (patch)
tree27a92a942821cde1edda9a1b088718d436b3efe4 /include/asm-mips/checksum.h
parent45b27b0a0652331d104c953a5b192d843fff88f8 (diff)
Merge with Linux 2.3.40.
Diffstat (limited to 'include/asm-mips/checksum.h')
-rw-r--r--include/asm-mips/checksum.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
index 6ca4bd70e..5d4f314dc 100644
--- a/include/asm-mips/checksum.h
+++ b/include/asm-mips/checksum.h
@@ -1,4 +1,4 @@
-/* $Id: checksum.h,v 1.5 1998/07/10 01:14:54 ralf Exp $
+/* $Id: checksum.h,v 1.6 1998/09/19 19:19:36 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -6,8 +6,8 @@
*
* Copyright (C) 1995, 1996, 1997, 1998 by Ralf Baechle
*/
-#ifndef __ASM_MIPS_CHECKSUM_H
-#define __ASM_MIPS_CHECKSUM_H
+#ifndef _ASM_CHECKSUM_H
+#define _ASM_CHECKSUM_H
/*
* computes the checksum of a memory block at buff, length len,
@@ -36,9 +36,23 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
unsigned int csum_partial_copy_from_user(const char *src, char *dst, int len,
unsigned int sum, int *errp);
+/*
+ * Copy and checksum to user
+ */
#define HAVE_CSUM_COPY_USER
-unsigned int csum_and_copy_to_user (const char *src, char *dst,
- int len, int sum, int *err_ptr);
+extern inline unsigned int
+csum_and_copy_to_user (const char *src, char *dst,
+ int len, int sum, int *err_ptr)
+{
+ sum = csum_partial(src, len, sum);
+
+ if (copy_to_user(dst, src, len)) {
+ *err_ptr = -EFAULT;
+ return -1;
+ }
+
+ return sum;
+}
/*
* the same as csum_partial, but copies from user space (but on MIPS
@@ -252,4 +266,4 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
return csum_fold(sum);
}
-#endif /* __ASM_MIPS_CHECKSUM_H */
+#endif /* _ASM_CHECKSUM_H */