Enable support for devices with sector sizes > 512 bytes (#607165)

GParted requires libparted version 2.2 or higher to support devices
with sector sizes > 512 bytes.

This commit marks the end of a series of enhancements required to
provide support for sector sizes > 512 bytes.
This commit is contained in:
Curtis Gedak 2010-05-27 11:08:40 -06:00
parent be53cf584b
commit f173a51f0b
1 changed files with 11 additions and 4 deletions

View File

@ -246,12 +246,18 @@ void GParted_Core::set_devices( std::vector<Device> & devices )
set_thread_status_message( String::ucompose ( _("Confirming %1"), lp_device ->path ) ) ;
if ( ped_device_open( lp_device ) )
{
//FIXME: Remove this check when both GParted and libparted
// support devices with a logical sector size != 512.
#ifdef HAVE_LIBPARTED_2_2_0_PLUS
//Devices with sector sizes of 512 bytes and higher are supported
if ( ped_device_read( lp_device, buf, 0, 1 ) )
device_paths .push_back( lp_device ->path ) ;
#else
//Only devices with sector sizes of 512 bytes are well supported
if ( lp_device ->sector_size != 512 )
{
/*TO TRANSLATORS: looks like Ignoring device /dev/sde with logical sector size of 2048 bytes because gparted only supports a size of 512 bytes. */
Glib::ustring msg = String::ucompose ( _("Ignoring device %1 with logical sector size of %2 bytes because gparted only supports a size of 512 bytes."), lp_device ->path, lp_device ->sector_size ) ;
/*TO TRANSLATORS: looks like Ignoring device /dev/sde with logical sector size of 2048 bytes. */
Glib::ustring msg = String::ucompose ( _("Ignoring device %1 with logical sector size of %2 bytes."), lp_device ->path, lp_device ->sector_size ) ;
msg += "\n" ;
msg += _("GParted requires libparted version 2.2 or higher to support devices with sector sizes larger than 512 bytes.") ;
std::cout << msg << std::endl << std::endl ;
}
else
@ -259,6 +265,7 @@ void GParted_Core::set_devices( std::vector<Device> & devices )
if ( ped_device_read( lp_device, buf, 0, 1 ) )
device_paths .push_back( lp_device ->path ) ;
}
#endif
ped_device_close( lp_device ) ;
}
free( buf ) ;