[gparted] Rename HAVE_LIBPARTED_2_2_0_PLUS define into feature names (#734718)



commit ed4ea6cf03d74184b5e91d23496e5bb7a4569468
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Wed Aug 6 09:25:57 2014 +0100

    Rename HAVE_LIBPARTED_2_2_0_PLUS define into feature names (#734718)
    
        Remove HAVE_LIBPARTED_2_2_0_PLUS definition
    
    Rename version specific #define HAVE_LIBPARTED_2_2_0_PLUS into two
    separate feature specific names set as required:
    
        Name                                  Set when?
    
        ENABLE_PT_REREAD_WORKAROUND           (libparted < 2.2)
        USE_LIBPARTED_LARGE_SECTOR_SUPPORT    (libparted >= 2.2)
    
    Using feature specific #defines is the standard Autoconf way and makes
    the resultant conditional code easier to understand.  Still have to
    check the version of libparted though.
    
    Bug #734718 - Update Autoconf version specific libparted checks and
                  defines to feature specific ones

 configure.ac        |   20 +++++++++++---------
 src/GParted_Core.cc |    4 ++--
 2 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 30ca7e6..9be0292 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,9 +89,9 @@ int main ()
 LIBS="$LIBS_save"
 
 
-dnl======================
-dnl check whether libparted >= 2.2 (has improved partition table re-read code)
-dnl======================
+dnl Check for libparted >= 2.2 for improved informing the kernel to
+dnl re-read the partition table code and support of larger sector sizes
+dnl (> 512 bytes).
 LIBPARTED_VERSION=2.2
 AC_MSG_CHECKING([if libparted >= $LIBPARTED_VERSION (has improved pt re-read)])
 LIBS_save="$LIBS"
@@ -132,12 +132,14 @@ int main ()
 }
                ]]
        )],
-       [AC_DEFINE([HAVE_LIBPARTED_2_2_0_PLUS], [1],
-                  [Define to 1 if libparted contains improved partition table re-read code])
-        need_pt_reread_work_around=no; support_sector_size_gt_512=yes
+       [AC_DEFINE([USE_LIBPARTED_LARGE_SECTOR_SUPPORT], 1,
+                  [Define to 1 to use libparted large sector support])
+        need_pt_reread_workaround=no; support_large_sector_sizes=yes
         AC_MSG_RESULT([yes])
        ],
-       [need_pt_reread_work_around=yes; support_sector_size_gt_512=no
+       [AC_DEFINE([ENABLE_PT_REREAD_WORKAROUND], 1,
+                  [Define to 1 to enable partition re-read workaround])
+        need_pt_reread_workaround=yes; support_large_sector_sizes=no
         AC_MSG_RESULT([no])
        ]
 )
@@ -355,8 +357,8 @@ echo "           Use native libparted dmraid support?  :  $enable_libparted_dmra
 echo "                  Enable online resize support?  :  $enable_online_resize"
 echo ""
 echo "       --- Features Based On Libparted Version ---"
-echo "      Need partition table re-read work around?  :  $need_pt_reread_work_around"
-echo "             Supports sector sizes > 512 bytes?  :  $support_sector_size_gt_512"
+echo "       Need partition table re-read workaround?  :  $need_pt_reread_workaround"
+echo "     Supports large sector sizes (> 512 bytes)?  :  $support_large_sector_sizes"
 echo "   Have old libparted file system resizing API?  :  $have_old_lp_fs_resize_api"
 echo "   Have new libparted file system resizing LIB?  :  $have_new_lp_fs_resize_lib"
 echo ""
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 1e5d208..b49b3fb 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -236,7 +236,7 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
                                set_thread_status_message( String::ucompose ( _("Confirming %1"), lp_device 
->path ) ) ;
                                if ( ped_device_open( lp_device ) )
                                {
-#ifdef HAVE_LIBPARTED_2_2_0_PLUS
+#ifdef USE_LIBPARTED_LARGE_SECTOR_SUPPORT
                                        //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 ) ;
@@ -3574,7 +3574,7 @@ bool GParted_Core::commit_to_os( PedDisk* lp_disk, std::time_t timeout )
        {
 #endif
                succes = ped_disk_commit_to_os( lp_disk ) ;
-#ifndef HAVE_LIBPARTED_2_2_0_PLUS
+#ifdef ENABLE_PT_REREAD_WORKAROUND
                //Work around to try to alleviate problems caused by
                //  bug #604298 - Failure to inform kernel of partition changes
                //  If not successful the first time, try one more time.


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