Commit | Line | Data |
---|---|---|
95121845 | 1 | /*- |
ad787160 C |
2 | * Copyright (c) 1991, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
95121845 | 4 | * |
ad787160 C |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions | |
7 | * are met: | |
8 | * 1. Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * 2. Redistributions in binary form must reproduce the above copyright | |
11 | * notice, this list of conditions and the following disclaimer in the | |
12 | * documentation and/or other materials provided with the distribution. | |
13 | * 3. All advertising materials mentioning features or use of this software | |
14 | * must display the following acknowledgement: | |
15 | * This product includes software developed by the University of | |
16 | * California, Berkeley and its contributors. | |
17 | * 4. Neither the name of the University nor the names of its contributors | |
18 | * may be used to endorse or promote products derived from this software | |
19 | * without specific prior written permission. | |
95121845 | 20 | * |
ad787160 C |
21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
31 | * SUCH DAMAGE. | |
32 | * | |
33 | * @(#)names.c 8.1 (Berkeley) 6/6/93 | |
95121845 KB |
34 | */ |
35 | ||
b26c2491 RC |
36 | #if !defined(hp300) && !defined(tahoe) && !defined(vax) && \ |
37 | !defined(luna68k) && !defined(mips) | |
95121845 KB |
38 | char *defdrives[] = { 0 }; |
39 | #endif | |
40 | ||
413f7539 KB |
41 | #if defined(hp300) || defined(luna68k) |
42 | #if defined(hp300) | |
1e903c14 | 43 | #include <hp/dev/device.h> |
413f7539 KB |
44 | #else |
45 | #include <luna68k/dev/device.h> | |
46 | #endif | |
95121845 | 47 | |
1e03cb7b | 48 | char *defdrives[] = { "sd0", "sd1", "sd2", "rd0", "rd1", "rd2", 0 }; |
95121845 | 49 | |
74a17228 | 50 | int |
95121845 KB |
51 | read_names() |
52 | { | |
53 | register char *p; | |
54 | register u_long hp; | |
55 | static char buf[BUFSIZ]; | |
56 | struct hp_device hdev; | |
57 | struct driver hdrv; | |
58 | char name[10]; | |
59 | ||
a53579e2 | 60 | hp = namelist[X_HPDINIT].n_value; |
95121845 | 61 | if (hp == 0) { |
74a17228 KB |
62 | (void)fprintf(stderr, |
63 | "disk init info not in namelist\n"); | |
64 | return (0); | |
95121845 KB |
65 | } |
66 | p = buf; | |
67 | for (;; hp += sizeof hdev) { | |
3a857703 | 68 | (void)kvm_read(kd, hp, &hdev, sizeof hdev); |
95121845 KB |
69 | if (hdev.hp_driver == 0) |
70 | break; | |
1e03cb7b MK |
71 | if (hdev.hp_dk < 0 || hdev.hp_alive == 0 || |
72 | hdev.hp_cdriver == 0) | |
95121845 | 73 | continue; |
3a857703 SM |
74 | (void)kvm_read(kd, (u_long)hdev.hp_driver, &hdrv, sizeof hdrv); |
75 | (void)kvm_read(kd, (u_long)hdrv.d_name, name, sizeof name); | |
95121845 | 76 | dr_name[hdev.hp_dk] = p; |
1e03cb7b | 77 | p += sprintf(p, "%s%d", name, hdev.hp_unit) + 1; |
95121845 | 78 | } |
74a17228 | 79 | return (1); |
95121845 | 80 | } |
413f7539 | 81 | #endif /* hp300 || luna68k */ |
95121845 KB |
82 | |
83 | #ifdef tahoe | |
84 | #include <tahoe/vba/vbavar.h> | |
85 | ||
86 | char *defdrives[] = { "dk0", "dk1", "dk2", 0 }; | |
87 | ||
74a17228 | 88 | int |
95121845 KB |
89 | read_names() |
90 | { | |
91 | register char *p; | |
92 | struct vba_device udev, *up; | |
93 | struct vba_driver udrv; | |
94 | char name[10]; | |
95 | static char buf[BUFSIZ]; | |
96 | ||
a53579e2 | 97 | up = (struct vba_device *)namelist[X_VBDINIT].n_value; |
95121845 KB |
98 | if (up == 0) { |
99 | (void) fprintf(stderr, | |
74a17228 KB |
100 | "disk init info not in namelist\n"); |
101 | return (0); | |
95121845 KB |
102 | } |
103 | p = buf; | |
104 | for (;; up += sizeof udev) { | |
3a857703 | 105 | (void)kvm_read(kd, up, &udev, sizeof udev); |
95121845 KB |
106 | if (udev.ui_driver == 0) |
107 | break; | |
108 | if (udev.ui_dk < 0 || udev.ui_alive == 0) | |
109 | continue; | |
3a857703 SM |
110 | (void)kvm_read(kd, udev.ui_driver, &udrv, sizeof udrv); |
111 | (void)kvm_read(kd, udrv.ud_dname, name, sizeof name); | |
95121845 KB |
112 | dr_name[udev.ui_dk] = p; |
113 | p += sprintf(p, "%s%d", name, udev.ui_unit); | |
114 | } | |
74a17228 | 115 | return (1); |
95121845 KB |
116 | } |
117 | #endif /* tahoe */ | |
118 | ||
119 | #ifdef vax | |
120 | #include <vax/uba/ubavar.h> | |
121 | #include <vax/mba/mbavar.h> | |
122 | ||
123 | char *defdrives[] = { "hp0", "hp1", "hp2", 0 }; | |
124 | ||
74a17228 | 125 | int |
95121845 KB |
126 | read_names() |
127 | { | |
128 | register char *p; | |
129 | unsigned long mp, up; | |
130 | struct mba_device mdev; | |
131 | struct mba_driver mdrv; | |
132 | struct uba_device udev; | |
133 | struct uba_driver udrv; | |
134 | char name[10]; | |
135 | static char buf[BUFSIZ]; | |
136 | ||
a53579e2 KB |
137 | mp = namelist[X_MBDINIT].n_value; |
138 | up = namelist[X_UBDINIT].n_value; | |
95121845 | 139 | if (mp == 0 && up == 0) { |
74a17228 KB |
140 | (void)fprintf(stderr, |
141 | "disk init info not in namelist\n"); | |
142 | return (0); | |
95121845 KB |
143 | } |
144 | p = buf; | |
74a17228 KB |
145 | if (mp) |
146 | for (;; mp += sizeof mdev) { | |
147 | (void)kvm_read(kd, mp, &mdev, sizeof mdev); | |
148 | if (mdev.mi_driver == 0) | |
149 | break; | |
150 | if (mdev.mi_dk < 0 || mdev.mi_alive == 0) | |
151 | continue; | |
152 | (void)kvm_read(kd, mdev.mi_driver, &mdrv, sizeof mdrv); | |
153 | (void)kvm_rea(kd, mdrv.md_dname, name, sizeof name); | |
154 | dr_name[mdev.mi_dk] = p; | |
155 | p += sprintf(p, "%s%d", name, mdev.mi_unit); | |
156 | } | |
157 | if (up) | |
158 | for (;; up += sizeof udev) { | |
159 | (void)kvm_read(kd, up, &udev, sizeof udev); | |
160 | if (udev.ui_driver == 0) | |
161 | break; | |
162 | if (udev.ui_dk < 0 || udev.ui_alive == 0) | |
163 | continue; | |
164 | (void)kvm_read(kd, udev.ui_driver, &udrv, sizeof udrv); | |
165 | (void)kvm_read(kd, udrv.ud_dname, name, sizeof name); | |
166 | dr_name[udev.ui_dk] = p; | |
167 | p += sprintf(p, "%s%d", name, udev.ui_unit); | |
168 | } | |
169 | return (1); | |
170 | } | |
171 | #endif /* vax */ | |
172 | ||
173 | #ifdef sun | |
174 | #include <sundev/mbvar.h> | |
175 | ||
176 | int | |
177 | read_names() | |
178 | { | |
179 | static int once = 0; | |
180 | struct mb_device mdev; | |
181 | struct mb_driver mdrv; | |
182 | short two_char; | |
183 | char *cp = (char *) &two_char; | |
184 | register struct mb_device *mp; | |
185 | ||
a53579e2 | 186 | mp = (struct mb_device *)namelist[X_MBDINIT].n_value; |
74a17228 KB |
187 | if (mp == 0) { |
188 | (void)fprintf(stderr, | |
189 | "disk init info not in namelist\n"); | |
190 | return (0); | |
95121845 | 191 | } |
74a17228 KB |
192 | for (;; ++mp) { |
193 | (void)kvm_read(kd, mp++, &mdev, sizeof(mdev)); | |
194 | if (mdev.md_driver == 0) | |
95121845 | 195 | break; |
74a17228 | 196 | if (mdev.md_dk < 0 || mdev.md_alive == 0) |
95121845 | 197 | continue; |
74a17228 KB |
198 | (void)kvm_read(kd, mdev.md_driver, &mdrv, sizeof(mdrv)); |
199 | (void)kvm_read(kd, mdrv.mdr_dname, &two_char, sizeof(two_char)); | |
200 | (void)sprintf(dr_name[mdev.md_dk], | |
201 | "%c%c%d", cp[0], cp[1], mdev.md_unit); | |
95121845 | 202 | } |
74a17228 | 203 | return(1); |
95121845 | 204 | } |
74a17228 | 205 | #endif /* sun */ |
b26c2491 RC |
206 | |
207 | #if defined(mips) | |
208 | #include <pmax/dev/device.h> | |
209 | ||
210 | char *defdrives[] = { "rz0", "rz1", "rz2", "rz3", "rz4", "rz5", "rz6", 0 }; | |
211 | ||
212 | int | |
213 | read_names() | |
214 | { | |
215 | register char *p; | |
216 | register u_long sp; | |
217 | static char buf[BUFSIZ]; | |
218 | struct scsi_device sdev; | |
219 | struct driver hdrv; | |
220 | char name[10]; | |
221 | ||
222 | sp = namelist[X_SCSI_DINIT].n_value; | |
223 | if (sp == 0) { | |
224 | (void)fprintf(stderr, "disk init info not in namelist\n"); | |
225 | return (0); | |
226 | } | |
227 | p = buf; | |
228 | for (;; sp += sizeof sdev) { | |
229 | (void)kvm_read(kd, sp, &sdev, sizeof sdev); | |
230 | if (sdev.sd_driver == 0) | |
231 | break; | |
232 | if (sdev.sd_dk < 0 || sdev.sd_alive == 0 || | |
233 | sdev.sd_cdriver == 0) | |
234 | continue; | |
235 | (void)kvm_read(kd, (u_long)sdev.sd_driver, &hdrv, sizeof hdrv); | |
236 | (void)kvm_read(kd, (u_long)hdrv.d_name, name, sizeof name); | |
237 | dr_name[sdev.sd_dk] = p; | |
238 | p += sprintf(p, "%s%d", name, sdev.sd_unit) + 1; | |
239 | } | |
240 | return (1); | |
241 | } | |
242 | #endif /* mips */ |