[gparted/ataraid] Display correct type of mdadm recognised ATARAID members (#75)



commit 8068f418674a934bd7aa3a08a7a9d192b43c717d
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sun Nov 17 16:19:39 2019 +0000

    Display correct type of mdadm recognised ATARAID members (#75)
    
    The previous commit, made mdadm recognised IMSM and DDF type ATARAID
    members get displayed as "linux-raid" (Linux Software RAID array
    member).  This was because of query method 1 in detect_filesystems().
    
    Fix this now by exposing and using the fstype of the member from the
    SWRaid_Info cache.
    
    Closes #75 - Errors with GPT on RAID 0 ATARAID array

 include/SWRaid_Info.h |  1 +
 src/GParted_Core.cc   |  4 ++--
 src/SWRaid_Info.cc    | 10 ++++++++++
 3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/include/SWRaid_Info.h b/include/SWRaid_Info.h
index 85404010..b1a14a58 100644
--- a/include/SWRaid_Info.h
+++ b/include/SWRaid_Info.h
@@ -58,6 +58,7 @@ public:
        static void load_cache();
        static bool is_member( const Glib::ustring & member_path );
        static bool is_member_active( const Glib::ustring & member_path );
+       static FSType get_fstype(const Glib::ustring& member_path);
        static Glib::ustring get_array( const Glib::ustring & member_path );
        static Glib::ustring get_uuid( const Glib::ustring & member_path );
        static Glib::ustring get_label( const Glib::ustring & member_path );
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 449cc328..f5530080 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -1202,9 +1202,9 @@ FSType GParted_Core::detect_filesystem( PedDevice * lp_device, PedPartition * lp
                // (Q4) internal
                path = lp_device->path;
 
-       // (Q1) Linux Software RAID member detection
+       // (Q1) SWRaid_Info (mdadm) member detection.
        if ( SWRaid_Info::is_member( path ) )
-               return FS_LINUX_SWRAID;
+               return SWRaid_Info::get_fstype(path);
 
        // (Q2) FS_Info (blkid) file system detection
        // Blkid detects more signatures and generally has less limitations so use before
diff --git a/src/SWRaid_Info.cc b/src/SWRaid_Info.cc
index f57cea9e..a719762d 100644
--- a/src/SWRaid_Info.cc
+++ b/src/SWRaid_Info.cc
@@ -74,6 +74,16 @@ bool SWRaid_Info::is_member_active( const Glib::ustring & member_path )
        return memb.active;
 }
 
+
+// Return "file system" type of the member, or FS_UNKNOWN if there is no such member.
+FSType SWRaid_Info::get_fstype(const Glib::ustring& member_path)
+{
+       initialise_if_required();
+       const SWRaid_Member& memb = get_cache_entry_by_member(member_path);
+       return memb.fstype;
+}
+
+
 // Return array /dev entry (e.g. "/dev/md1") containing the specified member, or "" if the
 // array is not running or there is no such member.
 Glib::ustring SWRaid_Info::get_array( const Glib::ustring & member_path )


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