From d3b4349c63fb38ff857c21d8dc95e8616e68f445 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Thu, 10 Feb 2022 22:00:09 +0100 Subject: [PATCH] disk: remove old unused CreatePartitionTable() function The new `disk.NewPartitionTable` function is now used in all places and thus `CreatePartitionTable` can be removed; do so. --- internal/disk/customizations.go | 45 --------------------------------- 1 file changed, 45 deletions(-) diff --git a/internal/disk/customizations.go b/internal/disk/customizations.go index c6e6d1497..f8b849a33 100644 --- a/internal/disk/customizations.go +++ b/internal/disk/customizations.go @@ -1,11 +1,5 @@ package disk -import ( - "math/rand" - - "github.com/osbuild/osbuild-composer/internal/blueprint" -) - const ( BIOSBootPartitionGUID = "21686148-6449-6E6F-744E-656564454649" BIOSBootPartitionUUID = "FAC7F1FB-3E8D-4137-A512-961DE09A5549" @@ -19,42 +13,3 @@ const ( RootPartitionUUID = "6264D520-3FB9-423F-8AB8-7A0A8E3D3562" ) - -func CreatePartitionTable( - mountpoints []blueprint.FilesystemCustomization, - imageSize uint64, - basePartitionTable *PartitionTable, - rng *rand.Rand, -) (PartitionTable, error) { - - // we are modifying the contents of the base partition table, - // including the file systems, which are shared among shallow - // copies of the partition table, so make a copy first - table, cloneOk := basePartitionTable.Clone().(*PartitionTable) - if !cloneOk { - panic("PartitionTable.Clone() returned an Entity that cannot be converted to *PartitionTable; this is a programming error") - } - - for _, m := range mountpoints { - // if we already have a partition ensure that the - // size is at least the requested size, otherwise - // create a new filesystem with that size - part := table.FindPartitionForMountpoint(m.Mountpoint) - if part != nil { - part.EnsureSize(m.MinSize) - } else { - err := table.CreateFilesystem(m.Mountpoint, m.MinSize) - if err != nil { - return PartitionTable{}, err - } - } - } - - // Calculate partition table offsets and sizes - table.relayout(imageSize) - - // Generate new UUIDs for filesystems and partitions - table.GenerateUUIDs(rng) - - return *table, nil -}