From b8c14a568903f89c807b981d9f340f1f7e7b3151 Mon Sep 17 00:00:00 2001 From: Gianluca Zuccarelli Date: Wed, 29 Sep 2021 10:07:19 +0100 Subject: [PATCH] blueprints: change minsize from int to uint64 thozza pointed out that `int` is platform dependent which results in a fs size that is too small for 32-bit machines. This commit changes the filesystem custimizations to use `uint64` instead of `int` --- internal/blueprint/customizations.go | 6 +++--- internal/disk/customizations.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/blueprint/customizations.go b/internal/blueprint/customizations.go index 27828edb1..3b95983b9 100644 --- a/internal/blueprint/customizations.go +++ b/internal/blueprint/customizations.go @@ -73,7 +73,7 @@ type ServicesCustomization struct { type FilesystemCustomization struct { Mountpoint string `json:"mountpoint,omitempty" toml:"mountpoint,omitempty"` - MinSize int `json:"minsize,omitempty" toml:"size,omitempty"` + MinSize uint64 `json:"minsize,omitempty" toml:"size,omitempty"` } type CustomizationError struct { @@ -258,7 +258,7 @@ func (c *Customizations) GetFilesystemsMinSize() uint64 { if c == nil { return 0 } - agg := 0 + var agg uint64 for _, m := range c.Filesystem { agg += m.MinSize } @@ -267,7 +267,7 @@ func (c *Customizations) GetFilesystemsMinSize() uint64 { if agg%512 != 0 { agg = (agg/512 + 1) * 512 } - return uint64(agg) + return agg } func (c *Customizations) GetInstallationDevice() string { diff --git a/internal/disk/customizations.go b/internal/disk/customizations.go index a1cc8ea0d..ab7d456e3 100644 --- a/internal/disk/customizations.go +++ b/internal/disk/customizations.go @@ -38,7 +38,7 @@ func CreatePartitionTable( for _, m := range mountpoints { if m.Mountpoint != "/" { - partitionSize := uint64(m.MinSize) / sectorSize + partitionSize := m.MinSize / sectorSize partition := basePartitionTable.createPartition(m.Mountpoint, partitionSize, rng) basePartitionTable.Partitions = append(basePartitionTable.Partitions, partition) }