From 504eb04ddc6f2fddfa942f63823a9dc5334e5815 Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Sat, 29 Nov 2008 17:08:52 +0000 Subject: [PATCH] Roll back (remove) code to recognize /dev/mapper/* devices, because too many entries such as LVM partitions are wrongly added to the device list. svn path=/trunk/; revision=989 --- AUTHORS | 3 --- ChangeLog | 5 +++++ src/GParted_Core.cc | 55 ++------------------------------------------- 3 files changed, 7 insertions(+), 56 deletions(-) diff --git a/AUTHORS b/AUTHORS index 2f8a7cb0..7818e853 100644 --- a/AUTHORS +++ b/AUTHORS @@ -25,9 +25,6 @@ Curtis Gedak * Created OperationLabelPartition.h, OperationLabelPartition.cc * Maintained from official 0.3.5 release onward -Colin Watson - * Wrote patch to recognize /dev/mapper/* devices - Michael Monreal * Wrote small patch to implement themed app icon in hicolor diff --git a/ChangeLog b/ChangeLog index d45af544..18d4f022 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-11-29 Curtis Gedak + * src/GParted.cc: Removed code to recognize /dev/mapper/* devices. + - Too many /dev/mapper/* devices listed (including partitions) + - Roll back patch applied on 2008-10-15 + - Reopens GParted bug #556114 + * include/FS_Info.h, src/FS_Info.cc: Moved common code into new get_device_entry() method. diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index 61afade5..3fd21e67 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -144,11 +144,8 @@ void GParted_Core::set_devices( std::vector & devices ) { device_paths .clear() ; - //Fixme: Remove code to read: - // /proc/partitions, - // /proc/devices, and - // /dev/mapper - // when libparted bug 194 is fixed. + //FIXME: When libparted bug 194 is fixed, remove code to read: + // /proc/partitions // This was a problem with no floppy drive yet BIOS indicated one existed. // http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/194 // @@ -178,54 +175,6 @@ void GParted_Core::set_devices( std::vector & devices ) } } proc_partitions .close() ; - - //Try to find dev mapper devices - std::set dm_majors; - std::ifstream proc_devices( "/proc/devices" ) ; - if ( proc_devices ) - { - //parse device numbers from /proc/devices - std::string line ; - bool seen_bd = false ; - while ( getline( proc_devices, line ) ) - { - if ( ! seen_bd ) - { - if ( ! line .compare( 0, 14, "Block devices:" ) == 0 ) - seen_bd = true ; - continue ; - } - unsigned int major ; - char c_str[256+1] ; - if ( sscanf( line .c_str(), "%u %256s", &major, c_str ) == 2 ) - dm_majors .insert( major ); - } - proc_devices .close() ; - } - - DIR *mapper_dir = opendir( "/dev/mapper" ); - if ( mapper_dir ) - { - struct dirent *mapper_entry ; - while ( (mapper_entry = readdir( mapper_dir )) ) - { - if ( strcmp( mapper_entry ->d_name, "." ) == 0 || - strcmp( mapper_entry ->d_name, ".." ) == 0 || - strcmp( mapper_entry ->d_name, "control" ) == 0 ) - continue ; - std::string mapper_name = "/dev/mapper/" ; - mapper_name += mapper_entry ->d_name ; - struct stat st ; - if ( stat( mapper_name .c_str(), &st ) != 0 ) - continue; - if ( dm_majors .find( major( st.st_rdev ) ) != dm_majors .end() ) - //TODO avoid probing partition nodes for dmraid devices - /*TO TRANSLATORS: looks like Scanning /dev/sda */ - set_thread_status_message( String::ucompose ( _("Scanning %1"), mapper_name ) ) ; - ped_device_get( mapper_name .c_str() ) ; - } - closedir( mapper_dir ) ; - } } else {