From 4bcd0a37041d9a85dbe70947e39b38af48658bb2 Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Mon, 19 Apr 2010 19:06:08 -0600 Subject: [PATCH] Add device sector size to partition object The device sector size is needed in all calculations that convert between sectors and bytes. The device sector_size is included in the partition object because this object is used to contain operation information in addition to actual partitions and unallocated space. A second option was considered to pass the device object to many methods, but this was considered a much larger task that might not provide significant gains in maintainability. --- include/Partition.h | 4 +++- src/Partition.cc | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/Partition.h b/include/Partition.h index e368fce8..ce070b15 100644 --- a/include/Partition.h +++ b/include/Partition.h @@ -115,7 +115,9 @@ public: bool strict ; //Indicator if start and end sectors must stay unchanged bool strict_start ; //Indicator if start sector must stay unchanged - + + Byte_Value sector_size ; //Sector size of the disk device needed for converting to/from sectors and bytes. + private: void sort_paths_and_remove_duplicates() ; diff --git a/src/Partition.cc b/src/Partition.cc index 3df0b353..33facd3a 100644 --- a/src/Partition.cc +++ b/src/Partition.cc @@ -43,6 +43,7 @@ void Partition::Reset() label .clear() ; uuid .clear() ; partition_number = sector_start = sector_end = sectors_used = sectors_unused = -1; + sector_size = 0 ; color .set( "black" ) ; inside_extended = busy = strict = strict_start = false ; logicals .clear() ;