OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [x86_64/] [lib/] [old-checksum.c] - Blame information for rev 1781

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * Temporal C versions of the checksum functions until optimized assembler versions
3
 * can go in.
4
 */
5
 
6
#include <net/checksum.h>
7
 
8
/*
9
 * Copy from userspace and compute checksum.  If we catch an exception
10
 * then zero the rest of the buffer.
11
 */
12
unsigned int csum_partial_copy_from_user (const char *src, char *dst,
13
                                          int len, unsigned int sum,
14
                                          int *err_ptr)
15
{
16
        int missing;
17
 
18
        missing = copy_from_user(dst, src, len);
19
        if (missing) {
20
                memset(dst + len - missing, 0, missing);
21
                *err_ptr = -EFAULT;
22
        }
23
 
24
        return csum_partial(dst, len, sum);
25
}
26
 
27
unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum)
28
{
29
        memcpy(dst,src,len);
30
        return csum_partial(dst,len,sum);
31
}
32
 
33
/* Fallback for csum_and_copy_to_user is currently in include/net/checksum.h */

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.