From aa2825d296ca9ef9e798c55e42059fabb0ad432b Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Mon, 20 Dec 2021 14:02:04 +0100 Subject: [PATCH] disk: use BytesToSectors in customization.go Use the newly introduced conversion helper to convert between bytes and sectors. --- internal/disk/customizations.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/disk/customizations.go b/internal/disk/customizations.go index 504e0f572..b9c411c5a 100644 --- a/internal/disk/customizations.go +++ b/internal/disk/customizations.go @@ -36,9 +36,9 @@ func CreatePartitionTable( table := basePartitionTable.Clone() for _, m := range mountpoints { - partitionSize := m.MinSize / DefaultSectorSize + sectors := table.BytesToSectors(m.MinSize) if m.Mountpoint != "/" { - table.createFilesystem(m.Mountpoint, partitionSize) + table.createFilesystem(m.Mountpoint, sectors) } } @@ -55,7 +55,7 @@ func CreatePartitionTable( // treat the root partition as a special case // by setting the size dynamically rootPartition := table.RootPartition() - rootPartition.Size = ((imageSize / DefaultSectorSize) - start - 100) + rootPartition.Size = (table.BytesToSectors(imageSize) - start - 100) // Generate new UUIDs for filesystems and partitions table.GenerateUUIDs(rng)