summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1997-08-28 19:31:52 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1997-08-28 19:31:52 +0000
commite2a05e477ed2d60a03869c0d87ab32bbcc17c4c4 (patch)
treeca6a9252b0010c4e7693f69a359b991dface1700 /usr.sbin
parenteb8af2eae1f65845096ba7c105cd6d96e1d1b881 (diff)
grok bios geometry
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sysctl/sysctl.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/usr.sbin/sysctl/sysctl.c b/usr.sbin/sysctl/sysctl.c
index b2ec2f2a58f..f488cec1168 100644
--- a/usr.sbin/sysctl/sysctl.c
+++ b/usr.sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.21 1997/08/19 23:20:32 millert Exp $ */
+/* $OpenBSD: sysctl.c,v 1.22 1997/08/28 19:31:51 mickey Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)sysctl.c 8.1 (Berkeley) 6/6/93";
#else
-static char *rcsid = "$OpenBSD: sysctl.c,v 1.21 1997/08/19 23:20:32 millert Exp $";
+static char *rcsid = "$OpenBSD: sysctl.c,v 1.22 1997/08/28 19:31:51 mickey Exp $";
#endif
#endif /* not lint */
@@ -86,6 +86,10 @@ static char *rcsid = "$OpenBSD: sysctl.c,v 1.21 1997/08/19 23:20:32 millert Exp
#include <string.h>
#include <ctype.h>
+#ifdef CPU_BIOSGEOMETRY
+#include <machine/biosvar.h>
+#endif
+
struct ctlname topname[] = CTL_NAMES;
struct ctlname kernname[] = CTL_KERN_NAMES;
struct ctlname vmname[] = CTL_VM_NAMES;
@@ -132,6 +136,7 @@ int Aflag, aflag, nflag, wflag;
#define CONSDEV 0x00000004
#define RNDSTATS 0x00000008
#define BADDYNAMIC 0x00000010
+#define BIOSGEO 0x00000020
/* prototypes */
void debuginit __P((void));
@@ -395,6 +400,10 @@ parse(string, flags)
if (mib[1] == CPU_CONSDEV)
special |= CONSDEV;
#endif
+#ifdef CPU_BIOSGEOMETRY
+ if (mib[1] == CPU_BIOSGEOMETRY)
+ special |= BIOSGEO;
+#endif
break;
case CTL_FS:
@@ -481,6 +490,15 @@ parse(string, flags)
(void)printf("0x%x\n", dev);
return;
}
+ if (special & BIOSGEO) {
+ int geo = *(int *)buf;
+
+ if (!nflag)
+ (void)printf("%s = ", string);
+ (void) printf("spt = %d, hpc = %d\n",
+ BIOSNSECTS(geo), BIOSNHEADS(geo));
+ return;
+ }
if (special & RNDSTATS) {
struct rndstats *rndstats = (struct rndstats *)buf;