diff --git a/README b/README index 93a523c..81d1498 100644 --- a/README +++ b/README @@ -67,11 +67,19 @@ b. Building from Source perl(XML::Parser) desktop-file-utils Briefly, the shell commands `./configure; make; make install' should - configure, build, and install this package. If you wish to build - this package without the help documentation use the --disable-doc - flag: + configure, build, and install this package. + + If you wish to build this package without the help documentation use + the --disable-doc flag: E.g., ./configure --disable-doc - + + If you wish to build this package to use native libparted /dev/mapper + dmraid support use the --enable-libparted-dmraid flag: + E.g., ./configure --enable-libparted-dmraid + + Please note that more than one configure flags can be used: + E.g., ./configure --disable-doc --enable-libparted-dmraid + The INSTALL file contains further GNU installation instructions. diff --git a/configure.in b/configure.in index 03ad441..ee5768d 100644 --- a/configure.in +++ b/configure.in @@ -171,6 +171,25 @@ fi AM_CONDITIONAL([DISABLE_DOC], [test ${enable_doc} = no]) +dnl====================== +dnl check whether to use native libparted dmraid support +dnl====================== +AC_ARG_ENABLE([libparted_dmraid], + [ --enable-libparted-dmraid do use native libparted /dev/mapper dmraid support],,) +if test "x${enable_libparted_dmraid}" = "x" ; then + enable_libparted_dmraid=no +fi + +AC_MSG_CHECKING([whether native libparted /dev/mapper dmraid support should be used]) +if test ${enable_libparted_dmraid} = yes; then + AC_MSG_RESULT([yes]) + dnl Set #define USE_LIBPARTED_DMRAID 1 to indicate documentation not wanted + AC_DEFINE([USE_LIBPARTED_DMRAID], [1], [Define to 1 if --enable-libparted-dmraid specified]) +else + AC_MSG_RESULT([no]) +fi + + AC_CONFIG_FILES([ Makefile compose/Makefile @@ -198,6 +217,7 @@ echo " Build documentation? : $enable_doc" echo "" echo " Need part table re-read work around? : $need_pt_reread_work_around" echo " Supports sector sizes > 512 bytes? : $support_sector_size_gt_512" +echo " Use native libparted dmraid support? : $enable_libparted_dmraid" echo "" echo " If all settings are OK, type make and make install " echo "========================================================" diff --git a/src/Dialog_Progress.cc b/src/Dialog_Progress.cc index 1921d8a..03ea376 100644 --- a/src/Dialog_Progress.cc +++ b/src/Dialog_Progress.cc @@ -354,7 +354,11 @@ void Dialog_Progress::on_save() << "" << _("GParted Details") << "" << std::endl << "" << std::endl << "" << std::endl - << "

" << _("GParted") << " " << VERSION << "

" << std::endl + << "

" << _("GParted") << " " << VERSION +#ifdef USE_LIBPARTED_DMRAID + << " --enable-libparted-dmraid" +#endif + << "

" << std::endl << "

" << _("Libparted") << " " << signal_get_libparted_version .emit() << "

" << std::endl ; //Write out each operation diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index 3ecf7cd..f3ed5a6 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -203,8 +203,10 @@ void GParted_Core::set_devices( std::vector & devices ) dmraid .get_devices( dmraid_devices ) ; for ( unsigned int k=0; k < dmraid_devices .size(); k++ ) { set_thread_status_message( String::ucompose ( _("Scanning %1"), dmraid_devices[k] ) ) ; +#ifndef USE_LIBPARTED_DMRAID dmraid .create_dev_map_entries( dmraid_devices[k] ) ; settle_device( 1 ) ; +#endif ped_device_get( dmraid_devices[k] .c_str() ) ; } } @@ -256,6 +258,7 @@ void GParted_Core::set_devices( std::vector & devices ) std::sort( device_paths .begin(), device_paths .end() ) ; } +#ifndef USE_LIBPARTED_DMRAID else { //Device paths were passed in on the command line. @@ -270,6 +273,7 @@ void GParted_Core::set_devices( std::vector & devices ) } } } +#endif for ( unsigned int t = 0 ; t < device_paths .size() ; t++ ) { @@ -651,6 +655,7 @@ bool GParted_Core::set_disklabel( const Glib::ustring & device_path, const Glib: close_device_and_disk() ; } +#ifndef USE_LIBPARTED_DMRAID //delete and recreate disk entries if dmraid DMRaid dmraid ; if ( return_value && dmraid .is_dmraid_device( device_path ) ) @@ -658,6 +663,7 @@ bool GParted_Core::set_disklabel( const Glib::ustring & device_path, const Glib: dmraid .purge_dev_map_entries( device_path ) ; dmraid .create_dev_map_entries( device_path ) ; } +#endif return return_value ; } @@ -853,7 +859,6 @@ void GParted_Core::read_mountpoints_from_file_swaps( Glib::ustring GParted_Core::get_partition_path( PedPartition * lp_partition ) { - DMRaid dmraid; //Use cache of dmraid device information char * lp_path; //we have to free the result of ped_partition_get_path() Glib::ustring partition_path = "Partition path not found"; @@ -864,13 +869,16 @@ Glib::ustring GParted_Core::get_partition_path( PedPartition * lp_partition ) free(lp_path); } +#ifndef USE_LIBPARTED_DMRAID //Ensure partition path name is compatible with dmraid + DMRaid dmraid; //Use cache of dmraid device information if ( dmraid .is_dmraid_supported() && dmraid .is_dmraid_device( partition_path ) ) { partition_path = dmraid .make_path_dmraid_compatible(partition_path); } +#endif return partition_path ; } @@ -880,7 +888,9 @@ void GParted_Core::set_device_partitions( Device & device ) int EXT_INDEX = -1 ; Proc_Partitions_Info pp_info ; //Use cache of proc partitions information FS_Info fs_info ; //Use cache of file system information +#ifndef USE_LIBPARTED_DMRAID DMRaid dmraid ; //Use cache of dmraid device information +#endif //clear partitions device .partitions .clear() ; @@ -899,6 +909,7 @@ void GParted_Core::set_device_partitions( Device & device ) { case PED_PARTITION_NORMAL: case PED_PARTITION_LOGICAL: +#ifndef USE_LIBPARTED_DMRAID //Handle dmraid devices differently because the minor number might not // match the last number of the partition filename as shown by "ls -l /dev/mapper" // This mismatch causes incorrect identification of busy partitions in ped_partition_is_busy(). @@ -914,6 +925,7 @@ void GParted_Core::set_device_partitions( Device & device ) partition_is_busy = true ; } else +#endif partition_is_busy = ped_partition_is_busy( lp_partition ) ; partition_temp .Set( device .get_path(), @@ -936,6 +948,7 @@ void GParted_Core::set_device_partitions( Device & device ) break ; case PED_PARTITION_EXTENDED: +#ifndef USE_LIBPARTED_DMRAID //Handle dmraid devices differently because the minor number might not // match the last number of the partition filename as shown by "ls -l /dev/mapper" // This mismatch causes incorrect identification of busy partitions in ped_partition_is_busy(). @@ -954,6 +967,7 @@ void GParted_Core::set_device_partitions( Device & device ) } } else +#endif partition_is_busy = ped_partition_is_busy( lp_partition ) ; partition_temp .Set( device .get_path(), @@ -1276,7 +1290,9 @@ void GParted_Core::insert_unallocated( const Glib::ustring & device_path, void GParted_Core::set_mountpoints( std::vector & partitions ) { +#ifndef USE_LIBPARTED_DMRAID DMRaid dmraid ; //Use cache of dmraid device information +#endif for ( unsigned int t = 0 ; t < partitions .size() ; t++ ) { if ( ( partitions[ t ] .type == GParted::TYPE_PRIMARY || @@ -1289,6 +1305,7 @@ void GParted_Core::set_mountpoints( std::vector & partitions ) { if ( partitions[ t ] .busy ) { +#ifndef USE_LIBPARTED_DMRAID //Handle dmraid devices differently because there may be more // than one partition name. // E.g., there might be names with and/or without a 'p' between @@ -1312,6 +1329,7 @@ void GParted_Core::set_mountpoints( std::vector & partitions ) } else { +#endif //Normal device, not DMRaid device for ( unsigned int i = 0 ; i < partitions[ t ] .get_paths() .size() ; i++ ) { @@ -1322,7 +1340,9 @@ void GParted_Core::set_mountpoints( std::vector & partitions ) break ; } } +#ifndef USE_LIBPARTED_DMRAID } +#endif if ( partitions[ t ] .get_mountpoints() .empty() ) partitions[ t ] .messages .push_back( _("Unable to find mount point") ) ; @@ -1554,10 +1574,12 @@ bool GParted_Core::create_partition( Partition & new_partition, OperationDetail bool succes = new_partition .partition_number > 0 && erase_filesystem_signatures( new_partition ) ; +#ifndef USE_LIBPARTED_DMRAID //create dev map entries if dmraid DMRaid dmraid ; if ( succes && dmraid .is_dmraid_device( new_partition .device_path ) ) succes = dmraid .create_dev_map_entries( new_partition, operationdetail .get_last_child() ) ; +#endif operationdetail .get_last_child() .set_status( succes ? STATUS_SUCCES : STATUS_ERROR ) ; @@ -1616,6 +1638,7 @@ bool GParted_Core::Delete( const Partition & partition, OperationDetail & operat close_device_and_disk() ; } +#ifndef USE_LIBPARTED_DMRAID //delete partition dev mapper entry, and delete and recreate all other affected dev mapper entries if dmraid DMRaid dmraid ; if ( succes && dmraid .is_dmraid_device( partition .device_path ) ) @@ -1632,6 +1655,7 @@ bool GParted_Core::Delete( const Partition & partition, OperationDetail & operat close_device_and_disk() ; } } +#endif operationdetail .get_last_child() .set_status( succes ? STATUS_SUCCES : STATUS_ERROR ) ; return succes ; @@ -2091,6 +2115,7 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old, STATUS_NONE, FONT_ITALIC ) ) ; +#ifndef USE_LIBPARTED_DMRAID //update dev mapper entry if partition is dmraid. DMRaid dmraid ; if ( return_value && dmraid .is_dmraid_device( partition_new .device_path ) ) @@ -2102,6 +2127,7 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old, close_device_and_disk() ; } } +#endif } operationdetail .get_last_child() .set_status( return_value ? STATUS_SUCCES : STATUS_ERROR ) ; @@ -2837,6 +2863,7 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old, STATUS_NONE, FONT_ITALIC ) ) ; +#ifndef USE_LIBPARTED_DMRAID //Update dev mapper entry if partition is dmraid. DMRaid dmraid ; if ( succes && dmraid .is_dmraid_device( partition_new .device_path ) ) @@ -2848,6 +2875,7 @@ bool GParted_Core::calculate_exact_geom( const Partition & partition_old, close_device_and_disk() ; } } +#endif } operationdetail .get_last_child() .set_status( succes ? STATUS_SUCCES : STATUS_ERROR ) ; @@ -3052,12 +3080,14 @@ bool GParted_Core::commit() bool GParted_Core::commit_to_os( std::time_t timeout ) { - DMRaid dmraid ; bool succes ; +#ifndef USE_LIBPARTED_DMRAID + DMRaid dmraid ; if ( dmraid .is_dmraid_device( lp_disk ->dev ->path ) ) succes = true ; else { +#endif succes = ped_disk_commit_to_os( lp_disk ) ; #ifndef HAVE_LIBPARTED_2_2_0_PLUS //Work around to try to alleviate problems caused by @@ -3069,7 +3099,9 @@ bool GParted_Core::commit_to_os( std::time_t timeout ) succes = ped_disk_commit_to_os( lp_disk ) ; } #endif +#ifndef USE_LIBPARTED_DMRAID } +#endif settle_device( timeout ) ;