summaryrefslogtreecommitdiffstats
path: root/sbin/fdisk
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-03-29 22:06:52 +0000
committerphk <phk@FreeBSD.org>2003-03-29 22:06:52 +0000
commita931dc5a57f15ea83952c83762df583d7855e6af (patch)
treef6f887f7ba2b6927501181f68c2743017399a3d7 /sbin/fdisk
parent46dc207e19b88df2f1458fd0de816784af11270f (diff)
downloadFreeBSD-src-a931dc5a57f15ea83952c83762df583d7855e6af.zip
FreeBSD-src-a931dc5a57f15ea83952c83762df583d7855e6af.tar.gz
Use default geometry in case the device doesn't provide one:
512 for sectorsize. 63 for sectors. 255 for heads. This will mostly show up on MD(4) devices.
Diffstat (limited to 'sbin/fdisk')
-rw-r--r--sbin/fdisk/fdisk.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index db753fd..cea2317 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -780,15 +780,20 @@ get_params()
error = ioctl(fd, DIOCGFWSECTORS, &u);
if (error == 0)
sectors = dos_sectors = u;
+ else
+ sectors = dos_sectors = 63;
+
error = ioctl(fd, DIOCGFWHEADS, &u);
if (error == 0)
heads = dos_heads = u;
+ else
+ heads = dos_heads = 255;
dos_cylsecs = cylsecs = heads * sectors;
disksecs = cyls * heads * sectors;
error = ioctl(fd, DIOCGSECTORSIZE, &u);
- if (error != 0)
+ if (error != 0 || u == 0)
u = 512;
error = ioctl(fd, DIOCGMEDIASIZE, &o);
OpenPOWER on IntegriCloud