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
This commit is contained in:
Mike Fleetwood 2019-11-20 21:50:57 +00:00 committed by Curtis Gedak
parent bb865aaaa4
commit 21cad97dc7
3 changed files with 18 additions and 6 deletions

View File

@ -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);

View File

@ -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.

View File

@ -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