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
This commit is contained in:
Curtis Gedak 2008-11-29 17:08:52 +00:00
parent ab50d0254f
commit 504eb04ddc
3 changed files with 7 additions and 56 deletions

View File

@ -25,9 +25,6 @@ Curtis Gedak <gedakc@users.sourceforge.net>
* Created OperationLabelPartition.h, OperationLabelPartition.cc * Created OperationLabelPartition.h, OperationLabelPartition.cc
* Maintained from official 0.3.5 release onward * Maintained from official 0.3.5 release onward
Colin Watson <cjwatson@debian.org>
* Wrote patch to recognize /dev/mapper/* devices
Michael Monreal <michael.monreal@gmx.net> Michael Monreal <michael.monreal@gmx.net>
* Wrote small patch to implement themed app icon in hicolor * Wrote small patch to implement themed app icon in hicolor

View File

@ -1,5 +1,10 @@
2008-11-29 Curtis Gedak <gedakc@gmail.com> 2008-11-29 Curtis Gedak <gedakc@gmail.com>
* 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, * include/FS_Info.h,
src/FS_Info.cc: Moved common code into new get_device_entry() method. src/FS_Info.cc: Moved common code into new get_device_entry() method.

View File

@ -144,11 +144,8 @@ void GParted_Core::set_devices( std::vector<Device> & devices )
{ {
device_paths .clear() ; device_paths .clear() ;
//Fixme: Remove code to read: //FIXME: When libparted bug 194 is fixed, remove code to read:
// /proc/partitions, // /proc/partitions
// /proc/devices, and
// /dev/mapper
// when libparted bug 194 is fixed.
// This was a problem with no floppy drive yet BIOS indicated one existed. // This was a problem with no floppy drive yet BIOS indicated one existed.
// http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/194 // http://parted.alioth.debian.org/cgi-bin/trac.cgi/ticket/194
// //
@ -178,54 +175,6 @@ void GParted_Core::set_devices( std::vector<Device> & devices )
} }
} }
proc_partitions .close() ; proc_partitions .close() ;
//Try to find dev mapper devices
std::set<unsigned int> 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 else
{ {