steal an idea from uwe@ and implement gcc-8 function type cast friendly methods for sys/conf.h that needs it. one alias per return type and first function are are needed, though they can be stubbed to existing code. the only cost is the symbol itself, the codegen it the same.diff -r1.47 -r1.48 src/sys/kern/kern_stub.c
(mrg)
--- src/sys/kern/kern_stub.c 2019/01/27 02:55:26 1.47
+++ src/sys/kern/kern_stub.c 2019/10/08 07:33:15 1.48
@@ -1,320 +1,330 @@ | @@ -1,320 +1,330 @@ | |||
1 | /* $NetBSD: kern_stub.c,v 1.47 2019/01/27 02:55:26 christos Exp $ */ | 1 | /* $NetBSD: kern_stub.c,v 1.48 2019/10/08 07:33:15 mrg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
15 | * | 15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 16 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | 26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | /* | 29 | /* | |
30 | * Copyright (c) 1982, 1986, 1991, 1993 | 30 | * Copyright (c) 1982, 1986, 1991, 1993 | |
31 | * The Regents of the University of California. All rights reserved. | 31 | * The Regents of the University of California. All rights reserved. | |
32 | * | 32 | * | |
33 | * Redistribution and use in source and binary forms, with or without | 33 | * Redistribution and use in source and binary forms, with or without | |
34 | * modification, are permitted provided that the following conditions | 34 | * modification, are permitted provided that the following conditions | |
35 | * are met: | 35 | * are met: | |
36 | * 1. Redistributions of source code must retain the above copyright | 36 | * 1. Redistributions of source code must retain the above copyright | |
37 | * notice, this list of conditions and the following disclaimer. | 37 | * notice, this list of conditions and the following disclaimer. | |
38 | * 2. Redistributions in binary form must reproduce the above copyright | 38 | * 2. Redistributions in binary form must reproduce the above copyright | |
39 | * notice, this list of conditions and the following disclaimer in the | 39 | * notice, this list of conditions and the following disclaimer in the | |
40 | * documentation and/or other materials provided with the distribution. | 40 | * documentation and/or other materials provided with the distribution. | |
41 | * 3. Neither the name of the University nor the names of its contributors | 41 | * 3. Neither the name of the University nor the names of its contributors | |
42 | * may be used to endorse or promote products derived from this software | 42 | * may be used to endorse or promote products derived from this software | |
43 | * without specific prior written permission. | 43 | * without specific prior written permission. | |
44 | * | 44 | * | |
45 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 45 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
46 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 46 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
47 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 47 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
48 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 48 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
49 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 49 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
51 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 51 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
54 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 54 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
55 | * SUCH DAMAGE. | 55 | * SUCH DAMAGE. | |
56 | * | 56 | * | |
57 | * @(#)subr_xxx.c 8.3 (Berkeley) 3/29/95 | 57 | * @(#)subr_xxx.c 8.3 (Berkeley) 3/29/95 | |
58 | */ | 58 | */ | |
59 | 59 | |||
60 | /* | 60 | /* | |
61 | * Stubs for system calls and facilities not included in the system. | 61 | * Stubs for system calls and facilities not included in the system. | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | #include <sys/cdefs.h> | 64 | #include <sys/cdefs.h> | |
65 | __KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.47 2019/01/27 02:55:26 christos Exp $"); | 65 | __KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.48 2019/10/08 07:33:15 mrg Exp $"); | |
66 | 66 | |||
67 | #ifdef _KERNEL_OPT | 67 | #ifdef _KERNEL_OPT | |
68 | #include "opt_ktrace.h" | 68 | #include "opt_ktrace.h" | |
69 | #include "opt_sysv.h" | 69 | #include "opt_sysv.h" | |
70 | #include "opt_modular.h" | 70 | #include "opt_modular.h" | |
71 | #endif | 71 | #endif | |
72 | 72 | |||
73 | #include <sys/param.h> | 73 | #include <sys/param.h> | |
74 | #include <sys/kernel.h> | 74 | #include <sys/kernel.h> | |
75 | #include <sys/proc.h> | 75 | #include <sys/proc.h> | |
76 | #include <sys/fstypes.h> | 76 | #include <sys/fstypes.h> | |
77 | #include <sys/signalvar.h> | 77 | #include <sys/signalvar.h> | |
78 | #include <sys/syscall.h> | 78 | #include <sys/syscall.h> | |
79 | #include <sys/ktrace.h> | 79 | #include <sys/ktrace.h> | |
80 | #include <sys/intr.h> | 80 | #include <sys/intr.h> | |
81 | #include <sys/cpu.h> | 81 | #include <sys/cpu.h> | |
82 | #include <sys/module.h> | 82 | #include <sys/module.h> | |
83 | #include <sys/bus.h> | 83 | #include <sys/bus.h> | |
84 | #include <sys/userconf.h> | 84 | #include <sys/userconf.h> | |
85 | 85 | |||
86 | bool default_bus_space_is_equal(bus_space_tag_t, bus_space_tag_t); | 86 | bool default_bus_space_is_equal(bus_space_tag_t, bus_space_tag_t); | |
87 | bool default_bus_space_handle_is_equal(bus_space_tag_t, bus_space_handle_t, | 87 | bool default_bus_space_handle_is_equal(bus_space_tag_t, bus_space_handle_t, | |
88 | bus_space_handle_t); | 88 | bus_space_handle_t); | |
89 | 89 | |||
90 | /* | 90 | /* | |
91 | * SYSV Semaphores, Shared Memory, Message Queues | 91 | * SYSV Semaphores, Shared Memory, Message Queues | |
92 | */ | 92 | */ | |
93 | #ifndef MODULAR | 93 | #ifndef MODULAR | |
94 | #ifndef SYSVMSG | 94 | #ifndef SYSVMSG | |
95 | __strong_alias(msgctl1,enosys); | 95 | __strong_alias(msgctl1,enosys); | |
96 | #endif | 96 | #endif | |
97 | #ifndef SYSVSHM | 97 | #ifndef SYSVSHM | |
98 | __strong_alias(shmctl1,enosys); | 98 | __strong_alias(shmctl1,enosys); | |
99 | #endif | 99 | #endif | |
100 | #ifndef SYSVSEM | 100 | #ifndef SYSVSEM | |
101 | __strong_alias(semctl1,enosys); | 101 | __strong_alias(semctl1,enosys); | |
102 | #endif | 102 | #endif | |
103 | #endif | 103 | #endif | |
104 | 104 | |||
105 | /* | 105 | /* | |
106 | * ktrace stubs. ktruser() goes to enosys as we want to fail the syscall, | 106 | * ktrace stubs. ktruser() goes to enosys as we want to fail the syscall, | |
107 | * but not kill the process: utrace() is a debugging feature. | 107 | * but not kill the process: utrace() is a debugging feature. | |
108 | */ | 108 | */ | |
109 | #ifndef KTRACE | 109 | #ifndef KTRACE | |
110 | __strong_alias(ktr_csw,nullop); /* Probes */ | 110 | __strong_alias(ktr_csw,nullop); /* Probes */ | |
111 | __strong_alias(ktr_emul,nullop); | 111 | __strong_alias(ktr_emul,nullop); | |
112 | __strong_alias(ktr_geniov,nullop); | 112 | __strong_alias(ktr_geniov,nullop); | |
113 | __strong_alias(ktr_genio,nullop); | 113 | __strong_alias(ktr_genio,nullop); | |
114 | __strong_alias(ktr_mibio,nullop); | 114 | __strong_alias(ktr_mibio,nullop); | |
115 | __strong_alias(ktr_namei,nullop); | 115 | __strong_alias(ktr_namei,nullop); | |
116 | __strong_alias(ktr_namei2,nullop); | 116 | __strong_alias(ktr_namei2,nullop); | |
117 | __strong_alias(ktr_psig,nullop); | 117 | __strong_alias(ktr_psig,nullop); | |
118 | __strong_alias(ktr_syscall,nullop); | 118 | __strong_alias(ktr_syscall,nullop); | |
119 | __strong_alias(ktr_sysret,nullop); | 119 | __strong_alias(ktr_sysret,nullop); | |
120 | __strong_alias(ktr_kuser,nullop); | 120 | __strong_alias(ktr_kuser,nullop); | |
121 | __strong_alias(ktr_mib,nullop); | 121 | __strong_alias(ktr_mib,nullop); | |
122 | __strong_alias(ktr_execarg,nullop); | 122 | __strong_alias(ktr_execarg,nullop); | |
123 | __strong_alias(ktr_execenv,nullop); | 123 | __strong_alias(ktr_execenv,nullop); | |
124 | __strong_alias(ktr_execfd,nullop); | 124 | __strong_alias(ktr_execfd,nullop); | |
125 | 125 | |||
126 | __strong_alias(sys_fktrace,sys_nosys); /* Syscalls */ | 126 | __strong_alias(sys_fktrace,sys_nosys); /* Syscalls */ | |
127 | __strong_alias(sys_ktrace,sys_nosys); | 127 | __strong_alias(sys_ktrace,sys_nosys); | |
128 | __strong_alias(sys_utrace,sys_nosys); | 128 | __strong_alias(sys_utrace,sys_nosys); | |
129 | 129 | |||
130 | int ktrace_on; /* Misc */ | 130 | int ktrace_on; /* Misc */ | |
131 | __strong_alias(ktruser,enosys); | 131 | __strong_alias(ktruser,enosys); | |
132 | __strong_alias(ktr_point,nullop); | 132 | __strong_alias(ktr_point,nullop); | |
133 | #endif /* KTRACE */ | 133 | #endif /* KTRACE */ | |
134 | 134 | |||
135 | __weak_alias(device_register, voidop); | 135 | __weak_alias(device_register, voidop); | |
136 | __weak_alias(device_register_post_config, voidop); | 136 | __weak_alias(device_register_post_config, voidop); | |
137 | __weak_alias(spldebug_start, voidop); | 137 | __weak_alias(spldebug_start, voidop); | |
138 | __weak_alias(spldebug_stop, voidop); | 138 | __weak_alias(spldebug_stop, voidop); | |
139 | __weak_alias(machdep_init,nullop); | 139 | __weak_alias(machdep_init,nullop); | |
140 | __weak_alias(pci_chipset_tag_create, eopnotsupp); | 140 | __weak_alias(pci_chipset_tag_create, eopnotsupp); | |
141 | __weak_alias(pci_chipset_tag_destroy, voidop); | 141 | __weak_alias(pci_chipset_tag_destroy, voidop); | |
142 | __weak_alias(bus_space_reserve, eopnotsupp); | 142 | __weak_alias(bus_space_reserve, eopnotsupp); | |
143 | __weak_alias(bus_space_reserve_subregion, eopnotsupp); | 143 | __weak_alias(bus_space_reserve_subregion, eopnotsupp); | |
144 | __weak_alias(bus_space_release, voidop); | 144 | __weak_alias(bus_space_release, voidop); | |
145 | __weak_alias(bus_space_reservation_map, eopnotsupp); | 145 | __weak_alias(bus_space_reservation_map, eopnotsupp); | |
146 | __weak_alias(bus_space_reservation_unmap, voidop); | 146 | __weak_alias(bus_space_reservation_unmap, voidop); | |
147 | __weak_alias(bus_dma_tag_create, eopnotsupp); | 147 | __weak_alias(bus_dma_tag_create, eopnotsupp); | |
148 | __weak_alias(bus_dma_tag_destroy, voidop); | 148 | __weak_alias(bus_dma_tag_destroy, voidop); | |
149 | __weak_alias(bus_space_tag_create, eopnotsupp); | 149 | __weak_alias(bus_space_tag_create, eopnotsupp); | |
150 | __weak_alias(bus_space_tag_destroy, voidop); | 150 | __weak_alias(bus_space_tag_destroy, voidop); | |
151 | __strict_weak_alias(bus_space_is_equal, default_bus_space_is_equal); | 151 | __strict_weak_alias(bus_space_is_equal, default_bus_space_is_equal); | |
152 | __strict_weak_alias(bus_space_handle_is_equal, | 152 | __strict_weak_alias(bus_space_handle_is_equal, | |
153 | default_bus_space_handle_is_equal); | 153 | default_bus_space_handle_is_equal); | |
154 | __weak_alias(userconf_bootinfo, voidop); | 154 | __weak_alias(userconf_bootinfo, voidop); | |
155 | __weak_alias(userconf_init, voidop); | 155 | __weak_alias(userconf_init, voidop); | |
156 | __weak_alias(userconf_prompt, voidop); | 156 | __weak_alias(userconf_prompt, voidop); | |
157 | 157 | |||
158 | __weak_alias(kobj_renamespace, nullop); | 158 | __weak_alias(kobj_renamespace, nullop); | |
159 | 159 | |||
160 | __weak_alias(interrupt_get_count, nullop); | 160 | __weak_alias(interrupt_get_count, nullop); | |
161 | __weak_alias(interrupt_get_assigned, voidop); | 161 | __weak_alias(interrupt_get_assigned, voidop); | |
162 | __weak_alias(interrupt_get_available, voidop); | 162 | __weak_alias(interrupt_get_available, voidop); | |
163 | __weak_alias(interrupt_get_devname, voidop); | 163 | __weak_alias(interrupt_get_devname, voidop); | |
164 | __weak_alias(interrupt_construct_intrids, nullret); | 164 | __weak_alias(interrupt_construct_intrids, nullret); | |
165 | __weak_alias(interrupt_destruct_intrids, voidop); | 165 | __weak_alias(interrupt_destruct_intrids, voidop); | |
166 | __weak_alias(interrupt_distribute, eopnotsupp); | 166 | __weak_alias(interrupt_distribute, eopnotsupp); | |
167 | __weak_alias(interrupt_distribute_handler, eopnotsupp); | 167 | __weak_alias(interrupt_distribute_handler, eopnotsupp); | |
168 | 168 | |||
169 | /* | 169 | /* | |
170 | * Scheduler activations system calls. These need to remain until libc's | 170 | * Scheduler activations system calls. These need to remain until libc's | |
171 | * major version is bumped. | 171 | * major version is bumped. | |
172 | */ | 172 | */ | |
173 | __strong_alias(sys_sa_register,sys_nosys); | 173 | __strong_alias(sys_sa_register,sys_nosys); | |
174 | __strong_alias(sys_sa_stacks,sys_nosys); | 174 | __strong_alias(sys_sa_stacks,sys_nosys); | |
175 | __strong_alias(sys_sa_enable,sys_nosys); | 175 | __strong_alias(sys_sa_enable,sys_nosys); | |
176 | __strong_alias(sys_sa_setconcurrency,sys_nosys); | 176 | __strong_alias(sys_sa_setconcurrency,sys_nosys); | |
177 | __strong_alias(sys_sa_yield,sys_nosys); | 177 | __strong_alias(sys_sa_yield,sys_nosys); | |
178 | __strong_alias(sys_sa_preempt,sys_nosys); | 178 | __strong_alias(sys_sa_preempt,sys_nosys); | |
179 | __strong_alias(sys_sa_unblockyield,sys_nosys); | 179 | __strong_alias(sys_sa_unblockyield,sys_nosys); | |
180 | 180 | |||
181 | /* | 181 | /* | |
182 | * Stubs for compat_netbsd32. | 182 | * Stubs for compat_netbsd32. | |
183 | */ | 183 | */ | |
184 | __strong_alias(dosa_register,sys_nosys); | 184 | __strong_alias(dosa_register,sys_nosys); | |
185 | __strong_alias(sa_stacks1,sys_nosys); | 185 | __strong_alias(sa_stacks1,sys_nosys); | |
186 | 186 | |||
187 | /* | 187 | /* | |
188 | * Stubs for drivers. See sys/conf.h. | |||
189 | */ | |||
190 | __strong_alias(devenodev,enodev); | |||
191 | __strong_alias(deveopnotsupp,eopnotsupp); | |||
192 | __strong_alias(devnullop,nullop); | |||
193 | __strong_alias(ttyenodev,enodev); | |||
194 | __strong_alias(ttyvenodev,voidop); | |||
195 | __strong_alias(ttyvnullop,nullop); | |||
196 | ||||
197 | /* | |||
188 | * Stubs for architectures that do not support kernel preemption. | 198 | * Stubs for architectures that do not support kernel preemption. | |
189 | */ | 199 | */ | |
190 | #ifndef __HAVE_PREEMPTION | 200 | #ifndef __HAVE_PREEMPTION | |
191 | bool | 201 | bool | |
192 | cpu_kpreempt_enter(uintptr_t where, int s) | 202 | cpu_kpreempt_enter(uintptr_t where, int s) | |
193 | { | 203 | { | |
194 | 204 | |||
195 | return false; | 205 | return false; | |
196 | } | 206 | } | |
197 | 207 | |||
198 | void | 208 | void | |
199 | cpu_kpreempt_exit(uintptr_t where) | 209 | cpu_kpreempt_exit(uintptr_t where) | |
200 | { | 210 | { | |
201 | 211 | |||
202 | } | 212 | } | |
203 | 213 | |||
204 | bool | 214 | bool | |
205 | cpu_kpreempt_disabled(void) | 215 | cpu_kpreempt_disabled(void) | |
206 | { | 216 | { | |
207 | 217 | |||
208 | return true; | 218 | return true; | |
209 | } | 219 | } | |
210 | #else | 220 | #else | |
211 | # ifndef MULTIPROCESSOR | 221 | # ifndef MULTIPROCESSOR | |
212 | # error __HAVE_PREEMPTION requires MULTIPROCESSOR | 222 | # error __HAVE_PREEMPTION requires MULTIPROCESSOR | |
213 | # endif | 223 | # endif | |
214 | #endif /* !__HAVE_PREEMPTION */ | 224 | #endif /* !__HAVE_PREEMPTION */ | |
215 | 225 | |||
216 | int | 226 | int | |
217 | sys_nosys(struct lwp *l, const void *v, register_t *retval) | 227 | sys_nosys(struct lwp *l, const void *v, register_t *retval) | |
218 | { | 228 | { | |
219 | 229 | |||
220 | mutex_enter(proc_lock); | 230 | mutex_enter(proc_lock); | |
221 | psignal(l->l_proc, SIGSYS); | 231 | psignal(l->l_proc, SIGSYS); | |
222 | mutex_exit(proc_lock); | 232 | mutex_exit(proc_lock); | |
223 | return ENOSYS; | 233 | return ENOSYS; | |
224 | } | 234 | } | |
225 | 235 | |||
226 | /* | 236 | /* | |
227 | * Unsupported device function (e.g. writing to read-only device). | 237 | * Unsupported device function (e.g. writing to read-only device). | |
228 | */ | 238 | */ | |
229 | int | 239 | int | |
230 | enodev(void) | 240 | enodev(void) | |
231 | { | 241 | { | |
232 | 242 | |||
233 | return (ENODEV); | 243 | return (ENODEV); | |
234 | } | 244 | } | |
235 | 245 | |||
236 | /* | 246 | /* | |
237 | * Unconfigured device function; driver not configured. | 247 | * Unconfigured device function; driver not configured. | |
238 | */ | 248 | */ | |
239 | int | 249 | int | |
240 | enxio(void) | 250 | enxio(void) | |
241 | { | 251 | { | |
242 | 252 | |||
243 | return (ENXIO); | 253 | return (ENXIO); | |
244 | } | 254 | } | |
245 | 255 | |||
246 | /* | 256 | /* | |
247 | * Unsupported ioctl function. | 257 | * Unsupported ioctl function. | |
248 | */ | 258 | */ | |
249 | int | 259 | int | |
250 | enoioctl(void) | 260 | enoioctl(void) | |
251 | { | 261 | { | |
252 | 262 | |||
253 | return (ENOTTY); | 263 | return (ENOTTY); | |
254 | } | 264 | } | |
255 | 265 | |||
256 | /* | 266 | /* | |
257 | * Unsupported system function. | 267 | * Unsupported system function. | |
258 | * This is used for an otherwise-reasonable operation | 268 | * This is used for an otherwise-reasonable operation | |
259 | * that is not supported by the current system binary. | 269 | * that is not supported by the current system binary. | |
260 | */ | 270 | */ | |
261 | int | 271 | int | |
262 | enosys(void) | 272 | enosys(void) | |
263 | { | 273 | { | |
264 | 274 | |||
265 | return (ENOSYS); | 275 | return (ENOSYS); | |
266 | } | 276 | } | |
267 | 277 | |||
268 | /* | 278 | /* | |
269 | * Return error for operation not supported | 279 | * Return error for operation not supported | |
270 | * on a specific object or file type. | 280 | * on a specific object or file type. | |
271 | */ | 281 | */ | |
272 | int | 282 | int | |
273 | eopnotsupp(void) | 283 | eopnotsupp(void) | |
274 | { | 284 | { | |
275 | 285 | |||
276 | return (EOPNOTSUPP); | 286 | return (EOPNOTSUPP); | |
277 | } | 287 | } | |
278 | 288 | |||
279 | /* | 289 | /* | |
280 | * Generic null operation, void return value. | 290 | * Generic null operation, void return value. | |
281 | */ | 291 | */ | |
282 | void | 292 | void | |
283 | voidop(void) | 293 | voidop(void) | |
284 | { | 294 | { | |
285 | } | 295 | } | |
286 | 296 | |||
287 | /* | 297 | /* | |
288 | * Generic null operation, always returns success. | 298 | * Generic null operation, always returns success. | |
289 | */ | 299 | */ | |
290 | int | 300 | int | |
291 | nullop(void *v) | 301 | nullop(void *v) | |
292 | { | 302 | { | |
293 | 303 | |||
294 | return (0); | 304 | return (0); | |
295 | } | 305 | } | |
296 | 306 | |||
297 | /* | 307 | /* | |
298 | * Generic null operation, always returns null. | 308 | * Generic null operation, always returns null. | |
299 | */ | 309 | */ | |
300 | void * | 310 | void * | |
301 | nullret(void) | 311 | nullret(void) | |
302 | { | 312 | { | |
303 | 313 | |||
304 | return (NULL); | 314 | return (NULL); | |
305 | } | 315 | } | |
306 | 316 | |||
307 | bool | 317 | bool | |
308 | default_bus_space_handle_is_equal(bus_space_tag_t t, | 318 | default_bus_space_handle_is_equal(bus_space_tag_t t, | |
309 | bus_space_handle_t h1, bus_space_handle_t h2) | 319 | bus_space_handle_t h1, bus_space_handle_t h2) | |
310 | { | 320 | { | |
311 | 321 | |||
312 | return memcmp(&h1, &h2, sizeof(h1)) == 0; | 322 | return memcmp(&h1, &h2, sizeof(h1)) == 0; | |
313 | } | 323 | } | |
314 | 324 | |||
315 | bool | 325 | bool | |
316 | default_bus_space_is_equal(bus_space_tag_t t1, bus_space_tag_t t2) | 326 | default_bus_space_is_equal(bus_space_tag_t t1, bus_space_tag_t t2) | |
317 | { | 327 | { | |
318 | 328 | |||
319 | return memcmp(&t1, &t2, sizeof(t1)) == 0; | 329 | return memcmp(&t1, &t2, sizeof(t1)) == 0; | |
320 | } | 330 | } |
--- src/sys/sys/conf.h 2019/10/08 07:16:25 1.152
+++ src/sys/sys/conf.h 2019/10/08 07:33:14 1.153
@@ -1,282 +1,289 @@ | @@ -1,282 +1,289 @@ | |||
1 | /* $NetBSD: conf.h,v 1.152 2019/10/08 07:16:25 mrg Exp $ */ | 1 | /* $NetBSD: conf.h,v 1.153 2019/10/08 07:33:14 mrg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1990, 1993 | 4 | * Copyright (c) 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * (c) UNIX System Laboratories, Inc. | 6 | * (c) UNIX System Laboratories, Inc. | |
7 | * All or some portions of this file are derived from material licensed | 7 | * All or some portions of this file are derived from material licensed | |
8 | * to the University of California by American Telephone and Telegraph | 8 | * to the University of California by American Telephone and Telegraph | |
9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | 9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
10 | * the permission of UNIX System Laboratories, Inc. | 10 | * the permission of UNIX System Laboratories, Inc. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
15 | * 1. Redistributions of source code must retain the above copyright | 15 | * 1. Redistributions of source code must retain the above copyright | |
16 | * notice, this list of conditions and the following disclaimer. | 16 | * notice, this list of conditions and the following disclaimer. | |
17 | * 2. Redistributions in binary form must reproduce the above copyright | 17 | * 2. Redistributions in binary form must reproduce the above copyright | |
18 | * notice, this list of conditions and the following disclaimer in the | 18 | * notice, this list of conditions and the following disclaimer in the | |
19 | * documentation and/or other materials provided with the distribution. | 19 | * documentation and/or other materials provided with the distribution. | |
20 | * 3. Neither the name of the University nor the names of its contributors | 20 | * 3. Neither the name of the University nor the names of its contributors | |
21 | * may be used to endorse or promote products derived from this software | 21 | * may be used to endorse or promote products derived from this software | |
22 | * without specific prior written permission. | 22 | * without specific prior written permission. | |
23 | * | 23 | * | |
24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
34 | * SUCH DAMAGE. | 34 | * SUCH DAMAGE. | |
35 | * | 35 | * | |
36 | * @(#)conf.h 8.5 (Berkeley) 1/9/95 | 36 | * @(#)conf.h 8.5 (Berkeley) 1/9/95 | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | #ifndef _SYS_CONF_H_ | 39 | #ifndef _SYS_CONF_H_ | |
40 | #define _SYS_CONF_H_ | 40 | #define _SYS_CONF_H_ | |
41 | 41 | |||
42 | /* | 42 | /* | |
43 | * Definitions of device driver entry switches | 43 | * Definitions of device driver entry switches | |
44 | */ | 44 | */ | |
45 | 45 | |||
46 | #include <sys/queue.h> | 46 | #include <sys/queue.h> | |
47 | #include <sys/device_if.h> | 47 | #include <sys/device_if.h> | |
48 | 48 | |||
49 | struct buf; | 49 | struct buf; | |
50 | struct knote; | 50 | struct knote; | |
51 | struct lwp; | 51 | struct lwp; | |
52 | struct tty; | 52 | struct tty; | |
53 | struct uio; | 53 | struct uio; | |
54 | struct vnode; | 54 | struct vnode; | |
55 | 55 | |||
56 | /* | 56 | /* | |
57 | * Types for d_flag | 57 | * Types for d_flag | |
58 | */ | 58 | */ | |
59 | #define D_OTHER 0x0000 | 59 | #define D_OTHER 0x0000 | |
60 | #define D_TAPE 0x0001 | 60 | #define D_TAPE 0x0001 | |
61 | #define D_DISK 0x0002 | 61 | #define D_DISK 0x0002 | |
62 | #define D_TTY 0x0003 | 62 | #define D_TTY 0x0003 | |
63 | #define D_TYPEMASK 0x00ff | 63 | #define D_TYPEMASK 0x00ff | |
64 | #define D_MPSAFE 0x0100 | 64 | #define D_MPSAFE 0x0100 | |
65 | #define D_NEGOFFSAFE 0x0200 | 65 | #define D_NEGOFFSAFE 0x0200 | |
66 | #define D_MCLOSE 0x0400 | 66 | #define D_MCLOSE 0x0400 | |
67 | 67 | |||
68 | /* | 68 | /* | |
69 | * Block device switch table | 69 | * Block device switch table | |
70 | */ | 70 | */ | |
71 | struct bdevsw { | 71 | struct bdevsw { | |
72 | int (*d_open)(dev_t, int, int, struct lwp *); | 72 | int (*d_open)(dev_t, int, int, struct lwp *); | |
73 | int (*d_close)(dev_t, int, int, struct lwp *); | 73 | int (*d_close)(dev_t, int, int, struct lwp *); | |
74 | void (*d_strategy)(struct buf *); | 74 | void (*d_strategy)(struct buf *); | |
75 | int (*d_ioctl)(dev_t, u_long, void *, int, struct lwp *); | 75 | int (*d_ioctl)(dev_t, u_long, void *, int, struct lwp *); | |
76 | int (*d_dump)(dev_t, daddr_t, void *, size_t); | 76 | int (*d_dump)(dev_t, daddr_t, void *, size_t); | |
77 | int (*d_psize)(dev_t); | 77 | int (*d_psize)(dev_t); | |
78 | int (*d_discard)(dev_t, off_t, off_t); | 78 | int (*d_discard)(dev_t, off_t, off_t); | |
79 | int d_flag; | 79 | int d_flag; | |
80 | }; | 80 | }; | |
81 | 81 | |||
82 | /* | 82 | /* | |
83 | * Character device switch table | 83 | * Character device switch table | |
84 | */ | 84 | */ | |
85 | struct cdevsw { | 85 | struct cdevsw { | |
86 | int (*d_open)(dev_t, int, int, struct lwp *); | 86 | int (*d_open)(dev_t, int, int, struct lwp *); | |
87 | int (*d_close)(dev_t, int, int, struct lwp *); | 87 | int (*d_close)(dev_t, int, int, struct lwp *); | |
88 | int (*d_read)(dev_t, struct uio *, int); | 88 | int (*d_read)(dev_t, struct uio *, int); | |
89 | int (*d_write)(dev_t, struct uio *, int); | 89 | int (*d_write)(dev_t, struct uio *, int); | |
90 | int (*d_ioctl)(dev_t, u_long, void *, int, struct lwp *); | 90 | int (*d_ioctl)(dev_t, u_long, void *, int, struct lwp *); | |
91 | void (*d_stop)(struct tty *, int); | 91 | void (*d_stop)(struct tty *, int); | |
92 | struct tty * (*d_tty)(dev_t); | 92 | struct tty * (*d_tty)(dev_t); | |
93 | int (*d_poll)(dev_t, int, struct lwp *); | 93 | int (*d_poll)(dev_t, int, struct lwp *); | |
94 | paddr_t (*d_mmap)(dev_t, off_t, int); | 94 | paddr_t (*d_mmap)(dev_t, off_t, int); | |
95 | int (*d_kqfilter)(dev_t, struct knote *); | 95 | int (*d_kqfilter)(dev_t, struct knote *); | |
96 | int (*d_discard)(dev_t, off_t, off_t); | 96 | int (*d_discard)(dev_t, off_t, off_t); | |
97 | int d_flag; | 97 | int d_flag; | |
98 | }; | 98 | }; | |
99 | 99 | |||
100 | #ifdef _KERNEL | 100 | #ifdef _KERNEL | |
101 | 101 | |||
102 | #include <sys/mutex.h> | 102 | #include <sys/mutex.h> | |
103 | extern kmutex_t device_lock; | 103 | extern kmutex_t device_lock; | |
104 | 104 | |||
105 | int devsw_attach(const char *, const struct bdevsw *, devmajor_t *, | 105 | int devsw_attach(const char *, const struct bdevsw *, devmajor_t *, | |
106 | const struct cdevsw *, devmajor_t *); | 106 | const struct cdevsw *, devmajor_t *); | |
107 | int devsw_detach(const struct bdevsw *, const struct cdevsw *); | 107 | int devsw_detach(const struct bdevsw *, const struct cdevsw *); | |
108 | const struct bdevsw *bdevsw_lookup(dev_t); | 108 | const struct bdevsw *bdevsw_lookup(dev_t); | |
109 | const struct cdevsw *cdevsw_lookup(dev_t); | 109 | const struct cdevsw *cdevsw_lookup(dev_t); | |
110 | devmajor_t bdevsw_lookup_major(const struct bdevsw *); | 110 | devmajor_t bdevsw_lookup_major(const struct bdevsw *); | |
111 | devmajor_t cdevsw_lookup_major(const struct cdevsw *); | 111 | devmajor_t cdevsw_lookup_major(const struct cdevsw *); | |
112 | 112 | |||
113 | #define dev_type_open(n) int n (dev_t, int, int, struct lwp *) | 113 | #define dev_type_open(n) int n (dev_t, int, int, struct lwp *) | |
114 | #define dev_type_close(n) int n (dev_t, int, int, struct lwp *) | 114 | #define dev_type_close(n) int n (dev_t, int, int, struct lwp *) | |
115 | #define dev_type_read(n) int n (dev_t, struct uio *, int) | 115 | #define dev_type_read(n) int n (dev_t, struct uio *, int) | |
116 | #define dev_type_write(n) int n (dev_t, struct uio *, int) | 116 | #define dev_type_write(n) int n (dev_t, struct uio *, int) | |
117 | #define dev_type_ioctl(n) \ | 117 | #define dev_type_ioctl(n) \ | |
118 | int n (dev_t, u_long, void *, int, struct lwp *) | 118 | int n (dev_t, u_long, void *, int, struct lwp *) | |
119 | #define dev_type_stop(n) void n (struct tty *, int) | 119 | #define dev_type_stop(n) void n (struct tty *, int) | |
120 | #define dev_type_tty(n) struct tty * n (dev_t) | 120 | #define dev_type_tty(n) struct tty * n (dev_t) | |
121 | #define dev_type_poll(n) int n (dev_t, int, struct lwp *) | 121 | #define dev_type_poll(n) int n (dev_t, int, struct lwp *) | |
122 | #define dev_type_mmap(n) paddr_t n (dev_t, off_t, int) | 122 | #define dev_type_mmap(n) paddr_t n (dev_t, off_t, int) | |
123 | #define dev_type_strategy(n) void n (struct buf *) | 123 | #define dev_type_strategy(n) void n (struct buf *) | |
124 | #define dev_type_dump(n) int n (dev_t, daddr_t, void *, size_t) | 124 | #define dev_type_dump(n) int n (dev_t, daddr_t, void *, size_t) | |
125 | #define dev_type_size(n) int n (dev_t) | 125 | #define dev_type_size(n) int n (dev_t) | |
126 | #define dev_type_kqfilter(n) int n (dev_t, struct knote *) | 126 | #define dev_type_kqfilter(n) int n (dev_t, struct knote *) | |
127 | #define dev_type_discard(n) int n (dev_t, off_t, off_t) | 127 | #define dev_type_discard(n) int n (dev_t, off_t, off_t) | |
128 | 128 | |||
129 | #define noopen ((dev_type_open((*)))enodev) | 129 | int devenodev(dev_t, ...); | |
130 | #define noclose ((dev_type_close((*)))enodev) | 130 | int deveopnotsupp(dev_t, ...); | |
131 | #define noread ((dev_type_read((*)))enodev) | 131 | int devnullop(dev_t, ...); | |
132 | #define nowrite ((dev_type_write((*)))enodev) | 132 | int ttyenodev(struct tty *, ...); | |
133 | #define noioctl ((dev_type_ioctl((*)))enodev) | 133 | void ttyvenodev(struct tty *, ...); | |
134 | #define nostop ((dev_type_stop((*)))enodev) | 134 | void ttyvnullop(struct tty *, ...); | |
135 | ||||
136 | #define noopen ((dev_type_open((*)))devenodev) | |||
137 | #define noclose ((dev_type_close((*)))devenodev) | |||
138 | #define noread ((dev_type_read((*)))devenodev) | |||
139 | #define nowrite ((dev_type_write((*)))devenodev) | |||
140 | #define noioctl ((dev_type_ioctl((*)))devenodev) | |||
141 | #define nostop ((dev_type_stop((*)))ttyvenodev) | |||
135 | #define notty NULL | 142 | #define notty NULL | |
136 | #define nopoll seltrue | 143 | #define nopoll seltrue | |
137 | paddr_t nommap(dev_t, off_t, int); | 144 | paddr_t nommap(dev_t, off_t, int); | |
138 | #define nodump ((dev_type_dump((*)))enodev) | 145 | #define nodump ((dev_type_dump((*)))devenodev) | |
139 | #define nosize NULL | 146 | #define nosize NULL | |
140 | #define nokqfilter seltrue_kqfilter | 147 | #define nokqfilter seltrue_kqfilter | |
141 | #define nodiscard ((dev_type_discard((*)))enodev) | 148 | #define nodiscard ((dev_type_discard((*)))devenodev) | |
142 | 149 | |||
143 | #define nullopen ((dev_type_open((*)))nullop) | 150 | #define nullopen ((dev_type_open((*)))devnullop) | |
144 | #define nullclose ((dev_type_close((*)))nullop) | 151 | #define nullclose ((dev_type_close((*)))devnullop) | |
145 | #define nullread ((dev_type_read((*)))nullop) | 152 | #define nullread ((dev_type_read((*)))devnullop) | |
146 | #define nullwrite ((dev_type_write((*)))nullop) | 153 | #define nullwrite ((dev_type_write((*)))devnullop) | |
147 | #define nullioctl ((dev_type_ioctl((*)))nullop) | 154 | #define nullioctl ((dev_type_ioctl((*)))devnullop) | |
148 | #define nullstop ((dev_type_stop((*)))nullop) | 155 | #define nullstop ((dev_type_stop((*)))ttyvnullop) | |
149 | #define nullpoll ((dev_type_poll((*)))nullop) | 156 | #define nullpoll ((dev_type_poll((*)))devnullop) | |
150 | #define nulldump ((dev_type_dump((*)))nullop) | 157 | #define nulldump ((dev_type_dump((*)))devnullop) | |
151 | #define nullkqfilter ((dev_type_kqfilter((*)))eopnotsupp) | 158 | #define nullkqfilter ((dev_type_kqfilter((*)))deveopnotsupp) | |
152 | #define nulldiscard ((dev_type_discard((*)))nullop) | 159 | #define nulldiscard ((dev_type_discard((*)))devnullop) | |
153 | 160 | |||
154 | /* device access wrappers. */ | 161 | /* device access wrappers. */ | |
155 | 162 | |||
156 | dev_type_open(bdev_open); | 163 | dev_type_open(bdev_open); | |
157 | dev_type_close(bdev_close); | 164 | dev_type_close(bdev_close); | |
158 | dev_type_strategy(bdev_strategy); | 165 | dev_type_strategy(bdev_strategy); | |
159 | dev_type_ioctl(bdev_ioctl); | 166 | dev_type_ioctl(bdev_ioctl); | |
160 | dev_type_dump(bdev_dump); | 167 | dev_type_dump(bdev_dump); | |
161 | dev_type_size(bdev_size); | 168 | dev_type_size(bdev_size); | |
162 | dev_type_discard(bdev_discard); | 169 | dev_type_discard(bdev_discard); | |
163 | 170 | |||
164 | dev_type_open(cdev_open); | 171 | dev_type_open(cdev_open); | |
165 | dev_type_close(cdev_close); | 172 | dev_type_close(cdev_close); | |
166 | dev_type_read(cdev_read); | 173 | dev_type_read(cdev_read); | |
167 | dev_type_write(cdev_write); | 174 | dev_type_write(cdev_write); | |
168 | dev_type_ioctl(cdev_ioctl); | 175 | dev_type_ioctl(cdev_ioctl); | |
169 | dev_type_stop(cdev_stop); | 176 | dev_type_stop(cdev_stop); | |
170 | dev_type_tty(cdev_tty); | 177 | dev_type_tty(cdev_tty); | |
171 | dev_type_poll(cdev_poll); | 178 | dev_type_poll(cdev_poll); | |
172 | dev_type_mmap(cdev_mmap); | 179 | dev_type_mmap(cdev_mmap); | |
173 | dev_type_kqfilter(cdev_kqfilter); | 180 | dev_type_kqfilter(cdev_kqfilter); | |
174 | dev_type_discard(cdev_discard); | 181 | dev_type_discard(cdev_discard); | |
175 | 182 | |||
176 | int cdev_type(dev_t); | 183 | int cdev_type(dev_t); | |
177 | int cdev_flags(dev_t); | 184 | int cdev_flags(dev_t); | |
178 | int bdev_type(dev_t); | 185 | int bdev_type(dev_t); | |
179 | int bdev_flags(dev_t); | 186 | int bdev_flags(dev_t); | |
180 | 187 | |||
181 | /* symbolic sleep message strings */ | 188 | /* symbolic sleep message strings */ | |
182 | extern const char devopn[], devio[], devwait[], devin[], devout[]; | 189 | extern const char devopn[], devio[], devwait[], devin[], devout[]; | |
183 | extern const char devioc[], devcls[]; | 190 | extern const char devioc[], devcls[]; | |
184 | 191 | |||
185 | #endif /* _KERNEL */ | 192 | #endif /* _KERNEL */ | |
186 | 193 | |||
187 | /* | 194 | /* | |
188 | * Line discipline switch table | 195 | * Line discipline switch table | |
189 | */ | 196 | */ | |
190 | struct linesw { | 197 | struct linesw { | |
191 | const char *l_name; /* Linesw name */ | 198 | const char *l_name; /* Linesw name */ | |
192 | 199 | |||
193 | LIST_ENTRY(linesw) l_list; | 200 | LIST_ENTRY(linesw) l_list; | |
194 | u_int l_refcnt; /* locked by ttyldisc_list_slock */ | 201 | u_int l_refcnt; /* locked by ttyldisc_list_slock */ | |
195 | int l_no; /* legacy discipline number (for TIOCGETD) */ | 202 | int l_no; /* legacy discipline number (for TIOCGETD) */ | |
196 | 203 | |||
197 | int (*l_open) (dev_t, struct tty *); | 204 | int (*l_open) (dev_t, struct tty *); | |
198 | int (*l_close) (struct tty *, int); | 205 | int (*l_close) (struct tty *, int); | |
199 | int (*l_read) (struct tty *, struct uio *, int); | 206 | int (*l_read) (struct tty *, struct uio *, int); | |
200 | int (*l_write) (struct tty *, struct uio *, int); | 207 | int (*l_write) (struct tty *, struct uio *, int); | |
201 | int (*l_ioctl) (struct tty *, u_long, void *, int, | 208 | int (*l_ioctl) (struct tty *, u_long, void *, int, | |
202 | struct lwp *); | 209 | struct lwp *); | |
203 | int (*l_rint) (int, struct tty *); | 210 | int (*l_rint) (int, struct tty *); | |
204 | int (*l_start) (struct tty *); | 211 | int (*l_start) (struct tty *); | |
205 | int (*l_modem) (struct tty *, int); | 212 | int (*l_modem) (struct tty *, int); | |
206 | int (*l_poll) (struct tty *, int, struct lwp *); | 213 | int (*l_poll) (struct tty *, int, struct lwp *); | |
207 | }; | 214 | }; | |
208 | 215 | |||
209 | #ifdef _KERNEL | 216 | #ifdef _KERNEL | |
210 | void ttyldisc_init(void); | 217 | void ttyldisc_init(void); | |
211 | int ttyldisc_attach(struct linesw *); | 218 | int ttyldisc_attach(struct linesw *); | |
212 | int ttyldisc_detach(struct linesw *); | 219 | int ttyldisc_detach(struct linesw *); | |
213 | struct linesw *ttyldisc_lookup(const char *); | 220 | struct linesw *ttyldisc_lookup(const char *); | |
214 | struct linesw *ttyldisc_lookup_bynum(int); | 221 | struct linesw *ttyldisc_lookup_bynum(int); | |
215 | struct linesw *ttyldisc_default(void); | 222 | struct linesw *ttyldisc_default(void); | |
216 | void ttyldisc_release(struct linesw *); | 223 | void ttyldisc_release(struct linesw *); | |
217 | 224 | |||
218 | /* For those defining their own line disciplines: */ | 225 | /* For those defining their own line disciplines: */ | |
219 | #define ttynodisc ((int (*)(dev_t, struct tty *))enodev) | 226 | #define ttynodisc ((int (*)(dev_t, struct tty *))enodev) | |
220 | #define ttyerrclose ((int (*)(struct tty *, int))enodev) | 227 | #define ttyerrclose ((int (*)(struct tty *, int))enodev) | |
221 | #define ttyerrio ((int (*)(struct tty *, struct uio *, int))enodev) | 228 | #define ttyerrio ((int (*)(struct tty *, struct uio *, int))enodev) | |
222 | #define ttyerrstart ((int (*)(struct tty *))enodev) | 229 | #define ttyerrstart ((int (*)(struct tty *))enodev) | |
223 | 230 | |||
224 | int ttyerrpoll (struct tty *, int, struct lwp *); | 231 | int ttyerrpoll (struct tty *, int, struct lwp *); | |
225 | int ttynullioctl(struct tty *, u_long, void *, int, struct lwp *); | 232 | int ttynullioctl(struct tty *, u_long, void *, int, struct lwp *); | |
226 | 233 | |||
227 | int iskmemdev(dev_t); | 234 | int iskmemdev(dev_t); | |
228 | int seltrue_kqfilter(dev_t, struct knote *); | 235 | int seltrue_kqfilter(dev_t, struct knote *); | |
229 | #endif | 236 | #endif | |
230 | 237 | |||
231 | #ifdef _KERNEL | 238 | #ifdef _KERNEL | |
232 | 239 | |||
233 | #define DEV_MEM 0 /* minor device 0 is physical memory */ | 240 | #define DEV_MEM 0 /* minor device 0 is physical memory */ | |
234 | #define DEV_KMEM 1 /* minor device 1 is kernel memory */ | 241 | #define DEV_KMEM 1 /* minor device 1 is kernel memory */ | |
235 | #define DEV_NULL 2 /* minor device 2 is EOF/rathole */ | 242 | #define DEV_NULL 2 /* minor device 2 is EOF/rathole */ | |
236 | #ifdef COMPAT_16 | 243 | #ifdef COMPAT_16 | |
237 | #define _DEV_ZERO_oARM 3 /* reserved: old ARM /dev/zero minor */ | 244 | #define _DEV_ZERO_oARM 3 /* reserved: old ARM /dev/zero minor */ | |
238 | #endif | 245 | #endif | |
239 | #define DEV_FULL 11 /* minor device 11 is '\0'/ENOSPC */ | 246 | #define DEV_FULL 11 /* minor device 11 is '\0'/ENOSPC */ | |
240 | #define DEV_ZERO 12 /* minor device 12 is '\0'/rathole */ | 247 | #define DEV_ZERO 12 /* minor device 12 is '\0'/rathole */ | |
241 | 248 | |||
242 | enum devnode_class { | 249 | enum devnode_class { | |
243 | DEVNODE_DONTBOTHER, | 250 | DEVNODE_DONTBOTHER, | |
244 | DEVNODE_SINGLE, | 251 | DEVNODE_SINGLE, | |
245 | DEVNODE_VECTOR, | 252 | DEVNODE_VECTOR, | |
246 | }; | 253 | }; | |
247 | #define DEVNODE_FLAG_LINKZERO 0x01 /* create name -> name0 link */ | 254 | #define DEVNODE_FLAG_LINKZERO 0x01 /* create name -> name0 link */ | |
248 | #define DEVNODE_FLAG_ISMINOR0 0x02 /* vector[0] specifies minor */ | 255 | #define DEVNODE_FLAG_ISMINOR0 0x02 /* vector[0] specifies minor */ | |
249 | #ifdef notyet | 256 | #ifdef notyet | |
250 | #define DEVNODE_FLAG_ISMINOR1 0x04 /* vector[1] specifies starting minor */ | 257 | #define DEVNODE_FLAG_ISMINOR1 0x04 /* vector[1] specifies starting minor */ | |
251 | #endif | 258 | #endif | |
252 | 259 | |||
253 | struct devsw_conv { | 260 | struct devsw_conv { | |
254 | const char *d_name; | 261 | const char *d_name; | |
255 | devmajor_t d_bmajor; | 262 | devmajor_t d_bmajor; | |
256 | devmajor_t d_cmajor; | 263 | devmajor_t d_cmajor; | |
257 | 264 | |||
258 | /* information about /dev nodes related to the device */ | 265 | /* information about /dev nodes related to the device */ | |
259 | enum devnode_class d_class; | 266 | enum devnode_class d_class; | |
260 | int d_flags; | 267 | int d_flags; | |
261 | int d_vectdim[2]; | 268 | int d_vectdim[2]; | |
262 | }; | 269 | }; | |
263 | 270 | |||
264 | void devsw_init(void); | 271 | void devsw_init(void); | |
265 | const char *devsw_blk2name(devmajor_t); | 272 | const char *devsw_blk2name(devmajor_t); | |
266 | const char *cdevsw_getname(devmajor_t); | 273 | const char *cdevsw_getname(devmajor_t); | |
267 | const char *bdevsw_getname(devmajor_t); | 274 | const char *bdevsw_getname(devmajor_t); | |
268 | devmajor_t devsw_name2blk(const char *, char *, size_t); | 275 | devmajor_t devsw_name2blk(const char *, char *, size_t); | |
269 | devmajor_t devsw_name2chr(const char *, char *, size_t); | 276 | devmajor_t devsw_name2chr(const char *, char *, size_t); | |
270 | dev_t devsw_chr2blk(dev_t); | 277 | dev_t devsw_chr2blk(dev_t); | |
271 | dev_t devsw_blk2chr(dev_t); | 278 | dev_t devsw_blk2chr(dev_t); | |
272 | 279 | |||
273 | void mm_init(void); | 280 | void mm_init(void); | |
274 | #endif /* _KERNEL */ | 281 | #endif /* _KERNEL */ | |
275 | 282 | |||
276 | #ifdef _KERNEL | 283 | #ifdef _KERNEL | |
277 | void setroot(device_t, int); | 284 | void setroot(device_t, int); | |
278 | void rootconf(void); | 285 | void rootconf(void); | |
279 | void swapconf(void); | 286 | void swapconf(void); | |
280 | #endif /* _KERNEL */ | 287 | #endif /* _KERNEL */ | |
281 | 288 | |||
282 | #endif /* !_SYS_CONF_H_ */ | 289 | #endif /* !_SYS_CONF_H_ */ |