Xenomai  3.0.8
compat.h
1 /*
2  * Copyright (C) 2014 Philippe Gerum <rpm@xenomai.org>
3  *
4  * Xenomai is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * Xenomai is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18 #ifndef _COBALT_KERNEL_COMPAT_H
19 #define _COBALT_KERNEL_COMPAT_H
20 
21 #ifdef CONFIG_XENO_ARCH_SYS3264
22 
23 #include <linux/compat.h>
24 #include <net/compat.h>
25 #include <asm/xenomai/wrappers.h>
26 #include <cobalt/uapi/sched.h>
27 
28 struct mq_attr;
29 
30 struct __compat_sched_ss_param {
31  int __sched_low_priority;
32  struct compat_timespec __sched_repl_period;
33  struct compat_timespec __sched_init_budget;
34  int __sched_max_repl;
35 };
36 
37 struct __compat_sched_rr_param {
38  struct compat_timespec __sched_rr_quantum;
39 };
40 
41 struct compat_sched_param_ex {
42  int sched_priority;
43  union {
44  struct __compat_sched_ss_param ss;
45  struct __compat_sched_rr_param rr;
46  struct __sched_tp_param tp;
47  struct __sched_quota_param quota;
48  } sched_u;
49 };
50 
51 struct compat_mq_attr {
52  compat_long_t mq_flags;
53  compat_long_t mq_maxmsg;
54  compat_long_t mq_msgsize;
55  compat_long_t mq_curmsgs;
56 };
57 
58 struct compat_sched_tp_window {
59  struct compat_timespec offset;
60  struct compat_timespec duration;
61  int ptid;
62 };
63 
64 struct __compat_sched_config_tp {
65  int op;
66  int nr_windows;
67  struct compat_sched_tp_window windows[0];
68 };
69 
70 union compat_sched_config {
71  struct __compat_sched_config_tp tp;
72  struct __sched_config_quota quota;
73 };
74 
75 #define compat_sched_tp_confsz(nr_win) \
76  (sizeof(struct __compat_sched_config_tp) + nr_win * sizeof(struct compat_sched_tp_window))
77 
78 typedef struct {
79  compat_ulong_t fds_bits[__FD_SETSIZE / (8 * sizeof(compat_long_t))];
80 } compat_fd_set;
81 
82 struct compat_rtdm_mmap_request {
83  u64 offset;
84  compat_size_t length;
85  int prot;
86  int flags;
87 };
88 
89 int sys32_get_timespec(struct timespec *ts,
90  const struct compat_timespec __user *cts);
91 
92 int sys32_put_timespec(struct compat_timespec __user *cts,
93  const struct timespec *ts);
94 
95 int sys32_get_itimerspec(struct itimerspec *its,
96  const struct compat_itimerspec __user *cits);
97 
98 int sys32_put_itimerspec(struct compat_itimerspec __user *cits,
99  const struct itimerspec *its);
100 
101 int sys32_get_timeval(struct timeval *tv,
102  const struct compat_timeval __user *ctv);
103 
104 int sys32_put_timeval(struct compat_timeval __user *ctv,
105  const struct timeval *tv);
106 
107 ssize_t sys32_get_fdset(fd_set *fds, const compat_fd_set __user *cfds,
108  size_t cfdsize);
109 
110 ssize_t sys32_put_fdset(compat_fd_set __user *cfds, const fd_set *fds,
111  size_t fdsize);
112 
113 int sys32_get_param_ex(int policy,
114  struct sched_param_ex *p,
115  const struct compat_sched_param_ex __user *u_cp);
116 
117 int sys32_put_param_ex(int policy,
118  struct compat_sched_param_ex __user *u_cp,
119  const struct sched_param_ex *p);
120 
121 int sys32_get_mqattr(struct mq_attr *ap,
122  const struct compat_mq_attr __user *u_cap);
123 
124 int sys32_put_mqattr(struct compat_mq_attr __user *u_cap,
125  const struct mq_attr *ap);
126 
127 int sys32_get_sigevent(struct sigevent *ev,
128  const struct compat_sigevent *__user u_cev);
129 
130 int sys32_get_sigset(sigset_t *set, const compat_sigset_t *u_cset);
131 
132 int sys32_put_sigset(compat_sigset_t *u_cset, const sigset_t *set);
133 
134 int sys32_get_sigval(union sigval *val, const union compat_sigval *u_cval);
135 
136 int sys32_put_siginfo(void __user *u_si, const struct siginfo *si,
137  int overrun);
138 
139 int sys32_get_msghdr(struct user_msghdr *msg,
140  const struct compat_msghdr __user *u_cmsg);
141 
142 int sys32_put_msghdr(struct compat_msghdr __user *u_cmsg,
143  const struct user_msghdr *msg);
144 
145 int sys32_get_iovec(struct iovec *iov,
146  const struct compat_iovec __user *ciov,
147  int ciovlen);
148 
149 int sys32_put_iovec(struct compat_iovec __user *u_ciov,
150  const struct iovec *iov,
151  int iovlen);
152 
153 #endif /* CONFIG_XENO_ARCH_SYS3264 */
154 
155 #endif /* !_COBALT_KERNEL_COMPAT_H */