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
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user