Output machdep.guessed_bootdev as an integer rather than try to format

it according to ancient and obsolete rules.

This removes one more user of <sys/diskslice.h>
This commit is contained in:
phk 2003-04-03 21:41:14 +00:00
parent 96d4258af9
commit 383d50b298

View File

@ -46,7 +46,6 @@ static const char rcsid[] =
#endif /* not lint */
#ifdef __i386__
#include <sys/diskslice.h> /* used for bootdev parsing */
#include <sys/reboot.h> /* used for bootdev parsing */
#endif
#include <sys/param.h>
@ -451,55 +450,6 @@ oidfmt(int *oid, int len, char *fmt, u_int *kind)
return 0;
}
#ifdef __i386__
/*
* Code to map a bootdev major number into a suitable device name.
* Major numbers are mapped into names as in boot2.c
*/
struct _foo {
int majdev;
char *name;
} maj2name[] = {
30, "ad",
0, "wd",
1, "wfd",
2, "fd",
4, "da",
-1, NULL /* terminator */
};
static int
machdep_bootdev(u_long value)
{
int majdev, unit, slice, part;
struct _foo *p;
if (value & B_MAGICMASK != B_DEVMAGIC) {
printf("invalid (0x%08x)", value);
return 0;
}
majdev = B_TYPE(value);
unit = B_UNIT(value);
slice = B_SLICE(value);
part = B_PARTITION(value);
if (majdev == 2) { /* floppy, as known to the boot block... */
printf("/dev/fd%d", unit);
return 0;
}
for (p = maj2name; p->name != NULL && p->majdev != majdev ; p++) ;
if (p->name != NULL) { /* found */
if (slice == WHOLE_DISK_SLICE)
printf("/dev/%s%d%c", p->name, unit, part);
else
printf("/dev/%s%ds%d%c",
p->name, unit, slice - BASE_SLICE + 1, part + 'a');
} else
printf("unknown (major %d unit %d slice %d part %d)",
majdev, unit, slice, part);
return 0;
}
#endif
/*
* This formats and outputs the value of one variable
*
@ -593,10 +543,6 @@ show_var(int *oid, int nlen)
if (!nflag)
printf("%s%s", name, sep);
fmt++;
#ifdef __i386__
if (!strcmp(name, "machdep.guessed_bootdev"))
return machdep_bootdev(*(unsigned long *)p);
#endif
val = "";
while (len >= sizeof(long)) {
if(*fmt == 'U')