]>
git.saurik.com Git - apple/system_cmds.git/blob - iostat.tproj/names.c
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
25 * Copyright (c) 1986, 1991, 1993
26 * The Regents of the University of California. All rights reserved.
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
31 * 1. Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * 2. Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in the
35 * documentation and/or other materials provided with the distribution.
36 * 3. All advertising materials mentioning features or use of this software
37 * must display the following acknowledgement:
38 * This product includes software developed by the University of
39 * California, Berkeley and its contributors.
40 * 4. Neither the name of the University nor the names of its contributors
41 * may be used to endorse or promote products derived from this software
42 * without specific prior written permission.
44 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
45 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
47 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
48 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
49 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57 #if !defined(hp300) && !defined(tahoe) && !defined(vax) && \
58 !defined(luna68k) && !defined(mips)
59 char *defdrives
[] = { 0 };
67 #if defined(hp300) || defined(luna68k)
69 #include <hp/dev/device.h>
71 #include <luna68k/dev/device.h>
74 char *defdrives
[] = { "sd0", "sd1", "sd2", "rd0", "rd1", "rd2", 0 };
81 static char buf
[BUFSIZ
];
82 struct hp_device hdev
;
86 hp
= namelist
[X_HPDINIT
].n_value
;
89 "disk init info not in namelist\n");
93 for (;; hp
+= sizeof hdev
) {
94 (void)kvm_read(kd
, hp
, &hdev
, sizeof hdev
);
95 if (hdev
.hp_driver
== 0)
97 if (hdev
.hp_dk
< 0 || hdev
.hp_alive
== 0 ||
100 (void)kvm_read(kd
, (u_long
)hdev
.hp_driver
, &hdrv
, sizeof hdrv
);
101 (void)kvm_read(kd
, (u_long
)hdrv
.d_name
, name
, sizeof name
);
102 dr_name
[hdev
.hp_dk
] = p
;
103 p
+= sprintf(p
, "%s%d", name
, hdev
.hp_unit
) + 1;
107 #endif /* hp300 || luna68k */
110 #include <tahoe/vba/vbavar.h>
112 char *defdrives
[] = { "dk0", "dk1", "dk2", 0 };
118 struct vba_device udev
, *up
;
119 struct vba_driver udrv
;
121 static char buf
[BUFSIZ
];
123 up
= (struct vba_device
*)namelist
[X_VBDINIT
].n_value
;
125 (void) fprintf(stderr
,
126 "disk init info not in namelist\n");
130 for (;; up
+= sizeof udev
) {
131 (void)kvm_read(kd
, up
, &udev
, sizeof udev
);
132 if (udev
.ui_driver
== 0)
134 if (udev
.ui_dk
< 0 || udev
.ui_alive
== 0)
136 (void)kvm_read(kd
, udev
.ui_driver
, &udrv
, sizeof udrv
);
137 (void)kvm_read(kd
, udrv
.ud_dname
, name
, sizeof name
);
138 dr_name
[udev
.ui_dk
] = p
;
139 p
+= sprintf(p
, "%s%d", name
, udev
.ui_unit
);
146 #include <vax/uba/ubavar.h>
147 #include <vax/mba/mbavar.h>
149 char *defdrives
[] = { "hp0", "hp1", "hp2", 0 };
155 unsigned long mp
, up
;
156 struct mba_device mdev
;
157 struct mba_driver mdrv
;
158 struct uba_device udev
;
159 struct uba_driver udrv
;
161 static char buf
[BUFSIZ
];
163 mp
= namelist
[X_MBDINIT
].n_value
;
164 up
= namelist
[X_UBDINIT
].n_value
;
165 if (mp
== 0 && up
== 0) {
166 (void)fprintf(stderr
,
167 "disk init info not in namelist\n");
172 for (;; mp
+= sizeof mdev
) {
173 (void)kvm_read(kd
, mp
, &mdev
, sizeof mdev
);
174 if (mdev
.mi_driver
== 0)
176 if (mdev
.mi_dk
< 0 || mdev
.mi_alive
== 0)
178 (void)kvm_read(kd
, mdev
.mi_driver
, &mdrv
, sizeof mdrv
);
179 (void)kvm_rea(kd
, mdrv
.md_dname
, name
, sizeof name
);
180 dr_name
[mdev
.mi_dk
] = p
;
181 p
+= sprintf(p
, "%s%d", name
, mdev
.mi_unit
);
184 for (;; up
+= sizeof udev
) {
185 (void)kvm_read(kd
, up
, &udev
, sizeof udev
);
186 if (udev
.ui_driver
== 0)
188 if (udev
.ui_dk
< 0 || udev
.ui_alive
== 0)
190 (void)kvm_read(kd
, udev
.ui_driver
, &udrv
, sizeof udrv
);
191 (void)kvm_read(kd
, udrv
.ud_dname
, name
, sizeof name
);
192 dr_name
[udev
.ui_dk
] = p
;
193 p
+= sprintf(p
, "%s%d", name
, udev
.ui_unit
);
200 #include <sundev/mbvar.h>
206 struct mb_device mdev
;
207 struct mb_driver mdrv
;
209 char *cp
= (char *) &two_char
;
210 register struct mb_device
*mp
;
212 mp
= (struct mb_device
*)namelist
[X_MBDINIT
].n_value
;
214 (void)fprintf(stderr
,
215 "disk init info not in namelist\n");
219 (void)kvm_read(kd
, mp
++, &mdev
, sizeof(mdev
));
220 if (mdev
.md_driver
== 0)
222 if (mdev
.md_dk
< 0 || mdev
.md_alive
== 0)
224 (void)kvm_read(kd
, mdev
.md_driver
, &mdrv
, sizeof(mdrv
));
225 (void)kvm_read(kd
, mdrv
.mdr_dname
, &two_char
, sizeof(two_char
));
226 (void)sprintf(dr_name
[mdev
.md_dk
],
227 "%c%c%d", cp
[0], cp
[1], mdev
.md_unit
);
234 #include <pmax/dev/device.h>
236 char *defdrives
[] = { "rz0", "rz1", "rz2", "rz3", "rz4", "rz5", "rz6", 0 };
243 static char buf
[BUFSIZ
];
244 struct scsi_device sdev
;
248 sp
= namelist
[X_SCSI_DINIT
].n_value
;
250 (void)fprintf(stderr
, "disk init info not in namelist\n");
254 for (;; sp
+= sizeof sdev
) {
255 (void)kvm_read(kd
, sp
, &sdev
, sizeof sdev
);
256 if (sdev
.sd_driver
== 0)
258 if (sdev
.sd_dk
< 0 || sdev
.sd_alive
== 0 ||
259 sdev
.sd_cdriver
== 0)
261 (void)kvm_read(kd
, (u_long
)sdev
.sd_driver
, &hdrv
, sizeof hdrv
);
262 (void)kvm_read(kd
, (u_long
)hdrv
.d_name
, name
, sizeof name
);
263 dr_name
[sdev
.sd_dk
] = p
;
264 p
+= sprintf(p
, "%s%d", name
, sdev
.sd_unit
) + 1;