[gparted] Add regexp for Linux SW RAID devices in /proc/partitions (#678379)



commit c600095912f5c38e01d71d461765be665e2bdebe
Author: Curtis Gedak <gedakc gmail com>
Date:   Wed Nov 14 12:09:58 2012 -0700

    Add regexp for Linux SW RAID devices in /proc/partitions (#678379)
    
    Add regular expression to detect the device entry only (e.g., md127)
    and not the partitions (e.g., md127p1).
    
    Linux software RAID devices are listed in /proc/partitions as follows:
    
    # cat /proc/partitions
    major minor  #blocks  name
       9   127     523968 md127
     259     0     131072 md127p1
     259     1     262144 md127p2
    
    Part of Bug #678379 - Could not stat device /dev/md/0 - No such file
                          or directory

 src/Proc_Partitions_Info.cc |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/Proc_Partitions_Info.cc b/src/Proc_Partitions_Info.cc
index d0e2a5d..3d6ebe6 100644
--- a/src/Proc_Partitions_Info.cc
+++ b/src/Proc_Partitions_Info.cc
@@ -92,6 +92,10 @@ void Proc_Partitions_Info::load_proc_partitions_info_cache()
 			//Whole disk devices are the ones we want.
 			//Device names without a trailing digit refer to the whole disk.
 			device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+([^0-9]+)$") ;
+			//Recognize /dev/md* devices (Linux software RAID - mdadm).
+			//E.g., device = /dev/md127, partition = /dev/md127p1
+			if ( device == "" )
+				device = Utils::regexp_label(line, "^[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+[0-9]+[\t ]+(md[0-9]+)$") ;
 			//Recognize /dev/mmcblk* devices.
 			//E.g., device = /dev/mmcblk0, partition = /dev/mmcblk0p1
 			if ( device == "" )



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