[gparted] Stop recognising retired libparted linux-swap names



commit 40ec0deba879ea823e457c2264adf23cee47767f
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Apr 13 11:28:29 2019 +0100

    Stop recognising retired libparted linux-swap names
    
    With this commit in parted 1.8.3 [1], libparted changed from reporting
    the name of Linux swap as:
        linux-swap
    to reporting either:
        linux-swap(old)
        linux-swap(new)
    Later with this commit in parted 1.9 [2], libparted stopped reporting
    those names and reported these instead:
        linux-swap(v0)
        linux-swap(v1)
    
    Demonstration:
        # mkswap /dev/sdc1
        Setting up swapspace version 1, size = 1048572 KiB
        no label, UUID=a2010834-003d-4bf2-9e94-58383fe20a26
        # blkid /dev/sdc1
        /dev/sdc1: UUID="a2010834-003d-4bf2-9e94-58383fe20a26" TYPE="swap"
        # parted -v
        parted (GNU parted) 2.1
        ...
        # parted /dev/sdc unit s print
        ...
        Number  Start  End       Size      Type     File system     Flags
         1      2048s  2099199s  2097152s  primary  linux-swap(v1)
    
    As GParted now requires libparted 2.2 or later [3], remove recognition
    for those no longer libparted reported linux-swap names.  Note that the
    "swap" name is reported by blkid.
    
    [1] http://git.savannah.gnu.org/cgit/parted.git/commit/?id=98a53fd115ca012edf226525b8d4be628454f99e
        Enable support for swsusp partitions, and the ability to
        differentiate between old and new versions of linux-swap partitions.
        Changed the swap_init signature and removed extra ped_geometry_read
        from _swap*_open.
    
    [2] http://git.savannah.gnu.org/cgit/parted.git/commit/?id=cfafa4394998a11f871a0f8d172b13314f9062c2
        Rationalise linux-swap fs names, and add a "linux-swap" alias
    
    [3] 8df975c7d1b5d69897f286bfc5574c51cf58c9d5
        Increase minimum required libparted to 2.2 (!22)

 src/GParted_Core.cc | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 6a31e977..ad6b67f9 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -1465,12 +1465,9 @@ FSType GParted_Core::detect_filesystem( PedDevice * lp_device, PedPartition * lp
                else if ( fsname == "ext4"    ||
                          fsname == "ext4dev"    )
                        return FS_EXT4;
-               else if ( fsname == "linux-swap"      ||
-                         fsname == "linux-swap(v1)"  ||
-                         fsname == "linux-swap(new)" ||
-                         fsname == "linux-swap(v0)"  ||
-                         fsname == "linux-swap(old)" ||
-                         fsname == "swap"               )
+               else if (fsname == "linux-swap(v0)" ||
+                        fsname == "linux-swap(v1)" ||
+                        fsname == "swap"             )
                        return FS_LINUX_SWAP;
                else if ( fsname == "crypto_LUKS" )
                        return FS_LUKS;


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