libcalamares: Align partition sizes on actual sectors

Currently, the `bytesToSectors()` function rounds a partition size to the
nearest MiB unit, which may lead to inconsistencies when a partition
is expected to only be a few KiB's.

This patch changes the behaviour of `bytesToSectors()` so that it aligns
on sector size, without rounding the partition size to a multiple of
1MiB.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
main
Arnaud Ferraris 6 years ago
parent 209e8331b7
commit 40202705ff

@ -160,7 +160,7 @@ alignBytesToBlockSize( qint64 bytes, qint64 blocksize )
constexpr qint64
bytesToSectors( qint64 bytes, qint64 blocksize )
{
return alignBytesToBlockSize( alignBytesToBlockSize( bytes, blocksize ), MiBtoBytes( 1ULL ) ) / blocksize;
return alignBytesToBlockSize( bytes, blocksize ) / blocksize;
}
} // namespace CalamaresUtils

Loading…
Cancel
Save