Enhance file system space unused math to use actual sector size

This commit is contained in:
Curtis Gedak 2010-04-28 13:25:57 -06:00
parent 9e5e9f5627
commit 66355153fb
11 changed files with 12 additions and 12 deletions

View File

@ -1228,7 +1228,7 @@ void GParted_Core::set_used_sectors( std::vector<Partition> & partitions )
if ( partitions[ t ] .get_mountpoints() .size() > 0 ) if ( partitions[ t ] .get_mountpoints() .size() > 0 )
{ {
if ( statvfs( partitions[ t ] .get_mountpoint() .c_str(), &sfs ) == 0 ) if ( statvfs( partitions[ t ] .get_mountpoint() .c_str(), &sfs ) == 0 )
partitions[ t ] .Set_Unused( sfs .f_bfree * (sfs .f_bsize / 512) ) ; partitions[ t ] .Set_Unused( sfs .f_bfree * (sfs .f_bsize / partitions[ t ] .sector_size) ) ;
else else
partitions[ t ] .messages .push_back( partitions[ t ] .messages .push_back(
"statvfs (" + "statvfs (" +

View File

@ -72,7 +72,7 @@ void ext2::set_used_sectors( Partition & partition )
S = -1 ; S = -1 ;
if ( N > -1 && S > -1 ) if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ; partition .Set_Unused( Utils::round( N * ( S / double(partition .sector_size) ) ) ) ;
} }
else else
{ {

View File

@ -73,7 +73,7 @@ void ext3::set_used_sectors( Partition & partition )
S = -1 ; S = -1 ;
if ( N > -1 && S > -1 ) if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ; partition .Set_Unused( Utils::round( N * ( S / double(partition .sector_size) ) ) ) ;
} }
else else
{ {

View File

@ -76,7 +76,7 @@ void ext4::set_used_sectors( Partition & partition )
S = -1 ; S = -1 ;
if ( N > -1 && S > -1 ) if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ; partition .Set_Unused( Utils::round( N * ( S / double(partition .sector_size) ) ) ) ;
} }
else else
{ {

View File

@ -80,7 +80,7 @@ void fat16::set_used_sectors( Partition & partition )
S = -1 ; S = -1 ;
if ( N > -1 && S > -1 ) if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ; partition .Set_Unused( Utils::round( N * ( S / double(partition .sector_size) ) ) ) ;
} }
else else
{ {

View File

@ -80,7 +80,7 @@ void fat32::set_used_sectors( Partition & partition )
S = -1 ; S = -1 ;
if ( N > -1 && S > -1 ) if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ; partition .Set_Unused( Utils::round( N * ( S / double(partition .sector_size) ) ) ) ;
} }
else else
{ {

View File

@ -93,7 +93,7 @@ void jfs::set_used_sectors( Partition & partition )
N = -1 ; N = -1 ;
if ( S > -1 && N > -1 ) if ( S > -1 && N > -1 )
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ; partition .Set_Unused( Utils::round( N * ( S / double(partition .sector_size) ) ) ) ;
} }
else else
{ {

View File

@ -71,7 +71,7 @@ void ntfs::set_used_sectors( Partition & partition )
N = -1 ; N = -1 ;
if ( N > -1 ) if ( N > -1 )
partition .set_used( Utils::round( N / 512.0 ) ) ; partition .set_used( Utils::round( N / double(partition .sector_size) ) ) ;
} }
else else
{ {

View File

@ -1,5 +1,5 @@
/* Copyright (C) 2004 Bart /* Copyright (C) 2004 Bart
* Copyright (C) 2008 Curtis Gedak * Copyright (C) 2008, 2009, 2010 Curtis Gedak
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -69,7 +69,7 @@ void reiser4::set_used_sectors( Partition & partition )
S = -1 ; S = -1 ;
if ( N > -1 && S > -1 ) if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ; partition .Set_Unused( Utils::round( N * ( S / double(partition .sector_size) ) ) ) ;
} }
else else
{ {

View File

@ -78,7 +78,7 @@ void reiserfs::set_used_sectors( Partition & partition )
N = -1 ; N = -1 ;
if ( N > -1 && S > -1 ) if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ; partition .Set_Unused( Utils::round( N * ( S / double(partition .sector_size) ) ) ) ;
} }
else else
{ {

View File

@ -96,7 +96,7 @@ void xfs::set_used_sectors( Partition & partition )
N = -1 ; N = -1 ;
if ( N > -1 && S > -1 ) if ( N > -1 && S > -1 )
partition .Set_Unused( Utils::round( N * ( S / 512.0 ) ) ) ; partition .Set_Unused( Utils::round( N * ( S / double(partition .sector_size) ) ) ) ;
} }
else else
{ {