OSDN Git Service

libparted: avoid the HDIO_GETGEO ioctl when possible
authorPhillip Susi <psusi@cfl.rr.com>
Sat, 17 Dec 2011 04:05:40 +0000 (23:05 -0500)
committerJim Meyering <meyering@redhat.com>
Thu, 5 Jan 2012 18:39:41 +0000 (19:39 +0100)
commit9b9913a315fb739fb8b886e84c8dd137539faacf
tree5bd685af4727677291e685d31fa334ff9f4c11ff
parentf5c909c0cd50ed52a48dae6d35907dc08b137e88
libparted: avoid the HDIO_GETGEO ioctl when possible

We were using the long depreciated HDIO_GETGEO ioctl on the
partition to get its start sector.  Use the new BLKPG_GET_PARTITION
ioctl instead.  This allows for disks > 2TB and partitioned loop
devices, which don't support HDIO_GETGEO.  As a fallback when
BLKPG_GET_PARTITION fails or is not availible, try getting the
values from sysfs, and finally use BLKGETSIZE64 and HDIO_GETGEO
as a last resort.
libparted/arch/linux.c