block: blk_max_pfn is somtimes wrong
[wrt350n-kernel.git] / include / asm-mips / compat-signal.h
blob6599a901b63ea20733ad9decf8bbebcc7ee8d8bd
1 #ifndef __ASM_COMPAT_SIGNAL_H
2 #define __ASM_COMPAT_SIGNAL_H
4 #include <linux/bug.h>
5 #include <linux/compat.h>
6 #include <linux/compiler.h>
8 #include <asm/signal.h>
9 #include <asm/siginfo.h>
11 #include <asm/uaccess.h>
13 static inline int __copy_conv_sigset_to_user(compat_sigset_t __user *d,
14 const sigset_t *s)
16 int err;
18 BUG_ON(sizeof(*d) != sizeof(*s));
19 BUG_ON(_NSIG_WORDS != 2);
21 err = __put_user(s->sig[0], &d->sig[0]);
22 err |= __put_user(s->sig[0] >> 32, &d->sig[1]);
23 err |= __put_user(s->sig[1], &d->sig[2]);
24 err |= __put_user(s->sig[1] >> 32, &d->sig[3]);
26 return err;
29 static inline int __copy_conv_sigset_from_user(sigset_t *d,
30 const compat_sigset_t __user *s)
32 int err;
33 union sigset_u {
34 sigset_t s;
35 compat_sigset_t c;
36 } *u = (union sigset_u *) d;
38 BUG_ON(sizeof(*d) != sizeof(*s));
39 BUG_ON(_NSIG_WORDS != 2);
41 #ifdef CONFIG_CPU_BIG_ENDIAN
42 err = __get_user(u->c.sig[1], &s->sig[0]);
43 err |= __get_user(u->c.sig[0], &s->sig[1]);
44 err |= __get_user(u->c.sig[3], &s->sig[2]);
45 err |= __get_user(u->c.sig[2], &s->sig[3]);
46 #endif
47 #ifdef CONFIG_CPU_LITTLE_ENDIAN
48 err = __get_user(u->c.sig[0], &s->sig[0]);
49 err |= __get_user(u->c.sig[1], &s->sig[1]);
50 err |= __get_user(u->c.sig[2], &s->sig[2]);
51 err |= __get_user(u->c.sig[3], &s->sig[3]);
52 #endif
54 return err;
57 #endif /* __ASM_COMPAT_SIGNAL_H */