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



commit f173a51f0b8315d223f92b7f700857b786369a88
Author: Curtis Gedak <gedakc gmail com>
Date:   Thu May 27 11:08:40 2010 -0600

    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.

 src/GParted_Core.cc |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 8faf62e..1097250 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -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 ) ;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]