diff options
| author | David S. Miller <davem@kernel.bkbits.net> | 2003-04-09 08:58:28 -0700 |
|---|---|---|
| committer | David S. Miller <davem@kernel.bkbits.net> | 2003-04-09 08:58:28 -0700 |
| commit | 28f1742823594dfa896fdef36853ecd7eb7f1781 (patch) | |
| tree | cc9692ff5feaf86e2f88117a90a5a0b5066cb60c /include | |
| parent | 5edf8b9a4208987e60e0f41aff0bcc298641c0ad (diff) | |
| parent | c9b6254d1840a3eb0a5bffc8f8af8972d2090300 (diff) | |
Merge davem@nuts.ninka.net:/home/davem/src/BK/sparc-2.5
into kernel.bkbits.net:/home/davem/sparc-2.5
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-generic/siginfo.h | 1 | ||||
| -rw-r--r-- | include/asm-sparc/signal.h | 18 | ||||
| -rw-r--r-- | include/asm-sparc/uaccess.h | 145 | ||||
| -rw-r--r-- | include/asm-sparc64/signal.h | 18 | ||||
| -rw-r--r-- | include/asm-sparc64/uaccess.h | 47 |
5 files changed, 111 insertions, 118 deletions
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h index 209ba0222647..e12f55dbaee9 100644 --- a/include/asm-generic/siginfo.h +++ b/include/asm-generic/siginfo.h @@ -1,6 +1,7 @@ #ifndef _ASM_GENERIC_SIGINFO_H #define _ASM_GENERIC_SIGINFO_H +#include <linux/compiler.h> #include <linux/types.h> typedef union sigval { diff --git a/include/asm-sparc/signal.h b/include/asm-sparc/signal.h index dca2ae21f286..d8b0d4463184 100644 --- a/include/asm-sparc/signal.h +++ b/include/asm-sparc/signal.h @@ -118,10 +118,10 @@ struct sigstack { }; /* Sigvec flags */ -#define SV_SSTACK 1 /* This signal handler should use sig-stack */ -#define SV_INTR 2 /* Sig return should not restart system call */ -#define SV_RESET 4 /* Set handler to SIG_DFL upon taken signal */ -#define SV_IGNCHILD 8 /* Do not send SIGCHLD */ +#define SV_SSTACK 1u /* This signal handler should use sig-stack */ +#define SV_INTR 2u /* Sig return should not restart system call */ +#define SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */ +#define SV_IGNCHILD 8u /* Do not send SIGCHLD */ /* * sa_flags values: SA_STACK is not currently supported, but will allow the @@ -137,11 +137,11 @@ struct sigstack { #define SA_ONSTACK SV_SSTACK #define SA_RESTART SV_INTR #define SA_ONESHOT SV_RESET -#define SA_INTERRUPT 0x10 -#define SA_NOMASK 0x20 -#define SA_SHIRQ 0x40 -#define SA_NOCLDWAIT 0x100 -#define SA_SIGINFO 0x200 +#define SA_INTERRUPT 0x10u +#define SA_NOMASK 0x20u +#define SA_SHIRQ 0x40u +#define SA_NOCLDWAIT 0x100u +#define SA_SIGINFO 0x200u #define SIG_BLOCK 0x01 /* for blocking signals */ #define SIG_UNBLOCK 0x02 /* for unblocking signals */ diff --git a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h index 8abd61f88991..68e718b07ef5 100644 --- a/include/asm-sparc/uaccess.h +++ b/include/asm-sparc/uaccess.h @@ -8,6 +8,7 @@ #define _ASM_UACCESS_H #ifdef __KERNEL__ +#include <linux/compiler.h> #include <linux/sched.h> #include <linux/string.h> #include <linux/errno.h> @@ -45,7 +46,7 @@ #define __access_ok(addr,size) (__user_ok((addr) & get_fs().seg,(size))) #define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) -extern inline int verify_area(int type, const void * addr, unsigned long size) +static inline int verify_area(int type, const void __user * addr, unsigned long size) { return access_ok(type,addr,size)?0:-EFAULT; } @@ -291,87 +292,87 @@ __asm__ __volatile__( \ extern int __get_user_bad(void); -extern __kernel_size_t __copy_user(void *to, void *from, __kernel_size_t size); - -#define copy_to_user(to,from,n) ({ \ -void *__copy_to = (void *) (to); \ -__kernel_size_t __copy_size = (__kernel_size_t) (n); \ -__kernel_size_t __copy_res; \ -if(__copy_size && __access_ok((unsigned long)__copy_to, __copy_size)) { \ -__copy_res = __copy_user(__copy_to, (void *) (from), __copy_size); \ -} else __copy_res = __copy_size; \ -__copy_res; }) - -#define __copy_to_user(to,from,n) \ - __copy_user((void *)(to), \ - (void *)(from), n) - -#define copy_from_user(to,from,n) ({ \ -void *__copy_to = (void *) (to); \ -void *__copy_from = (void *) (from); \ -__kernel_size_t __copy_size = (__kernel_size_t) (n); \ -__kernel_size_t __copy_res; \ -if(__copy_size && __access_ok((unsigned long)__copy_from, __copy_size)) { \ -__copy_res = __copy_user(__copy_to, __copy_from, __copy_size); \ -} else __copy_res = __copy_size; \ -__copy_res; }) - -#define __copy_from_user(to,from,n) \ - __copy_user((void *)(to), \ - (void *)(from), n) - -extern __inline__ __kernel_size_t __clear_user(void *addr, __kernel_size_t size) +extern unsigned long __copy_user(void *to, const void *from, unsigned long size); + +static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) { - __kernel_size_t ret; - __asm__ __volatile__ ( - ".section __ex_table,#alloc\n\t" - ".align 4\n\t" - ".word 1f,3\n\t" - ".previous\n\t" - "mov %2, %%o1\n" - "1:\n\t" - "call __bzero\n\t" - " mov %1, %%o0\n\t" - "mov %%o0, %0\n" - : "=r" (ret) : "r" (addr), "r" (size) : - "o0", "o1", "o2", "o3", "o4", "o5", "o7", - "g1", "g2", "g3", "g4", "g5", "g7", "cc"); - return ret; + if (n && __access_ok((unsigned long) to, n)) + return __copy_user((void *) to, from, n); + else + return n; } -#define clear_user(addr,n) ({ \ -void *__clear_addr = (void *) (addr); \ -__kernel_size_t __clear_size = (__kernel_size_t) (n); \ -__kernel_size_t __clear_res; \ -if(__clear_size && __access_ok((unsigned long)__clear_addr, __clear_size)) { \ -__clear_res = __clear_user(__clear_addr, __clear_size); \ -} else __clear_res = __clear_size; \ -__clear_res; }) - -extern int __strncpy_from_user(unsigned long dest, unsigned long src, int count); - -#define strncpy_from_user(dest,src,count) ({ \ -unsigned long __sfu_src = (unsigned long) (src); \ -int __sfu_count = (int) (count); \ -long __sfu_res = -EFAULT; \ -if(__access_ok(__sfu_src, __sfu_count)) { \ -__sfu_res = __strncpy_from_user((unsigned long) (dest), __sfu_src, __sfu_count); \ -} __sfu_res; }) - -extern int __strlen_user(const char *); -extern int __strnlen_user(const char *, long len); - -extern __inline__ int strlen_user(const char *str) +static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) +{ + return __copy_user((void *)to, from, n); +} + +static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) +{ + if (n && __access_ok((unsigned long) from, n)) + return __copy_user(to, (void *) from, n); + else + return n; +} + +static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) +{ + return __copy_user(to, (void *)from, n); +} + +static inline unsigned long __clear_user(void __user *addr, unsigned long size) +{ + unsigned long ret; + + __asm__ __volatile__ ( + ".section __ex_table,#alloc\n\t" + ".align 4\n\t" + ".word 1f,3\n\t" + ".previous\n\t" + "mov %2, %%o1\n" + "1:\n\t" + "call __bzero\n\t" + " mov %1, %%o0\n\t" + "mov %%o0, %0\n" + : "=r" (ret) : "r" (addr), "r" (size) : + "o0", "o1", "o2", "o3", "o4", "o5", "o7", + "g1", "g2", "g3", "g4", "g5", "g7", "cc"); + + return ret; +} + +static inline unsigned long clear_user(void __user *addr, unsigned long n) +{ + if (n && __access_ok((unsigned long) addr, n)) + return __clear_user(addr, n); + else + return n; +} + +extern long __strncpy_from_user(char *dest, const char __user *src, long count); + +static inline long strncpy_from_user(char *dest, const char __user *src, long count) +{ + if (__access_ok((unsigned long) src, count)) + return __strncpy_from_user(dest, src, count); + else + return -EFAULT; +} + +extern long __strlen_user(const char __user *); +extern long __strnlen_user(const char __user *, long len); + +static inline long strlen_user(const char __user *str) { - if(!access_ok(VERIFY_READ, str, 0)) + if (!access_ok(VERIFY_READ, str, 0)) return 0; else return __strlen_user(str); } -extern __inline__ int strnlen_user(const char *str, long len) +static inline long strnlen_user(const char __user *str, long len) { - if(!access_ok(VERIFY_READ, str, 0)) + if (!access_ok(VERIFY_READ, str, 0)) return 0; else return __strnlen_user(str, len); diff --git a/include/asm-sparc64/signal.h b/include/asm-sparc64/signal.h index 73f5f5b307ac..24bda08d6173 100644 --- a/include/asm-sparc64/signal.h +++ b/include/asm-sparc64/signal.h @@ -123,10 +123,10 @@ struct sigstack { }; /* Sigvec flags */ -#define SV_SSTACK 1 /* This signal handler should use sig-stack */ -#define SV_INTR 2 /* Sig return should not restart system call */ -#define SV_RESET 4 /* Set handler to SIG_DFL upon taken signal */ -#define SV_IGNCHILD 8 /* Do not send SIGCHLD */ +#define SV_SSTACK 1u /* This signal handler should use sig-stack */ +#define SV_INTR 2u /* Sig return should not restart system call */ +#define SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */ +#define SV_IGNCHILD 8u /* Do not send SIGCHLD */ /* * sa_flags values: SA_STACK is not currently supported, but will allow the @@ -142,11 +142,11 @@ struct sigstack { #define SA_ONSTACK SV_SSTACK #define SA_RESTART SV_INTR #define SA_ONESHOT SV_RESET -#define SA_INTERRUPT 0x10 -#define SA_NOMASK 0x20 -#define SA_SHIRQ 0x40 -#define SA_NOCLDWAIT 0x100 -#define SA_SIGINFO 0x200 +#define SA_INTERRUPT 0x10u +#define SA_NOMASK 0x20u +#define SA_SHIRQ 0x40u +#define SA_NOCLDWAIT 0x100u +#define SA_SIGINFO 0x200u #define SIG_BLOCK 0x01 /* for blocking signals */ diff --git a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h index 62e5e5416e25..e12d46d40588 100644 --- a/include/asm-sparc64/uaccess.h +++ b/include/asm-sparc64/uaccess.h @@ -7,6 +7,7 @@ */ #ifdef __KERNEL__ +#include <linux/compiler.h> #include <linux/sched.h> #include <linux/string.h> #include <asm/a.out.h> @@ -52,7 +53,7 @@ do { \ #define __access_ok(addr,size) 1 #define access_ok(type,addr,size) 1 -static inline int verify_area(int type, const void * addr, unsigned long size) +static inline int verify_area(int type, const void __user * addr, unsigned long size) { return 0; } @@ -249,44 +250,34 @@ __asm__ __volatile__( \ extern int __get_user_bad(void); -extern __kernel_size_t __copy_from_user(void *to, const void *from, - __kernel_size_t size); +extern unsigned long __copy_from_user(void *to, const void __user *from, + unsigned long size); -extern __kernel_size_t __copy_to_user(void *to, const void *from, - __kernel_size_t size); +extern unsigned long __copy_to_user(void __user *to, const void *from, + unsigned long size); -extern __kernel_size_t __copy_in_user(void *to, const void *from, - __kernel_size_t size); +extern unsigned long __copy_in_user(void __user *to, const void __user *from, + unsigned long size); -#define copy_from_user(to,from,n) \ - __copy_from_user((void *)(to), \ - (void *)(from), (__kernel_size_t)(n)) +#define copy_from_user __copy_from_user +#define copy_to_user __copy_to_user +#define copy_in_user __copy_in_user -#define copy_to_user(to,from,n) \ - __copy_to_user((void *)(to), \ - (void *) (from), (__kernel_size_t)(n)) - -#define copy_in_user(to,from,n) \ - __copy_in_user((void *)(to), \ - (void *) (from), (__kernel_size_t)(n)) - -static __inline__ __kernel_size_t __clear_user(void *addr, __kernel_size_t size) +static inline unsigned long __clear_user(void __user *addr, unsigned long size) { - extern __kernel_size_t __bzero_noasi(void *addr, __kernel_size_t size); + extern unsigned long __bzero_noasi(void *addr, unsigned long size); - return __bzero_noasi(addr, size); + return __bzero_noasi((void *) addr, size); } -#define clear_user(addr,n) \ - __clear_user((void *)(addr), (__kernel_size_t)(n)) +#define clear_user __clear_user -extern int __strncpy_from_user(unsigned long dest, unsigned long src, int count); +extern long __strncpy_from_user(char *dest, const char __user *src, long count); -#define strncpy_from_user(dest,src,count) \ - __strncpy_from_user((unsigned long)(dest), (unsigned long)(src), (int)(count)) +#define strncpy_from_user __strncpy_from_user -extern int __strlen_user(const char *); -extern int __strnlen_user(const char *, long len); +extern long __strlen_user(const char __user *); +extern long __strnlen_user(const char __user *, long len); #define strlen_user __strlen_user #define strnlen_user __strnlen_user |
