diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-10-04 00:15:49 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-10-04 00:15:49 +0000 |
commit | 72cc3697e569578454af0585350147aa2dfb75f3 (patch) | |
tree | bdd758f3d5f7ccce681fab95b307e9ff658d4319 | |
parent | 7f42a76984917825029eec6e2f44ed5fe08bb7ff (diff) |
support CPU_BIOSDEV on i386
-rw-r--r-- | sbin/fdisk/Makefile | 6 | ||||
-rw-r--r-- | sbin/fdisk/disk.c | 33 |
2 files changed, 21 insertions, 18 deletions
diff --git a/sbin/fdisk/Makefile b/sbin/fdisk/Makefile index ac3b0d6a5b8..688e994932b 100644 --- a/sbin/fdisk/Makefile +++ b/sbin/fdisk/Makefile @@ -1,5 +1,5 @@ # -# $OpenBSD: Makefile,v 1.4 1997/09/29 22:58:13 weingart Exp $ +# $OpenBSD: Makefile,v 1.5 1997/10/04 00:15:48 deraadt Exp $ # # Copyright (c) 1997 Tobias Weingartner # All rights reserved. @@ -36,4 +36,8 @@ DPADD= ${LIBUTIL} LDADD= -lutil MAN= fdisk.8 +.if ${MACHINE} == "i386" +COPTS += -DCPU_BIOSDEV +.endif + .include <bsd.prog.mk> diff --git a/sbin/fdisk/disk.c b/sbin/fdisk/disk.c index 373d37eac18..f6587582885 100644 --- a/sbin/fdisk/disk.c +++ b/sbin/fdisk/disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.c,v 1.2 1997/09/29 23:33:34 mickey Exp $ */ +/* $OpenBSD: disk.c,v 1.3 1997/10/04 00:15:48 deraadt Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -108,7 +108,6 @@ DISK_getrealmetrics(name) return(lm); } - #ifdef CPU_BIOSDEV /* Routine to go after sysctl info for BIOS * geometry. This should only really work on PC @@ -122,38 +121,38 @@ DISK_getbiosmetrics(name) char *name; { DISK_metrics *bm = NULL; - int biosdev, biosgeo; - int mib[3], size; + int biosdev; + u_int biosgeo; + int mib[4], size; /* Get BIOS metrics */ mib[0] = CTL_MACHDEP; - mib[1] = CPU_BIOSDEV; - size = sizeof(int); + mib[1] = CPU_BIOS; + mib[2] = BIOS_DEV; + size = sizeof(biosdev); - if(sysctl(mib, 2, &biosdev, &size, NULL, 0) < 0){ + if(sysctl(mib, 3, &biosdev, &size, NULL, 0) < 0){ warn("sysctl"); - return(NULL); + return (NULL); } - mib[1] = CPU_BIOSGEOMETRY; - size = sizeof(int); + mib[2] = BIOS_GEOMETRY; + size = sizeof(biosgeo); - if(sysctl(mib, 2, &biosgeo, &size, NULL, 0) < 0){ + if(sysctl(mib, 3, &biosgeo, &size, NULL, 0) < 0){ warn("sysctl"); - return(NULL); + return (NULL); } bm = malloc(sizeof(DISK_metrics)); bm->cylinders = BIOSNTRACKS(biosgeo); bm->heads = BIOSNHEADS(biosgeo); bm->sectors = BIOSNSECTS(biosgeo); - bm->size = BIOSNTRACKS(biosgeo) * BIOSNHEADS(biosgeo) - * BIOSNSECTS(biosgeo); - + bm->size = BIOSNTRACKS(biosgeo) * BIOSNHEADS(biosgeo) * + BIOSNSECTS(biosgeo); return(bm); } -#endif /* CPU_BIOSDEV */ - +#endif /* This is ugly, and convoluted. All the magic * for disk geo/size happens here. Basically, |