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.
This commit is contained in:
Poul-Henning Kamp 2003-03-29 22:06:52 +00:00
parent 18e03d5e08
commit c0fdfdba29
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112826

View File

@ -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);