Move device_printf() from ath_netbsd.c to subr_prf.c for reuse in a new driver.diff -r1.17 -r1.18 src/sys/dev/ic/ath_netbsd.c
(dyoung)
--- src/sys/dev/ic/ath_netbsd.c 2009/10/19 23:19:39 1.17
+++ src/sys/dev/ic/ath_netbsd.c 2011/01/21 17:46:19 1.18
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ath_netbsd.c,v 1.17 2009/10/19 23:19:39 rmind Exp $ */ | 1 | /* $NetBSD: ath_netbsd.c,v 1.18 2011/01/21 17:46:19 dyoung Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2003, 2004 David Young | 4 | * Copyright (c) 2003, 2004 David Young | |
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. | |
@@ -16,27 +16,27 @@ | @@ -16,27 +16,27 @@ | |||
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 | */ | 26 | */ | |
27 | 27 | |||
28 | #include <sys/cdefs.h> | 28 | #include <sys/cdefs.h> | |
29 | __KERNEL_RCSID(0, "$NetBSD: ath_netbsd.c,v 1.17 2009/10/19 23:19:39 rmind Exp $"); | 29 | __KERNEL_RCSID(0, "$NetBSD: ath_netbsd.c,v 1.18 2011/01/21 17:46:19 dyoung Exp $"); | |
30 | 30 | |||
31 | #include <sys/param.h> | 31 | #include <sys/param.h> | |
32 | #include <sys/types.h> | 32 | #include <sys/types.h> | |
33 | #include <sys/errno.h> | 33 | #include <sys/errno.h> | |
34 | #include <sys/systm.h> | 34 | #include <sys/systm.h> | |
35 | #include <sys/sysctl.h> | 35 | #include <sys/sysctl.h> | |
36 | #include <sys/mbuf.h> | 36 | #include <sys/mbuf.h> | |
37 | #include <sys/malloc.h> | 37 | #include <sys/malloc.h> | |
38 | #include <sys/kernel.h> | 38 | #include <sys/kernel.h> | |
39 | #include <sys/socket.h> | 39 | #include <sys/socket.h> | |
40 | #include <sys/sockio.h> | 40 | #include <sys/sockio.h> | |
41 | #include <sys/sysctl.h> | 41 | #include <sys/sysctl.h> | |
42 | #include <sys/callout.h> | 42 | #include <sys/callout.h> | |
@@ -47,38 +47,26 @@ __KERNEL_RCSID(0, "$NetBSD: ath_netbsd.c | @@ -47,38 +47,26 @@ __KERNEL_RCSID(0, "$NetBSD: ath_netbsd.c | |||
47 | 47 | |||
48 | #include <net/if.h> | 48 | #include <net/if.h> | |
49 | #include <net/if_dl.h> | 49 | #include <net/if_dl.h> | |
50 | #include <net/if_media.h> | 50 | #include <net/if_media.h> | |
51 | #include <net/if_arp.h> | 51 | #include <net/if_arp.h> | |
52 | #include <net/if_ether.h> | 52 | #include <net/if_ether.h> | |
53 | #include <net/if_llc.h> | 53 | #include <net/if_llc.h> | |
54 | 54 | |||
55 | #include <net80211/ieee80211_netbsd.h> | 55 | #include <net80211/ieee80211_netbsd.h> | |
56 | #include <net80211/ieee80211_var.h> | 56 | #include <net80211/ieee80211_var.h> | |
57 | #include <dev/ic/ath_netbsd.h> | 57 | #include <dev/ic/ath_netbsd.h> | |
58 | #include <dev/ic/athvar.h> | 58 | #include <dev/ic/athvar.h> | |
59 | 59 | |||
60 | void | |||
61 | device_printf(device_t dev, const char *fmt, ...) | |||
62 | { | |||
63 | va_list ap; | |||
64 | ||||
65 | va_start(ap, fmt); | |||
66 | printf("%s: ", device_xname(dev)); | |||
67 | vprintf(fmt, ap); | |||
68 | va_end(ap); | |||
69 | return; | |||
70 | } | |||
71 | ||||
72 | /* | 60 | /* | |
73 | * Setup sysctl(3) MIB, hw.ath.*. | 61 | * Setup sysctl(3) MIB, hw.ath.*. | |
74 | * | 62 | * | |
75 | * TBD condition CTLFLAG_PERMANENT on being a module or not | 63 | * TBD condition CTLFLAG_PERMANENT on being a module or not | |
76 | */ | 64 | */ | |
77 | SYSCTL_SETUP(sysctl_ath, "sysctl ath subtree setup") | 65 | SYSCTL_SETUP(sysctl_ath, "sysctl ath subtree setup") | |
78 | { | 66 | { | |
79 | int rc; | 67 | int rc; | |
80 | const struct sysctlnode *cnode, *rnode; | 68 | const struct sysctlnode *cnode, *rnode; | |
81 | 69 | |||
82 | if ((rnode = ath_sysctl_treetop(clog)) == NULL) | 70 | if ((rnode = ath_sysctl_treetop(clog)) == NULL) | |
83 | return; | 71 | return; | |
84 | 72 |
--- src/sys/dev/ic/ath_netbsd.h 2010/03/19 01:31:11 1.10
+++ src/sys/dev/ic/ath_netbsd.h 2011/01/21 17:46:19 1.11
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ath_netbsd.h,v 1.10 2010/03/19 01:31:11 dyoung Exp $ */ | 1 | /* $NetBSD: ath_netbsd.h,v 1.11 2011/01/21 17:46:19 dyoung Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2003, 2004 David Young | 4 | * Copyright (c) 2003, 2004 David Young | |
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. | |
@@ -109,19 +109,17 @@ typedef struct ath_lock ath_txbuf_lock_t | @@ -109,19 +109,17 @@ typedef struct ath_lock ath_txbuf_lock_t | |||
109 | sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_PERMANENT|(__rw),\ | 109 | sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_PERMANENT|(__rw),\ | |
110 | CTLTYPE_INT, #__name, SYSCTL_DESCR(__descr), NULL, 0, \ | 110 | CTLTYPE_INT, #__name, SYSCTL_DESCR(__descr), NULL, 0, \ | |
111 | __PFX(&__pfx, __name), 0, CTL_CREATE, CTL_EOL) | 111 | __PFX(&__pfx, __name), 0, CTL_CREATE, CTL_EOL) | |
112 | 112 | |||
113 | #define SYSCTL_INT(__rw, __name, __descr) \ | 113 | #define SYSCTL_INT(__rw, __name, __descr) \ | |
114 | SYSCTL_PFX_INT(sc->sc_, __rw, __name, __descr) | 114 | SYSCTL_PFX_INT(sc->sc_, __rw, __name, __descr) | |
115 | 115 | |||
116 | #define SYSCTL_GLOBAL_INT(__rw, __name, __descr, __var) \ | 116 | #define SYSCTL_GLOBAL_INT(__rw, __name, __descr, __var) \ | |
117 | sysctl_createv(clog, 0, &rnode, &cnode, \ | 117 | sysctl_createv(clog, 0, &rnode, &cnode, \ | |
118 | CTLFLAG_PERMANENT|(__rw), CTLTYPE_INT, __name, \ | 118 | CTLFLAG_PERMANENT|(__rw), CTLTYPE_INT, __name, \ | |
119 | SYSCTL_DESCR(__descr), NULL, 0, &ath_##__var, 0, CTL_CREATE,\ | 119 | SYSCTL_DESCR(__descr), NULL, 0, &ath_##__var, 0, CTL_CREATE,\ | |
120 | CTL_EOL) | 120 | CTL_EOL) | |
121 | 121 | |||
122 | extern void device_printf(device_t, const char *fmt, ...) | |||
123 | __attribute__((__format__(__printf__,2,3))); | |||
124 | const struct sysctlnode *ath_sysctl_treetop(struct sysctllog **); | 122 | const struct sysctlnode *ath_sysctl_treetop(struct sysctllog **); | |
125 | const struct sysctlnode *ath_sysctl_instance(const char *, struct sysctllog **); | 123 | const struct sysctlnode *ath_sysctl_instance(const char *, struct sysctllog **); | |
126 | 124 | |||
127 | #endif /* _ATH_NETBSD_H */ | 125 | #endif /* _ATH_NETBSD_H */ |
--- src/sys/kern/subr_prf.c 2010/01/26 12:59:50 1.138
+++ src/sys/kern/subr_prf.c 2011/01/21 17:46:19 1.139
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: subr_prf.c,v 1.138 2010/01/26 12:59:50 he Exp $ */ | 1 | /* $NetBSD: subr_prf.c,v 1.139 2011/01/21 17:46:19 dyoung Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1986, 1988, 1991, 1993 | 4 | * Copyright (c) 1986, 1988, 1991, 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: | |
@@ -27,27 +27,27 @@ | @@ -27,27 +27,27 @@ | |||
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 | * @(#)subr_prf.c 8.4 (Berkeley) 5/4/95 | 36 | * @(#)subr_prf.c 8.4 (Berkeley) 5/4/95 | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | #include <sys/cdefs.h> | 39 | #include <sys/cdefs.h> | |
40 | __KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.138 2010/01/26 12:59:50 he Exp $"); | 40 | __KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.139 2011/01/21 17:46:19 dyoung Exp $"); | |
41 | 41 | |||
42 | #include "opt_ddb.h" | 42 | #include "opt_ddb.h" | |
43 | #include "opt_ipkdb.h" | 43 | #include "opt_ipkdb.h" | |
44 | #include "opt_kgdb.h" | 44 | #include "opt_kgdb.h" | |
45 | #include "opt_dump.h" | 45 | #include "opt_dump.h" | |
46 | 46 | |||
47 | #include <sys/param.h> | 47 | #include <sys/param.h> | |
48 | #include <sys/stdint.h> | 48 | #include <sys/stdint.h> | |
49 | #include <sys/systm.h> | 49 | #include <sys/systm.h> | |
50 | #include <sys/buf.h> | 50 | #include <sys/buf.h> | |
51 | #include <sys/device.h> | 51 | #include <sys/device.h> | |
52 | #include <sys/reboot.h> | 52 | #include <sys/reboot.h> | |
53 | #include <sys/msgbuf.h> | 53 | #include <sys/msgbuf.h> | |
@@ -1128,26 +1128,38 @@ vsnprintf(char *bf, size_t size, const c | @@ -1128,26 +1128,38 @@ vsnprintf(char *bf, size_t size, const c | |||
1128 | 1128 | |||
1129 | #define KPRINTF_PUTCHAR(C) { \ | 1129 | #define KPRINTF_PUTCHAR(C) { \ | |
1130 | if (oflags == TOBUFONLY) { \ | 1130 | if (oflags == TOBUFONLY) { \ | |
1131 | if ((vp != NULL) && (sbuf == tailp)) { \ | 1131 | if ((vp != NULL) && (sbuf == tailp)) { \ | |
1132 | ret += 1; /* indicate error */ \ | 1132 | ret += 1; /* indicate error */ \ | |
1133 | goto overflow; \ | 1133 | goto overflow; \ | |
1134 | } \ | 1134 | } \ | |
1135 | *sbuf++ = (C); \ | 1135 | *sbuf++ = (C); \ | |
1136 | } else { \ | 1136 | } else { \ | |
1137 | putchar((C), oflags, (struct tty *)vp); \ | 1137 | putchar((C), oflags, (struct tty *)vp); \ | |
1138 | } \ | 1138 | } \ | |
1139 | } | 1139 | } | |
1140 | 1140 | |||
1141 | void | |||
1142 | device_printf(device_t dev, const char *fmt, ...) | |||
1143 | { | |||
1144 | va_list ap; | |||
1145 | ||||
1146 | va_start(ap, fmt); | |||
1147 | printf("%s: ", device_xname(dev)); | |||
1148 | vprintf(fmt, ap); | |||
1149 | va_end(ap); | |||
1150 | return; | |||
1151 | } | |||
1152 | ||||
1141 | /* | 1153 | /* | |
1142 | * Guts of kernel printf. Note, we already expect to be in a mutex! | 1154 | * Guts of kernel printf. Note, we already expect to be in a mutex! | |
1143 | */ | 1155 | */ | |
1144 | int | 1156 | int | |
1145 | kprintf(const char *fmt0, int oflags, void *vp, char *sbuf, va_list ap) | 1157 | kprintf(const char *fmt0, int oflags, void *vp, char *sbuf, va_list ap) | |
1146 | { | 1158 | { | |
1147 | const char *fmt; /* format string */ | 1159 | const char *fmt; /* format string */ | |
1148 | int ch; /* character from fmt */ | 1160 | int ch; /* character from fmt */ | |
1149 | int n; /* handy integer (short term usage) */ | 1161 | int n; /* handy integer (short term usage) */ | |
1150 | char *cp; /* handy char pointer (short term usage) */ | 1162 | char *cp; /* handy char pointer (short term usage) */ | |
1151 | int flags; /* flags as above */ | 1163 | int flags; /* flags as above */ | |
1152 | int ret; /* return value accumulator */ | 1164 | int ret; /* return value accumulator */ | |
1153 | int width; /* width from format (%8d), or 0 */ | 1165 | int width; /* width from format (%8d), or 0 */ |
--- src/sys/sys/systm.h 2010/12/30 16:49:25 1.245
+++ src/sys/sys/systm.h 2011/01/21 17:46:19 1.246
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: systm.h,v 1.245 2010/12/30 16:49:25 pooka Exp $ */ | 1 | /* $NetBSD: systm.h,v 1.246 2011/01/21 17:46:19 dyoung Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1982, 1988, 1991, 1993 | 4 | * Copyright (c) 1982, 1988, 1991, 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: | |
@@ -38,30 +38,30 @@ | @@ -38,30 +38,30 @@ | |||
38 | 38 | |||
39 | #ifndef _SYS_SYSTM_H_ | 39 | #ifndef _SYS_SYSTM_H_ | |
40 | #define _SYS_SYSTM_H_ | 40 | #define _SYS_SYSTM_H_ | |
41 | 41 | |||
42 | #if defined(_KERNEL_OPT) | 42 | #if defined(_KERNEL_OPT) | |
43 | #include "opt_ddb.h" | 43 | #include "opt_ddb.h" | |
44 | #include "opt_multiprocessor.h" | 44 | #include "opt_multiprocessor.h" | |
45 | #endif | 45 | #endif | |
46 | 46 | |||
47 | #include <machine/endian.h> | 47 | #include <machine/endian.h> | |
48 | 48 | |||
49 | #ifdef _KERNEL | 49 | #ifdef _KERNEL | |
50 | #include <sys/types.h> | 50 | #include <sys/types.h> | |
51 | #include <sys/device_if.h> | |||
51 | #endif | 52 | #endif | |
52 | 53 | |||
53 | struct clockframe; | 54 | struct clockframe; | |
54 | struct device; | |||
55 | struct lwp; | 55 | struct lwp; | |
56 | struct proc; | 56 | struct proc; | |
57 | struct timeval; | 57 | struct timeval; | |
58 | struct tty; | 58 | struct tty; | |
59 | struct uio; | 59 | struct uio; | |
60 | struct vnode; | 60 | struct vnode; | |
61 | struct vmspace; | 61 | struct vmspace; | |
62 | struct vm_map; | 62 | struct vm_map; | |
63 | 63 | |||
64 | extern const char *panicstr; /* panic message */ | 64 | extern const char *panicstr; /* panic message */ | |
65 | extern int doing_shutdown; /* shutting down */ | 65 | extern int doing_shutdown; /* shutting down */ | |
66 | 66 | |||
67 | extern const char copyright[]; /* system copyright */ | 67 | extern const char copyright[]; /* system copyright */ | |
@@ -79,27 +79,27 @@ extern int autoniceval; /* proc | @@ -79,27 +79,27 @@ extern int autoniceval; /* proc | |||
79 | extern int selwait; /* select timeout address */ | 79 | extern int selwait; /* select timeout address */ | |
80 | 80 | |||
81 | extern int maxmem; /* max memory per process */ | 81 | extern int maxmem; /* max memory per process */ | |
82 | extern int physmem; /* physical memory */ | 82 | extern int physmem; /* physical memory */ | |
83 | 83 | |||
84 | extern dev_t dumpdev; /* dump device */ | 84 | extern dev_t dumpdev; /* dump device */ | |
85 | extern dev_t dumpcdev; /* dump device (character equivalent) */ | 85 | extern dev_t dumpcdev; /* dump device (character equivalent) */ | |
86 | extern long dumplo; /* offset into dumpdev */ | 86 | extern long dumplo; /* offset into dumpdev */ | |
87 | extern int dumpsize; /* size of dump in pages */ | 87 | extern int dumpsize; /* size of dump in pages */ | |
88 | extern const char *dumpspec; /* how dump device was specified */ | 88 | extern const char *dumpspec; /* how dump device was specified */ | |
89 | 89 | |||
90 | extern dev_t rootdev; /* root device */ | 90 | extern dev_t rootdev; /* root device */ | |
91 | extern struct vnode *rootvp; /* vnode equivalent to above */ | 91 | extern struct vnode *rootvp; /* vnode equivalent to above */ | |
92 | extern struct device *root_device; /* device equivalent to above */ | 92 | extern device_t root_device; /* device equivalent to above */ | |
93 | extern const char *rootspec; /* how root device was specified */ | 93 | extern const char *rootspec; /* how root device was specified */ | |
94 | 94 | |||
95 | extern int ncpu; /* number of CPUs configured */ | 95 | extern int ncpu; /* number of CPUs configured */ | |
96 | extern int ncpuonline; /* number of CPUs online */ | 96 | extern int ncpuonline; /* number of CPUs online */ | |
97 | #if defined(_KERNEL) | 97 | #if defined(_KERNEL) | |
98 | extern bool mp_online; /* secondary processors are started */ | 98 | extern bool mp_online; /* secondary processors are started */ | |
99 | #endif /* defined(_KERNEL) */ | 99 | #endif /* defined(_KERNEL) */ | |
100 | 100 | |||
101 | extern const char hexdigits[]; /* "0123456789abcdef" in subr_prf.c */ | 101 | extern const char hexdigits[]; /* "0123456789abcdef" in subr_prf.c */ | |
102 | extern const char HEXDIGITS[]; /* "0123456789ABCDEF" in subr_prf.c */ | 102 | extern const char HEXDIGITS[]; /* "0123456789ABCDEF" in subr_prf.c */ | |
103 | 103 | |||
104 | /* | 104 | /* | |
105 | * These represent the swap pseudo-device (`sw'). This device | 105 | * These represent the swap pseudo-device (`sw'). This device | |
@@ -177,37 +177,38 @@ int sys_nosys(struct lwp *, const void * | @@ -177,37 +177,38 @@ int sys_nosys(struct lwp *, const void * | |||
177 | int sys_nomodule(struct lwp *, const void *, register_t *); | 177 | int sys_nomodule(struct lwp *, const void *, register_t *); | |
178 | 178 | |||
179 | void aprint_normal(const char *, ...) | 179 | void aprint_normal(const char *, ...) | |
180 | __attribute__((__format__(__printf__,1,2))); | 180 | __attribute__((__format__(__printf__,1,2))); | |
181 | void aprint_error(const char *, ...) | 181 | void aprint_error(const char *, ...) | |
182 | __attribute__((__format__(__printf__,1,2))); | 182 | __attribute__((__format__(__printf__,1,2))); | |
183 | void aprint_naive(const char *, ...) | 183 | void aprint_naive(const char *, ...) | |
184 | __attribute__((__format__(__printf__,1,2))); | 184 | __attribute__((__format__(__printf__,1,2))); | |
185 | void aprint_verbose(const char *, ...) | 185 | void aprint_verbose(const char *, ...) | |
186 | __attribute__((__format__(__printf__,1,2))); | 186 | __attribute__((__format__(__printf__,1,2))); | |
187 | void aprint_debug(const char *, ...) | 187 | void aprint_debug(const char *, ...) | |
188 | __attribute__((__format__(__printf__,1,2))); | 188 | __attribute__((__format__(__printf__,1,2))); | |
189 | 189 | |||
190 | struct device; | 190 | void device_printf(device_t, const char *fmt, ...) | |
191 | __attribute__((__format__(__printf__,2,3))); | |||
191 | 192 | |||
192 | void aprint_normal_dev(struct device *, const char *, ...) | 193 | void aprint_normal_dev(device_t, const char *, ...) | |
193 | __attribute__((__format__(__printf__,2,3))); | 194 | __attribute__((__format__(__printf__,2,3))); | |
194 | void aprint_error_dev(struct device *, const char *, ...) | 195 | void aprint_error_dev(device_t, const char *, ...) | |
195 | __attribute__((__format__(__printf__,2,3))); | 196 | __attribute__((__format__(__printf__,2,3))); | |
196 | void aprint_naive_dev(struct device *, const char *, ...) | 197 | void aprint_naive_dev(device_t, const char *, ...) | |
197 | __attribute__((__format__(__printf__,2,3))); | 198 | __attribute__((__format__(__printf__,2,3))); | |
198 | void aprint_verbose_dev(struct device *, const char *, ...) | 199 | void aprint_verbose_dev(device_t, const char *, ...) | |
199 | __attribute__((__format__(__printf__,2,3))); | 200 | __attribute__((__format__(__printf__,2,3))); | |
200 | void aprint_debug_dev(struct device *, const char *, ...) | 201 | void aprint_debug_dev(device_t, const char *, ...) | |
201 | __attribute__((__format__(__printf__,2,3))); | 202 | __attribute__((__format__(__printf__,2,3))); | |
202 | 203 | |||
203 | struct ifnet; | 204 | struct ifnet; | |
204 | 205 | |||
205 | void aprint_normal_ifnet(struct ifnet *, const char *, ...) | 206 | void aprint_normal_ifnet(struct ifnet *, const char *, ...) | |
206 | __attribute__((__format__(__printf__,2,3))); | 207 | __attribute__((__format__(__printf__,2,3))); | |
207 | void aprint_error_ifnet(struct ifnet *, const char *, ...) | 208 | void aprint_error_ifnet(struct ifnet *, const char *, ...) | |
208 | __attribute__((__format__(__printf__,2,3))); | 209 | __attribute__((__format__(__printf__,2,3))); | |
209 | void aprint_naive_ifnet(struct ifnet *, const char *, ...) | 210 | void aprint_naive_ifnet(struct ifnet *, const char *, ...) | |
210 | __attribute__((__format__(__printf__,2,3))); | 211 | __attribute__((__format__(__printf__,2,3))); | |
211 | void aprint_verbose_ifnet(struct ifnet *, const char *, ...) | 212 | void aprint_verbose_ifnet(struct ifnet *, const char *, ...) | |
212 | __attribute__((__format__(__printf__,2,3))); | 213 | __attribute__((__format__(__printf__,2,3))); | |
213 | void aprint_debug_ifnet(struct ifnet *, const char *, ...) | 214 | void aprint_debug_ifnet(struct ifnet *, const char *, ...) | |
@@ -357,30 +358,30 @@ void dopowerhooks(int); | @@ -357,30 +358,30 @@ void dopowerhooks(int); | |||
357 | "softresume", /* 3 */ \ | 358 | "softresume", /* 3 */ \ | |
358 | "softsuspend", /* 4 */ \ | 359 | "softsuspend", /* 4 */ \ | |
359 | "softstandby" /* 5 */ | 360 | "softstandby" /* 5 */ | |
360 | 361 | |||
361 | /* | 362 | /* | |
362 | * Mountroot hooks (and mountroot declaration). Device drivers establish | 363 | * Mountroot hooks (and mountroot declaration). Device drivers establish | |
363 | * these to be executed just before (*mountroot)() if the passed device is | 364 | * these to be executed just before (*mountroot)() if the passed device is | |
364 | * selected as the root device. | 365 | * selected as the root device. | |
365 | */ | 366 | */ | |
366 | 367 | |||
367 | #define ROOT_FSTYPE_ANY "?" | 368 | #define ROOT_FSTYPE_ANY "?" | |
368 | 369 | |||
369 | extern const char *rootfstype; | 370 | extern const char *rootfstype; | |
370 | void *mountroothook_establish(void (*)(struct device *), struct device *); | 371 | void *mountroothook_establish(void (*)(device_t), device_t); | |
371 | void mountroothook_disestablish(void *); | 372 | void mountroothook_disestablish(void *); | |
372 | void mountroothook_destroy(void); | 373 | void mountroothook_destroy(void); | |
373 | void domountroothook(struct device *); | 374 | void domountroothook(device_t); | |
374 | 375 | |||
375 | /* | 376 | /* | |
376 | * Exec hooks. Subsystems may want to do cleanup when a process | 377 | * Exec hooks. Subsystems may want to do cleanup when a process | |
377 | * execs. | 378 | * execs. | |
378 | */ | 379 | */ | |
379 | void *exechook_establish(void (*)(struct proc *, void *), void *); | 380 | void *exechook_establish(void (*)(struct proc *, void *), void *); | |
380 | void exechook_disestablish(void *); | 381 | void exechook_disestablish(void *); | |
381 | void doexechooks(struct proc *); | 382 | void doexechooks(struct proc *); | |
382 | 383 | |||
383 | /* | 384 | /* | |
384 | * Exit hooks. Subsystems may want to do cleanup when a process exits. | 385 | * Exit hooks. Subsystems may want to do cleanup when a process exits. | |
385 | */ | 386 | */ | |
386 | void *exithook_establish(void (*)(struct proc *, void *), void *); | 387 | void *exithook_establish(void (*)(struct proc *, void *), void *); |