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:
parent
18e03d5e08
commit
c0fdfdba29
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112826
@ -780,15 +780,20 @@ get_params()
|
|||||||
error = ioctl(fd, DIOCGFWSECTORS, &u);
|
error = ioctl(fd, DIOCGFWSECTORS, &u);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
sectors = dos_sectors = u;
|
sectors = dos_sectors = u;
|
||||||
|
else
|
||||||
|
sectors = dos_sectors = 63;
|
||||||
|
|
||||||
error = ioctl(fd, DIOCGFWHEADS, &u);
|
error = ioctl(fd, DIOCGFWHEADS, &u);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
heads = dos_heads = u;
|
heads = dos_heads = u;
|
||||||
|
else
|
||||||
|
heads = dos_heads = 255;
|
||||||
|
|
||||||
dos_cylsecs = cylsecs = heads * sectors;
|
dos_cylsecs = cylsecs = heads * sectors;
|
||||||
disksecs = cyls * heads * sectors;
|
disksecs = cyls * heads * sectors;
|
||||||
|
|
||||||
error = ioctl(fd, DIOCGSECTORSIZE, &u);
|
error = ioctl(fd, DIOCGSECTORSIZE, &u);
|
||||||
if (error != 0)
|
if (error != 0 || u == 0)
|
||||||
u = 512;
|
u = 512;
|
||||||
|
|
||||||
error = ioctl(fd, DIOCGMEDIASIZE, &o);
|
error = ioctl(fd, DIOCGMEDIASIZE, &o);
|
||||||
|
Loading…
Reference in New Issue
Block a user