[gparted/ataraid: 15/17] Recognise ATARAID members started by dmraid (#75)



commit 21cad97dc7f748d31f25e80fdaa5303dd6e6c4a8
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Wed Nov 20 21:50:57 2019 +0000

    Recognise ATARAID members started by dmraid (#75)
    
    This is not strictly necessary as members are already recognised using
    blkid since this commit earlier in the sequence "Recognise ATARAID
    members (#75)".  However it makes sure active members are recognised
    even if blkid is not available and matches how file system detection
    queries the SWRaid_Info module.
    
    Closes #75 - Errors with GPT on RAID 0 ATARAID array

 include/DMRaid.h    |  1 +
 src/DMRaid.cc       | 14 +++++++++++---
 src/GParted_Core.cc |  9 ++++++---
 3 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/include/DMRaid.h b/include/DMRaid.h
index 2bc61b2a..b262325e 100644
--- a/include/DMRaid.h
+++ b/include/DMRaid.h
@@ -66,6 +66,7 @@ public:
        bool delete_dev_map_entry( const Partition & partition, OperationDetail & operationdetail ) ;
        bool purge_dev_map_entries( const Glib::ustring & dev_path ) ;
        bool update_dev_map_entry( const Partition & partition, OperationDetail & operationdetail ) ;
+       bool is_member(const Glib::ustring& member_path);
        bool is_member_active(const Glib::ustring& member_path);
        const Glib::ustring& get_array(const Glib::ustring& member_path);
 
diff --git a/src/DMRaid.cc b/src/DMRaid.cc
index f8d71708..a21741ef 100644
--- a/src/DMRaid.cc
+++ b/src/DMRaid.cc
@@ -527,9 +527,8 @@ bool DMRaid::update_dev_map_entry( const Partition & partition, OperationDetail
 }
 
 
-// Return whether the named device (e.g. "/dev/sdc") is a member of an active DMRaid array
-// or not.
-bool DMRaid::is_member_active(const Glib::ustring& member_path)
+// Return whether the named device (e.g. "/dev/sdc") is a member of a DMRaid array or not.
+bool DMRaid::is_member(const Glib::ustring& member_path)
 {
        const DMRaid_Member& memb = get_cache_entry_by_member(member_path);
        if (memb.member.m_name.length() > 0)
@@ -538,6 +537,15 @@ bool DMRaid::is_member_active(const Glib::ustring& member_path)
        return false;
 }
 
+// Return whether the named device (e.g. "/dev/sdc") is a member of an *active* DMRaid
+// array or not.
+// As the cache only records members of active DMRaid arrays:
+//     is_member_active(x) == is_member(x)
+bool DMRaid::is_member_active(const Glib::ustring& member_path)
+{
+       return is_member(member_path);
+}
+
 
 // Return array device containing the specified member, or "" if the array is not running
 // or there is no such member.
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 0d0aa4b9..8b7ed39e 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -1193,19 +1193,22 @@ FSType GParted_Core::detect_filesystem( PedDevice * lp_device, PedPartition * lp
 {
        Glib::ustring fsname = "";
        Glib::ustring path;
+       DMRaid dmraid;
 
        if ( lp_partition )
-               // Will query partition using methods: (Q1) SWRaid, (Q2) blkid,
+               // Will query partition using methods: (Q1) RAID, (Q2) blkid,
                // (Q3) libparted, (Q4) internal
                path = get_partition_path( lp_partition );
        else
-               // Will query whole disk device using methods: (Q1) SWRaid, (Q2) blkid,
+               // Will query whole disk device using methods: (Q1) RAID, (Q2) blkid,
                // (Q4) internal
                path = lp_device->path;
 
-       // (Q1) SWRaid_Info (mdadm) member detection.
+       // (Q1) SWRaid_Info (mdadm) and DMRaid member detection.
        if ( SWRaid_Info::is_member( path ) )
                return SWRaid_Info::get_fstype(path);
+       if (dmraid.is_member(path))
+               return FS_ATARAID;
 
        // (Q2) FS_Info (blkid) file system detection
        // Blkid detects more signatures and generally has less limitations so use before


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