[gparted] Enhance sector_to_unit() for sector sizes > 512 bytes
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Enhance sector_to_unit() for sector sizes > 512 bytes
- Date: Wed, 24 Mar 2010 20:38:01 +0000 (UTC)
commit 1aa81bba9478f20f8e9600a3c1908ad2f6458a7e
Author: Curtis Gedak <gedakc gmail com>
Date: Tue Mar 23 12:14:53 2010 -0600
Enhance sector_to_unit() for sector sizes > 512 bytes
include/Utils.h | 2 +-
src/Dialog_Partition_Copy.cc | 20 +++++++-------
src/Dialog_Partition_New.cc | 16 ++++++------
src/Dialog_Partition_Resize_Move.cc | 47 ++++++++++++++++++-----------------
src/Utils.cc | 22 ++++++++--------
src/ext2.cc | 2 +-
src/ext3.cc | 2 +-
src/ext4.cc | 2 +-
src/ntfs.cc | 2 +-
src/reiserfs.cc | 2 +-
10 files changed, 59 insertions(+), 58 deletions(-)
---
diff --git a/include/Utils.h b/include/Utils.h
index a330b0d..0e4a366 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -146,7 +146,7 @@ public:
static Glib::ustring get_filesystem_software( FILESYSTEM filesystem ) ;
static Glib::ustring format_size( Sector size ) ;
static Glib::ustring format_time( std::time_t seconds ) ;
- static double sector_to_unit( Sector sectors, SIZE_UNIT size_unit ) ;
+ static double sector_to_unit( Sector sectors, Byte_Value sector_size, SIZE_UNIT size_unit ) ;
static int execute_command( const Glib::ustring & command ) ;
static int execute_command( const Glib::ustring & command,
Glib::ustring & output,
diff --git a/src/Dialog_Partition_Copy.cc b/src/Dialog_Partition_Copy.cc
index 26725d4..17747e1 100644
--- a/src/Dialog_Partition_Copy.cc
+++ b/src/Dialog_Partition_Copy.cc
@@ -1,5 +1,5 @@
/* Copyright (C) 2004 Bart
- * Copyright (C) 2008, 2009 Curtis Gedak
+ * Copyright (C) 2008, 2009, 2010 Curtis Gedak
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,10 +41,10 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
//set some widely used values...
START = selected_partition .sector_start ;
total_length = selected_partition .get_length() ;
- TOTAL_MB = Utils::round( Utils::sector_to_unit( selected_partition .get_length(), GParted::UNIT_MIB ) ) ;
+ TOTAL_MB = Utils::round( Utils::sector_to_unit( selected_partition .get_length(), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ;
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
- long COPIED_LENGTH_MB = Utils::round( Utils::sector_to_unit( copied_partition .get_length(), GParted::UNIT_MIB ) ) ;
+ long COPIED_LENGTH_MB = Utils::round( Utils::sector_to_unit( copied_partition .get_length(), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ;
// /* Copy Primary not at start of disk to within Extended partition */
// Adjust when a primary partition is copied and pasted
// into an unallocated space in an extended partition
@@ -96,7 +96,7 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
frame_resizer_base ->set_x_end( x_end > 500 ? 500 : x_end ) ;
frame_resizer_base ->set_used(
Utils::round( Utils::sector_to_unit(
- copied_partition .sectors_used, GParted::UNIT_MIB ) / (TOTAL_MB/500.00) ) ) ;
+ copied_partition .sectors_used, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) / (TOTAL_MB/500.00) ) ) ;
if ( fs .grow )
fs .MAX = ( ! fs .MAX || fs .MAX > (TOTAL_MB * MEBI_FACTOR) ) ? (TOTAL_MB * MEBI_FACTOR) : fs .MAX - (BUF * DEFAULT_SECTOR_SIZE) ;
@@ -111,17 +111,17 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
GRIP = true ;
//set values of spinbutton_before
- spinbutton_before .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ spinbutton_before .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
spinbutton_before .set_value( 0 ) ;
//set values of spinbutton_size
spinbutton_size .set_range(
- Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ),
- Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ),
+ Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
spinbutton_size .set_value( COPIED_LENGTH_MB ) ;
//set values of spinbutton_after
- spinbutton_after .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ spinbutton_after .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
spinbutton_after .set_value( TOTAL_MB - COPIED_LENGTH_MB ) ;
GRIP = false ;
@@ -130,8 +130,8 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
//set contents of label_minmax
Set_MinMax_Text(
- Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ),
- Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ),
+ Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
//set global selected_partition (see Dialog_Base_Partition::Get_New_Partition )
this ->selected_partition = copied_partition ;
diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc
index dd22cf4..d7c1d6c 100644
--- a/src/Dialog_Partition_New.cc
+++ b/src/Dialog_Partition_New.cc
@@ -142,7 +142,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
//set some widely used values...
START = partition.sector_start ;
total_length = partition.sector_end - partition.sector_start ;
- TOTAL_MB = Utils::round( Utils::sector_to_unit( this ->selected_partition .get_length(), GParted::UNIT_MIB ) ) ;
+ TOTAL_MB = Utils::round( Utils::sector_to_unit( this ->selected_partition .get_length(), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ;
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
//set first enabled file system
@@ -151,7 +151,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
//set spinbuttons initial values
spinbutton_after .set_value( 0 ) ;
- spinbutton_size .set_value( Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ spinbutton_size .set_value( Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
spinbutton_before .set_value( 0 ) ;
//euhrm, this wil only happen when there's a very small free space (usually the effect of a bad partitionmanager)
@@ -267,17 +267,17 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
//set new spinbutton ranges
spinbutton_before .set_range(
- 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
spinbutton_size .set_range(
- Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ),
- Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ),
+ Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
spinbutton_after .set_range(
- 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
//set contents of label_minmax
Set_MinMax_Text(
- Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ),
- Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ),
+ Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
}
//set fitting resizer colors
diff --git a/src/Dialog_Partition_Resize_Move.cc b/src/Dialog_Partition_Resize_Move.cc
index ce61f48..b497997 100644
--- a/src/Dialog_Partition_Resize_Move.cc
+++ b/src/Dialog_Partition_Resize_Move.cc
@@ -1,4 +1,5 @@
/* Copyright (C) 2004 Bart
+ * Copyright (C) 2010 Curtis Gedak
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -103,7 +104,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
next = partitions[t +1] .get_length() ;
total_length = previous + selected_partition .get_length() + next;
- TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, GParted::UNIT_MIB ) ) ;
+ TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ;
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
@@ -147,33 +148,33 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector<Partiti
{
spinbutton_before .set_range(
0,
- TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
spinbutton_before .set_value(
- Utils::round( Utils::sector_to_unit( previous, GParted::UNIT_MIB ) ) ) ;
+ Utils::round( Utils::sector_to_unit( previous, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
}
//set values of spinbutton_size
spinbutton_size .set_range(
- Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ),
- Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ),
+ Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
spinbutton_size .set_value(
- Utils::round( Utils::sector_to_unit( selected_partition .get_length(), GParted::UNIT_MIB ) ) ) ;
+ Utils::round( Utils::sector_to_unit( selected_partition .get_length(), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
//set values of spinbutton_after
Sector after_min = ( ! fs .grow && ! fs .move ) ? next : 0 ;
spinbutton_after .set_range(
- Utils::round( Utils::sector_to_unit( after_min, GParted::UNIT_MIB ) ),
- TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ Utils::round( Utils::sector_to_unit( after_min, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ),
+ TOTAL_MB - Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
spinbutton_after .set_value(
- Utils::round( Utils::sector_to_unit( next, GParted::UNIT_MIB ) ) ) ;
+ Utils::round( Utils::sector_to_unit( next, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
frame_resizer_base ->set_size_limits( Utils::round( fs .MIN / (MB_PER_PIXEL * MEBI_FACTOR) ),
Utils::round( fs .MAX / (MB_PER_PIXEL * MEBI_FACTOR) ) ) ;
//set contents of label_minmax
Set_MinMax_Text(
- Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ),
- Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), GParted::UNIT_MIB ) ) ) ;
+ Utils::round( Utils::sector_to_unit( (fs .MIN / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ),
+ Utils::round( Utils::sector_to_unit( (fs .MAX / DEFAULT_SECTOR_SIZE), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
}
void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Partition> & partitions )
@@ -200,7 +201,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
//now we have enough data to calculate some important values..
total_length = previous + selected_partition .get_length() + next;
- TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, UNIT_MIB ) ) ;
+ TOTAL_MB = Utils::round( Utils::sector_to_unit( total_length, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ) ;
MB_PER_PIXEL = TOTAL_MB / 500.00 ;
//calculate proportional length of partition ( in pixels )
@@ -226,34 +227,34 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector<Parti
//set values of spinbutton_before (we assume there is no fixed start.)
if ( first == 0 ) //no logicals
- spinbutton_before .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( BUF/2, GParted::UNIT_MIB ) ) ) ;
+ spinbutton_before .set_range( 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( BUF/2, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
else
- spinbutton_before .set_range( 0, Utils::round( Utils::sector_to_unit( first - START, GParted::UNIT_MIB ) ) ) ;
+ spinbutton_before .set_range( 0, Utils::round( Utils::sector_to_unit( first - START, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
- spinbutton_before .set_value( Utils::round( Utils::sector_to_unit( previous, GParted::UNIT_MIB ) ) ) ;
+ spinbutton_before .set_value( Utils::round( Utils::sector_to_unit( previous, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
//set values of spinbutton_size
if ( first == 0 ) //no logicals
- spinbutton_size .set_range( Utils::round( Utils::sector_to_unit( BUF/2, GParted::UNIT_MIB ) ), TOTAL_MB ) ;
+ spinbutton_size .set_range( Utils::round( Utils::sector_to_unit( BUF/2, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ), TOTAL_MB ) ;
else
- spinbutton_size .set_range( Utils::round( Utils::sector_to_unit( used, GParted::UNIT_MIB ) ), TOTAL_MB ) ;
+ spinbutton_size .set_range( Utils::round( Utils::sector_to_unit( used, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ), TOTAL_MB ) ;
spinbutton_size .set_value(
- Utils::round( Utils::sector_to_unit( selected_partition .get_length(), GParted::UNIT_MIB ) ) ) ;
+ Utils::round( Utils::sector_to_unit( selected_partition .get_length(), DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
//set values of spinbutton_after
if ( first == 0 ) //no logicals
spinbutton_after .set_range(
- 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( BUF/2, GParted::UNIT_MIB ) ) ) ;
+ 0, TOTAL_MB - Utils::round( Utils::sector_to_unit( BUF/2, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
else
spinbutton_after .set_range(
- 0, Utils::round( Utils::sector_to_unit( total_length + START - first - used, GParted::UNIT_MIB ) ) ) ;
+ 0, Utils::round( Utils::sector_to_unit( total_length + START - first - used, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
- spinbutton_after .set_value( Utils::round( Utils::sector_to_unit( next, GParted::UNIT_MIB ) ) ) ;
+ spinbutton_after .set_value( Utils::round( Utils::sector_to_unit( next, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
//set contents of label_minmax
- Set_MinMax_Text( Utils::round( Utils::sector_to_unit( first == 0 ? BUF/2 : used, GParted::UNIT_MIB ) ),
- Utils::round( Utils::sector_to_unit( total_length, GParted::UNIT_MIB ) ) ) ;
+ Set_MinMax_Text( Utils::round( Utils::sector_to_unit( first == 0 ? BUF/2 : used, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ),
+ Utils::round( Utils::sector_to_unit( total_length, DEFAULT_SECTOR_SIZE, GParted::UNIT_MIB ) ) ) ;
}
} //GParted
diff --git a/src/Utils.cc b/src/Utils.cc
index 2359766..52d4b03 100644
--- a/src/Utils.cc
+++ b/src/Utils.cc
@@ -174,27 +174,27 @@ Glib::ustring Utils::format_size( Sector size )
if ( size < KIBIBYTE )
{
- ss << sector_to_unit( size, UNIT_BYTE ) ;
+ ss << sector_to_unit( size, DEFAULT_SECTOR_SIZE, UNIT_BYTE ) ;
return String::ucompose( _("%1 B"), ss .str() ) ;
}
else if ( size < MEBIBYTE )
{
- ss << sector_to_unit( size, UNIT_KIB ) ;
+ ss << sector_to_unit( size, DEFAULT_SECTOR_SIZE, UNIT_KIB ) ;
return String::ucompose( _("%1 KiB"), ss .str() ) ;
}
else if ( size < GIBIBYTE )
{
- ss << sector_to_unit( size, UNIT_MIB ) ;
+ ss << sector_to_unit( size, DEFAULT_SECTOR_SIZE, UNIT_MIB ) ;
return String::ucompose( _("%1 MiB"), ss .str() ) ;
}
else if ( size < TEBIBYTE )
{
- ss << sector_to_unit( size, UNIT_GIB ) ;
+ ss << sector_to_unit( size, DEFAULT_SECTOR_SIZE, UNIT_GIB ) ;
return String::ucompose( _("%1 GiB"), ss .str() ) ;
}
else
{
- ss << sector_to_unit( size, UNIT_TIB ) ;
+ ss << sector_to_unit( size, DEFAULT_SECTOR_SIZE, UNIT_TIB ) ;
return String::ucompose( _("%1 TiB"), ss .str() ) ;
}
}
@@ -222,21 +222,21 @@ Glib::ustring Utils::format_time( std::time_t seconds )
return time ;
}
-double Utils::sector_to_unit( Sector sectors, SIZE_UNIT size_unit )
+double Utils::sector_to_unit( Sector sectors, Byte_Value sector_size, SIZE_UNIT size_unit )
{
switch ( size_unit )
{
case UNIT_BYTE :
- return sectors * 512 ;
+ return sectors * sector_size ;
case UNIT_KIB :
- return sectors / static_cast<double>( KIBIBYTE ) ;
+ return sectors / ( static_cast<double>( KIBI_FACTOR ) / sector_size );
case UNIT_MIB :
- return sectors / static_cast<double>( MEBIBYTE ) ;
+ return sectors / ( static_cast<double>( MEBI_FACTOR ) / sector_size );
case UNIT_GIB :
- return sectors / static_cast<double>( GIBIBYTE ) ;
+ return sectors / ( static_cast<double>( GIBI_FACTOR ) / sector_size );
case UNIT_TIB :
- return sectors / static_cast<double>( TEBIBYTE ) ;
+ return sectors / ( static_cast<double>( TEBI_FACTOR ) / sector_size );
default:
return sectors ;
diff --git a/src/ext2.cc b/src/ext2.cc
index 5299f06..c307660 100644
--- a/src/ext2.cc
+++ b/src/ext2.cc
@@ -116,7 +116,7 @@ bool ext2::resize( const Partition & partition_new, OperationDetail & operationd
if ( ! fill_partition )
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
- partition_new .get_length(), UNIT_KIB ) ) -1 ) + "K" ;
+ partition_new .get_length(), DEFAULT_SECTOR_SIZE, UNIT_KIB ) ) -1 ) + "K" ;
return ! execute_command( str_temp, operationdetail ) ;
}
diff --git a/src/ext3.cc b/src/ext3.cc
index 1c67fb1..4847895 100644
--- a/src/ext3.cc
+++ b/src/ext3.cc
@@ -117,7 +117,7 @@ bool ext3::resize( const Partition & partition_new, OperationDetail & operationd
if ( ! fill_partition )
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
- partition_new .get_length(), GParted::UNIT_KIB ) ) -1 ) + "K" ;
+ partition_new .get_length(), DEFAULT_SECTOR_SIZE, GParted::UNIT_KIB ) ) -1 ) + "K" ;
return ! execute_command( str_temp, operationdetail ) ;
}
diff --git a/src/ext4.cc b/src/ext4.cc
index eba681e..310b83b 100644
--- a/src/ext4.cc
+++ b/src/ext4.cc
@@ -120,7 +120,7 @@ bool ext4::resize( const Partition & partition_new, OperationDetail & operationd
if ( ! fill_partition )
str_temp += " " + Utils::num_to_str( Utils::round( Utils::sector_to_unit(
- partition_new .get_length(), GParted::UNIT_KIB ) ) -1 ) + "K" ;
+ partition_new .get_length(), DEFAULT_SECTOR_SIZE, GParted::UNIT_KIB ) ) -1 ) + "K" ;
return ! execute_command( str_temp, operationdetail ) ;
}
diff --git a/src/ntfs.cc b/src/ntfs.cc
index 0e2fef5..4919d5a 100644
--- a/src/ntfs.cc
+++ b/src/ntfs.cc
@@ -118,7 +118,7 @@ bool ntfs::resize( const Partition & partition_new, OperationDetail & operationd
{
str_temp += " -s " ;
str_temp += Utils::num_to_str( Utils::round( Utils::sector_to_unit(
- partition_new .get_length(), GParted::UNIT_BYTE ) ) -1 ) ;
+ partition_new .get_length(), DEFAULT_SECTOR_SIZE, GParted::UNIT_BYTE ) ) -1 ) ;
}
//simulation..
diff --git a/src/reiserfs.cc b/src/reiserfs.cc
index 22ae73f..ec1a322 100644
--- a/src/reiserfs.cc
+++ b/src/reiserfs.cc
@@ -125,7 +125,7 @@ bool reiserfs::resize( const Partition & partition_new, OperationDetail & operat
{
str_temp += " -s " ;
str_temp += Utils::num_to_str( Utils::round( Utils::sector_to_unit(
- partition_new .get_length(), GParted::UNIT_BYTE ) ) -1 ) ;
+ partition_new .get_length(), DEFAULT_SECTOR_SIZE, GParted::UNIT_BYTE ) ) -1 ) ;
}
exit_status = execute_command( str_temp, operationdetail ) ;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]