[gparted] Order internally detected signatures by increasing offset (!46)(#16)



commit df65fbd46808554ec84350ece6436526520a67f2
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Fri Jul 12 10:37:26 2019 +0100

    Order internally detected signatures by increasing offset (!46)(#16)
    
    Along with the previous patch "Avoid reading the same sector multiple
    times in a row (!46)(#16)" internal detection of file system signatures
    now reads the minimum number of sectors in increasing order.
    
    As the code still considers the sector size, it now also reads less
    sectors from devices with larger sectors to get all the signatures.  So
    on a 512 byte sector device it maximally seeks to and reads from these
    byte offsets:
        0, 512, 1024, 65536
    and on a 4096 byte sector device, only from these byte offsets:
        0, 65536
    
    Closes !46 - Whole device FAT32 file system reports device busy warning
                 from mlabel
    Closes #16 - "invalid argument for seek()" error on very small (<=40KiB)
                 drives

 src/GParted_Core.cc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 7b0ecd3b..e02ac279 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -1144,19 +1144,19 @@ FSType GParted_Core::detect_filesystem_internal(const Glib::ustring& path, Byte_
                FSType       fstype;
        } signatures[] = {
                //offset1, sig1              , offset2, sig2  , fstype
-               { 65536LL, "ReIsEr4"         ,     0LL, NULL  , FS_REISER4        },
-               {   512LL, "LABELONE"        ,   536LL, "LVM2", FS_LVM2_PV        },
                {     0LL, "LUKS\xBA\xBE"    ,     0LL, NULL  , FS_LUKS           },
-               { 65600LL, "_BHRfS_M"        ,     0LL, NULL  , FS_BTRFS          },
                {     3LL, "-FVE-FS-"        ,     0LL, NULL  , FS_BITLOCKER      },
-               {  1030LL, "\x34\x34"        ,     0LL, NULL  , FS_NILFS2         },
                {     0LL, "\x52\x56\xBE\x1B",     0LL, NULL  , FS_GRUB2_CORE_IMG },
                {     0LL, "\x52\x56\xBE\x6F",     0LL, NULL  , FS_GRUB2_CORE_IMG },
                {     0LL, "\x52\xE8\x28\x01",     0LL, NULL  , FS_GRUB2_CORE_IMG },
                {     0LL, "\x52\xBF\xF4\x81",     0LL, NULL  , FS_GRUB2_CORE_IMG },
                {     0LL, "\x52\x56\xBE\x63",     0LL, NULL  , FS_GRUB2_CORE_IMG },
                {     0LL, "\x52\x56\xBE\x56",     0LL, NULL  , FS_GRUB2_CORE_IMG },
-               {    24LL, "\x01\x00"        ,    32LL, "NXSB", FS_APFS           }
+               {    24LL, "\x01\x00"        ,    32LL, "NXSB", FS_APFS           },
+               {   512LL, "LABELONE"        ,   536LL, "LVM2", FS_LVM2_PV        },
+               {  1030LL, "\x34\x34"        ,     0LL, NULL  , FS_NILFS2         },
+               { 65536LL, "ReIsEr4"         ,     0LL, NULL  , FS_REISER4        },
+               { 65600LL, "_BHRfS_M"        ,     0LL, NULL  , FS_BTRFS          }
        };
        // For simple BitLocker recognition consider validation of BIOS Parameter block
        // fields unnecessary.


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