From 1cbfa9d693a0f00fd3e007604cc65e9ad69abe54 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 8 Aug 2018 04:49:13 -0400 Subject: [PATCH] [partition] Simplify code for sizing --- .../partition/core/PartitionActions.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/modules/partition/core/PartitionActions.cpp b/src/modules/partition/core/PartitionActions.cpp index d654edf12..999847e37 100644 --- a/src/modules/partition/core/PartitionActions.cpp +++ b/src/modules/partition/core/PartitionActions.cpp @@ -114,19 +114,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass defaultFsType = "ext4"; // Partition sizes are expressed in MiB, should be multiples of - // the logical sector size (usually 512B). - int uefisys_part_size = 0; - int empty_space_size = 0; - if ( isEfi ) - { - uefisys_part_size = 300; - empty_space_size = 2; - } - else - { - // we start with a 1MiB offset before the first partition - empty_space_size = 1; - } + // the logical sector size (usually 512B). EFI starts with 2MiB + // empty and a 300MiB EFI boot partition, while BIOS starts at + // the 1MiB boundary (usually sector 2048). + int uefisys_part_size = isEfi ? 300 : 0; + int empty_space_size = isEfi ? 2 : 1; qint64 firstFreeSector = MiBtoBytes(empty_space_size) / dev->logicalSize() + 1;