]>
Commit | Line | Data |
---|---|---|
3fb50075 AV |
1 | #ifndef _ASM_UACCESS_H |
2 | #define _ASM_UACCESS_H | |
3 | ||
4 | #include <linux/string.h> | |
5 | ||
33ab2da8 AV |
6 | static inline __must_check unsigned long |
7 | raw_copy_from_user(void *to, const void __user * from, unsigned long n) | |
3fb50075 AV |
8 | { |
9 | if (__builtin_constant_p(n)) { | |
10 | switch(n) { | |
11 | case 1: | |
12 | *(u8 *)to = *(u8 __force *)from; | |
13 | return 0; | |
14 | case 2: | |
15 | *(u16 *)to = *(u16 __force *)from; | |
16 | return 0; | |
17 | case 4: | |
18 | *(u32 *)to = *(u32 __force *)from; | |
19 | return 0; | |
20 | } | |
21 | } | |
22 | ||
23 | memcpy(to, (const void __force *)from, n); | |
24 | return 0; | |
25 | } | |
26 | ||
33ab2da8 AV |
27 | static inline __must_check unsigned long |
28 | raw_copy_to_user(void __user *to, const void *from, unsigned long n) | |
3fb50075 AV |
29 | { |
30 | if (__builtin_constant_p(n)) { | |
31 | switch(n) { | |
32 | case 1: | |
33 | *(u8 __force *)to = *(u8 *)from; | |
34 | return 0; | |
35 | case 2: | |
36 | *(u16 __force *)to = *(u16 *)from; | |
37 | return 0; | |
38 | case 4: | |
39 | *(u32 __force *)to = *(u32 *)from; | |
40 | return 0; | |
41 | default: | |
42 | break; | |
43 | } | |
44 | } | |
45 | ||
46 | memcpy((void __force *)to, from, n); | |
47 | return 0; | |
48 | } | |
33ab2da8 AV |
49 | #define INLINE_COPY_FROM_USER |
50 | #define INLINE_COPY_TO_USER | |
3fb50075 AV |
51 | |
52 | #include <asm-generic/uaccess.h> | |
53 | ||
54 | #endif |