MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / x86_64 / lib / old-checksum.c
blob20d5b8f633d36b7a1651e1e36c476c9f666a6ec2
1 /*
2 * Temporal C versions of the checksum functions until optimized assembler versions
3 * can go in.
4 */
6 #include <net/checksum.h>
8 /*
9 * Copy from userspace and compute checksum. If we catch an exception
10 * then zero the rest of the buffer.
12 unsigned int csum_partial_copy_from_user (const char *src, char *dst,
13 int len, unsigned int sum,
14 int *err_ptr)
16 int missing;
18 missing = copy_from_user(dst, src, len);
19 if (missing) {
20 memset(dst + len - missing, 0, missing);
21 *err_ptr = -EFAULT;
24 return csum_partial(dst, len, sum);
27 unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum)
29 memcpy(dst,src,len);
30 return csum_partial(dst,len,sum);
33 /* Fallback for csum_and_copy_to_user is currently in include/net/checksum.h */