[gparted] Move dmraid device logic outside of for loop
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Move dmraid device logic outside of for loop
- Date: Thu, 9 Dec 2010 22:00:02 +0000 (UTC)
commit 3be3a39a68de90f756520ceff359688de9a7232b
Author: Curtis Gedak <gedakc gmail com>
Date: Wed Dec 8 16:03:21 2010 -0700
Move dmraid device logic outside of for loop
Since this logic did not depend on the for loop variable, it does
not make sense to have this within the for loop.
src/GParted_Core.cc | 43 ++++++++++++++++++++++---------------------
1 files changed, 22 insertions(+), 21 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 744f2f2..e23deda 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -1238,30 +1238,31 @@ void GParted_Core::set_mountpoints( std::vector<Partition> & partitions )
{
if ( partitions[ t ] .busy )
{
- for ( unsigned int i = 0 ; i < partitions[ t ] .get_paths() .size() ; i++ )
+ //Handle dmraid devices differently because there may be more
+ // than one partition name.
+ // E.g., there might be names with and/or without a 'p' between
+ // the device name and partition number.
+ if ( dmraid .is_dmraid_device( partitions[ t ] .device_path ) )
{
- //Handle dmraid devices differently because there may be more
- // than one partition name.
- // E.g., there might be names with and/or without a 'p' between
- // the device name and partition number.
- if ( dmraid .is_dmraid_device( partitions[ t ] .device_path ) )
+ //Try device_name + partition_number
+ iter_mp = mount_info .find( partitions[ t ] .device_path + Utils::num_to_str( partitions[ t ] .partition_number ) ) ;
+ if ( iter_mp != mount_info .end() )
{
- //Try device_name + partition_number
- iter_mp = mount_info .find( partitions[ t ] .device_path + Utils::num_to_str( partitions[ t ] .partition_number ) ) ;
- if ( iter_mp != mount_info .end() )
- {
- partitions[ t ] .add_mountpoints( iter_mp ->second ) ;
- break ;
- }
- //Try device_name + p + partition_number
- iter_mp = mount_info .find( partitions[ t ] .device_path + "p" + Utils::num_to_str( partitions[ t ] .partition_number ) ) ;
- if ( iter_mp != mount_info .end() )
- {
- partitions[ t ] .add_mountpoints( iter_mp ->second ) ;
- break ;
- }
+ partitions[ t ] .add_mountpoints( iter_mp ->second ) ;
+ break ;
}
- else
+ //Try device_name + p + partition_number
+ iter_mp = mount_info .find( partitions[ t ] .device_path + "p" + Utils::num_to_str( partitions[ t ] .partition_number ) ) ;
+ if ( iter_mp != mount_info .end() )
+ {
+ partitions[ t ] .add_mountpoints( iter_mp ->second ) ;
+ break ;
+ }
+ }
+ else
+ {
+ //Normal device, not DMRaid device
+ for ( unsigned int i = 0 ; i < partitions[ t ] .get_paths() .size() ; i++ )
{
iter_mp = mount_info .find( partitions[ t ] .get_paths()[ i ] ) ;
if ( iter_mp != mount_info .end() )
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]