Improved math for rounding starting sector to cylinder boundaries for logical partitions, and the first primary partition for MBR and GPT partition tables. This fixes a problem where a resize operation could turn into a move due to problems with the snap_to_cylinder function.
svn path=/trunk/; revision=857
This commit is contained in:
parent
b10f2325d7
commit
af8a021e89
|
@ -1,10 +1,16 @@
|
||||||
2008-06-15 Curtis Gedak <gedakc@gmail.com>
|
2008-06-15 Curtis Gedak <gedakc@gmail.com>
|
||||||
|
|
||||||
|
* src/GParted_Core.cc: Enhanced snap-to-cylinder math
|
||||||
|
- Improved math for rounding starting sector to cylinder
|
||||||
|
boundaries for logical partitions, and the first primary
|
||||||
|
partition for MBR and GPT partition tables.
|
||||||
|
- Closes GParted bug #432525
|
||||||
|
|
||||||
* include/Dialog_Base_Partition.h,
|
* include/Dialog_Base_Partition.h,
|
||||||
src/Dialog_Base_Partition.cc,
|
src/Dialog_Base_Partition.cc,
|
||||||
include/Dialog_Partition_New.h,
|
include/Dialog_Partition_New.h,
|
||||||
src/Dialog_Partition_New.cc: Migrated checkbutton.
|
src/Dialog_Partition_New.cc: Migrated checkbutton.
|
||||||
- Moved "Round to cylinders" checkbutton from partition New
|
- Moved "Round to cylinders" checkbutton from partition new
|
||||||
dialog to partition base dialog so that it may be used
|
dialog to partition base dialog so that it may be used
|
||||||
by all inheritors (e.g., New, Copy, and Resize/Move).
|
by all inheritors (e.g., New, Copy, and Resize/Move).
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ void GParted_Core::find_supported_filesystems()
|
||||||
|
|
||||||
ufs fs_ufs;
|
ufs fs_ufs;
|
||||||
FILESYSTEMS .push_back( fs_ufs .get_filesystem_support() ) ;
|
FILESYSTEMS .push_back( fs_ufs .get_filesystem_support() ) ;
|
||||||
|
|
||||||
xfs fs_xfs;
|
xfs fs_xfs;
|
||||||
FILESYSTEMS .push_back( fs_xfs .get_filesystem_support() ) ;
|
FILESYSTEMS .push_back( fs_xfs .get_filesystem_support() ) ;
|
||||||
|
|
||||||
|
@ -250,9 +250,23 @@ bool GParted_Core::snap_to_cylinder( const Device & device, Partition & partitio
|
||||||
{
|
{
|
||||||
if ( ! partition .strict )
|
if ( ! partition .strict )
|
||||||
{
|
{
|
||||||
//FIXME: this doesn't work to well, when dealing with layouts which contain an extended partition
|
Sector diff = 0;
|
||||||
//because of the metadata length % cylindersize isn't always 0
|
if ( partition.type == TYPE_LOGICAL ||
|
||||||
Sector diff = partition .sector_start % device .cylsize ;
|
partition.sector_start == device .sectors
|
||||||
|
) {
|
||||||
|
//Must account the relative offset between:
|
||||||
|
// (A) the Extended Boot Record sector and the next track of the
|
||||||
|
// logical partition (usually 63 sectors), and
|
||||||
|
// (B) the Master Boot Record sector and the next track of the first
|
||||||
|
// primary partition
|
||||||
|
diff = (partition .sector_start - device .sectors) % device .cylsize ;
|
||||||
|
} else if ( partition.sector_start == 34 ) {
|
||||||
|
// (C) the GUID Partition Table (GPT) and the start of the data
|
||||||
|
// partition at sector 34
|
||||||
|
diff = (partition .sector_start - 34 ) % device .cylsize ;
|
||||||
|
} else {
|
||||||
|
diff = partition .sector_start % device .cylsize ;
|
||||||
|
}
|
||||||
if ( diff )
|
if ( diff )
|
||||||
{
|
{
|
||||||
if ( diff < ( device .cylsize / 2 ) )
|
if ( diff < ( device .cylsize / 2 ) )
|
||||||
|
|
Loading…
Reference in New Issue