[gparted] Enhance file system space unused math to use actual sector size
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Enhance file system space unused math to use actual sector size
- Date: Wed, 28 Apr 2010 20:12:10 +0000 (UTC)
commit 66355153fb1325c35c3362dcb52187546622c4d4
Author: Curtis Gedak <gedakc gmail com>
Date: Wed Apr 28 13:25:57 2010 -0600
Enhance file system space unused math to use actual sector size
src/GParted_Core.cc | 2 +-
src/ext2.cc | 2 +-
src/ext3.cc | 2 +-
src/ext4.cc | 2 +-
src/fat16.cc | 2 +-
src/fat32.cc | 2 +-
src/jfs.cc | 2 +-
src/ntfs.cc | 2 +-
src/reiser4.cc | 4 ++--
src/reiserfs.cc | 2 +-
src/xfs.cc | 2 +-
11 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index c76821f..1886426 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -1228,7 +1228,7 @@ void GParted_Core::set_used_sectors( std::vector<Partition> & partitions )
if ( partitions[ t ] .get_mountpoints() .size() > 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
partitions[ t ] .messages .push_back(
"statvfs (" +
diff --git a/src/ext2.cc b/src/ext2.cc
index bf82b09..572a3bc 100644
--- a/src/ext2.cc
+++ b/src/ext2.cc
@@ -72,7 +72,7 @@ void ext2::set_used_sectors( Partition & partition )
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
{
diff --git a/src/ext3.cc b/src/ext3.cc
index d773684..7b05892 100644
--- a/src/ext3.cc
+++ b/src/ext3.cc
@@ -73,7 +73,7 @@ void ext3::set_used_sectors( Partition & partition )
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
{
diff --git a/src/ext4.cc b/src/ext4.cc
index 50c24ad..a5eb48f 100644
--- a/src/ext4.cc
+++ b/src/ext4.cc
@@ -76,7 +76,7 @@ void ext4::set_used_sectors( Partition & partition )
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
{
diff --git a/src/fat16.cc b/src/fat16.cc
index 95bb5d8..67690e2 100644
--- a/src/fat16.cc
+++ b/src/fat16.cc
@@ -80,7 +80,7 @@ void fat16::set_used_sectors( Partition & partition )
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
{
diff --git a/src/fat32.cc b/src/fat32.cc
index 9c99018..2512687 100644
--- a/src/fat32.cc
+++ b/src/fat32.cc
@@ -80,7 +80,7 @@ void fat32::set_used_sectors( Partition & partition )
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
{
diff --git a/src/jfs.cc b/src/jfs.cc
index 48e41ca..33ae3cc 100644
--- a/src/jfs.cc
+++ b/src/jfs.cc
@@ -93,7 +93,7 @@ void jfs::set_used_sectors( Partition & partition )
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
{
diff --git a/src/ntfs.cc b/src/ntfs.cc
index d4bcfea..b34ced7 100644
--- a/src/ntfs.cc
+++ b/src/ntfs.cc
@@ -71,7 +71,7 @@ void ntfs::set_used_sectors( Partition & partition )
N = -1 ;
if ( N > -1 )
- partition .set_used( Utils::round( N / 512.0 ) ) ;
+ partition .set_used( Utils::round( N / double(partition .sector_size) ) ) ;
}
else
{
diff --git a/src/reiser4.cc b/src/reiser4.cc
index e22f3d5..d645739 100644
--- a/src/reiser4.cc
+++ b/src/reiser4.cc
@@ -1,5 +1,5 @@
/* 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
* 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 ;
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
{
diff --git a/src/reiserfs.cc b/src/reiserfs.cc
index 22c987f..4075dd6 100644
--- a/src/reiserfs.cc
+++ b/src/reiserfs.cc
@@ -78,7 +78,7 @@ void reiserfs::set_used_sectors( Partition & partition )
N = -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
{
diff --git a/src/xfs.cc b/src/xfs.cc
index c6f76d8..fee402f 100644
--- a/src/xfs.cc
+++ b/src/xfs.cc
@@ -96,7 +96,7 @@ void xfs::set_used_sectors( Partition & partition )
N = -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
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]