Add read_names support for i386, based on my original work from FreeBSD

and cleaned up slightly.
This commit is contained in:
Rodney W. Grimes 1994-05-29 06:19:34 +00:00
parent 7a34df0d8f
commit 987df638a9
2 changed files with 62 additions and 2 deletions

View File

@ -34,10 +34,66 @@
*/
#if !defined(hp300) && !defined(tahoe) && !defined(vax) && \
!defined(luna68k) && !defined(mips)
!defined(luna68k) && !defined(mips) && !defined(i386)
char *defdrives[] = { 0 };
#endif
#if defined(i386)
/*
* i386 support added by Rodney W. Grimes.
*/
#include <i386/isa/isa_device.h>
char *defdrives[] = { "fd0", "fd1", "wd0", "wd1", "sd0", "sd1", 0 };
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;
isa_bio = namelist[X_ISA_BIO].n_value;
if (isa_bio == 0) {
(void) fprintf(stderr,
"vmstat: disk init info not in namelist\n");
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++;
}
return(1);
}
#endif /* i386 */
#if defined(hp300) || defined(luna68k)
#if defined(hp300)
#include <hp/dev/device.h>

View File

@ -107,7 +107,7 @@ struct nlist namelist[] = {
{ "_pgintime" },
#define X_XSTATS 18
{ "_xstats" },
#define X_END 18
#define X_END 19
#else
#define X_END 14
#endif
@ -115,6 +115,10 @@ struct nlist namelist[] = {
#define X_HPDINIT (X_END)
{ "_hp_dinit" },
#endif
#if defined(i386)
#define X_ISA_BIO (X_END)
{ "_isa_devtab_bio" },
#endif
#ifdef mips
#define X_SCSI_DINIT (X_END)
{ "_scsi_dinit" },