Enhance get_dmraid_name to also check udev information if needed

This commit is contained in:
Curtis Gedak 2009-04-28 14:21:56 -06:00
parent 9816f5c18a
commit 58c9336e9d
1 changed files with 11 additions and 1 deletions

View File

@ -163,6 +163,16 @@ Glib::ustring DMRaid::get_dmraid_name( const Glib::ustring & dev_path )
dmraid_name = dmraid_devices[k] ;
}
//Some distros appear to default to /dev/dm-# for device names, so
// also check with udev for dmraid name
if ( dmraid_name .empty() && ( dev_path .find( "/dev/dm" ) != Glib::ustring::npos ) )
{
Glib::ustring udev_name = get_udev_name( dev_path ) ;
for ( unsigned int k=0; k < dmraid_devices .size(); k++ )
if ( udev_name .find( dmraid_devices[k] ) != Glib::ustring::npos )
dmraid_name = dmraid_devices[k] ;
}
return dmraid_name ;
}