summaryrefslogtreecommitdiffstats
path: root/usr.bin/vmstat/names.c
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1994-10-16 04:04:56 +0000
committerwollman <wollman@FreeBSD.org>1994-10-16 04:04:56 +0000
commitefe252383a18309d36b9097092f5877d027bcb4d (patch)
tree4295e08c6a9b4de8f8e591e4049dcdf0b7f08a6d /usr.bin/vmstat/names.c
parentc4ebe36a0b73d69bc66940de52548d266402051c (diff)
downloadFreeBSD-src-efe252383a18309d36b9097092f5877d027bcb4d.zip
FreeBSD-src-efe252383a18309d36b9097092f5877d027bcb4d.tar.gz
New way of getting disk drive names.
Diffstat (limited to 'usr.bin/vmstat/names.c')
-rw-r--r--usr.bin/vmstat/names.c47
1 files changed, 10 insertions, 37 deletions
diff --git a/usr.bin/vmstat/names.c b/usr.bin/vmstat/names.c
index 603be7d..0613859 100644
--- a/usr.bin/vmstat/names.c
+++ b/usr.bin/vmstat/names.c
@@ -44,51 +44,24 @@ char *defdrives[] = { 0 };
*/
#include <i386/isa/isa_device.h>
-char *defdrives[] = { "fd0", "fd1", "wd0", "wd1", "sd0", "sd1", 0 };
+char *defdrives[] = { "wd0", "wd1", "sd0", "sd1" };
int
read_names()
{
- register char *p;
- register u_long isa_bio;
- static char buf[BUFSIZ];
- struct isa_device dev;
- struct isa_driver drv;
- char name[10];
- int i = 0;
- int dummydk = 0;
- int fdunit = 0;
- int wdunit = 0;
- int ahaunit = 0;
+ u_long dk_names;
+ static char thenames[DK_NDRIVE][DK_NAMELEN];
+ int i;
- isa_bio = namelist[X_ISA_BIO].n_value;
- if (isa_bio == 0) {
- (void) fprintf(stderr,
- "vmstat: disk init info not in namelist\n");
+ dk_names = namelist[X_DK_NAMES].n_value;
+ if (dk_names == 0) {
+ warnx("disk name info not in namelist");
return(0);
}
- p = buf;
- for (;; isa_bio += sizeof dev) {
- (void)kvm_read(kd, isa_bio, &dev, sizeof dev);
- if (dev.id_driver == 0)
- break;
- if (dev.id_alive == 0)
- continue;
- (void)kvm_read(kd, (u_long)dev.id_driver, &drv, sizeof drv);
- (void)kvm_read(kd, (u_long)drv.name, name, sizeof name);
-
- /*
- * XXX FreeBSD is kinda brain dead about dk_units, or at least
- * I can't figure out how to get the real unit mappings
- */
- if (strcmp(name, "fd") == 0) dummydk = fdunit++;
- if (strcmp(name, "wd") == 0) dummydk = wdunit++;
- if (strcmp(name, "aha") == 0) dummydk = ahaunit++;
-
- dr_name[i] = p;
- p += sprintf(p, "%s%d", name, dummydk) + 1;
- i++;
+ kvm_read(kd, dk_names, thenames, sizeof thenames);
+ for(i = 0; thenames[i][0]; i++) {
+ dr_name[i] = thenames[i];
}
return(1);
}
OpenPOWER on IntegriCloud