diff options
author | David Howells <dhowells@redhat.com> | 2006-01-08 04:01:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-08 23:13:36 -0500 |
commit | 402344012ebe696d9353bbf056889ddaaec83079 (patch) | |
tree | 4a4072bdfe80be4c565d01a9188ef5da3a31e19a /arch/frv/lib/checksum.c | |
parent | 8369ce4cfe18decc3ea0afcf91e67c665479c78e (diff) |
[PATCH] frv: implement and export various things required by modules
Export a number of features required to build all the modules. It also
implements the following simple features:
(*) csum_partial_copy_from_user() for MMU as well as no-MMU.
(*) __ucmpdi2().
so that they can be exported too.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/frv/lib/checksum.c')
-rw-r--r-- | arch/frv/lib/checksum.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/arch/frv/lib/checksum.c b/arch/frv/lib/checksum.c index 7bf5bd6cac8a..20e7dfc474ef 100644 --- a/arch/frv/lib/checksum.c +++ b/arch/frv/lib/checksum.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include <net/checksum.h> | 34 | #include <net/checksum.h> |
35 | #include <asm/checksum.h> | 35 | #include <asm/checksum.h> |
36 | #include <linux/module.h> | ||
36 | 37 | ||
37 | static inline unsigned short from32to16(unsigned long x) | 38 | static inline unsigned short from32to16(unsigned long x) |
38 | { | 39 | { |
@@ -115,34 +116,52 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) | |||
115 | return result; | 116 | return result; |
116 | } | 117 | } |
117 | 118 | ||
119 | EXPORT_SYMBOL(csum_partial); | ||
120 | |||
118 | /* | 121 | /* |
119 | * this routine is used for miscellaneous IP-like checksums, mainly | 122 | * this routine is used for miscellaneous IP-like checksums, mainly |
120 | * in icmp.c | 123 | * in icmp.c |
121 | */ | 124 | */ |
122 | unsigned short ip_compute_csum(const unsigned char * buff, int len) | 125 | unsigned short ip_compute_csum(const unsigned char * buff, int len) |
123 | { | 126 | { |
124 | return ~do_csum(buff,len); | 127 | return ~do_csum(buff, len); |
125 | } | 128 | } |
126 | 129 | ||
130 | EXPORT_SYMBOL(ip_compute_csum); | ||
131 | |||
127 | /* | 132 | /* |
128 | * copy from fs while checksumming, otherwise like csum_partial | 133 | * copy from fs while checksumming, otherwise like csum_partial |
129 | */ | 134 | */ |
130 | |||
131 | unsigned int | 135 | unsigned int |
132 | csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *csum_err) | 136 | csum_partial_copy_from_user(const char __user *src, char *dst, |
137 | int len, int sum, int *csum_err) | ||
133 | { | 138 | { |
134 | if (csum_err) *csum_err = 0; | 139 | int rem; |
135 | memcpy(dst, src, len); | 140 | |
141 | if (csum_err) | ||
142 | *csum_err = 0; | ||
143 | |||
144 | rem = copy_from_user(dst, src, len); | ||
145 | if (rem != 0) { | ||
146 | if (csum_err) | ||
147 | *csum_err = -EFAULT; | ||
148 | memset(dst + len - rem, 0, rem); | ||
149 | len = rem; | ||
150 | } | ||
151 | |||
136 | return csum_partial(dst, len, sum); | 152 | return csum_partial(dst, len, sum); |
137 | } | 153 | } |
138 | 154 | ||
155 | EXPORT_SYMBOL(csum_partial_copy_from_user); | ||
156 | |||
139 | /* | 157 | /* |
140 | * copy from ds while checksumming, otherwise like csum_partial | 158 | * copy from ds while checksumming, otherwise like csum_partial |
141 | */ | 159 | */ |
142 | |||
143 | unsigned int | 160 | unsigned int |
144 | csum_partial_copy(const char *src, char *dst, int len, int sum) | 161 | csum_partial_copy(const char *src, char *dst, int len, int sum) |
145 | { | 162 | { |
146 | memcpy(dst, src, len); | 163 | memcpy(dst, src, len); |
147 | return csum_partial(dst, len, sum); | 164 | return csum_partial(dst, len, sum); |
148 | } | 165 | } |
166 | |||
167 | EXPORT_SYMBOL(csum_partial_copy); | ||