disk: define the default sector size constant
Move the `sectorSize` constant, defined in `customizations.go` to `disk.go` as `DefaultSectorSize`. Rename current usages of the former to the latter.
This commit is contained in:
parent
199463547e
commit
115c864f93
2 changed files with 7 additions and 3 deletions
|
|
@ -10,7 +10,6 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
sectorSize = 512
|
||||
BIOSBootPartitionGUID = "21686148-6449-6E6F-744E-656564454649"
|
||||
BIOSBootPartitionUUID = "FAC7F1FB-3E8D-4137-A512-961DE09A5549"
|
||||
|
||||
|
|
@ -37,8 +36,8 @@ func CreatePartitionTable(
|
|||
table := basePartitionTable.Clone()
|
||||
|
||||
for _, m := range mountpoints {
|
||||
partitionSize := m.MinSize / DefaultSectorSize
|
||||
if m.Mountpoint != "/" {
|
||||
partitionSize := m.MinSize / sectorSize
|
||||
table.createFilesystem(m.Mountpoint, partitionSize)
|
||||
}
|
||||
}
|
||||
|
|
@ -56,7 +55,7 @@ func CreatePartitionTable(
|
|||
// treat the root partition as a special case
|
||||
// by setting the size dynamically
|
||||
rootPartition := table.RootPartition()
|
||||
rootPartition.Size = ((imageSize / sectorSize) - start - 100)
|
||||
rootPartition.Size = ((imageSize / DefaultSectorSize) - start - 100)
|
||||
|
||||
// Generate new UUIDs for filesystems and partitions
|
||||
table.GenerateUUIDs(rng)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/osbuild2"
|
||||
)
|
||||
|
||||
const (
|
||||
// Default sector size in bytes
|
||||
DefaultSectorSize = 512
|
||||
)
|
||||
|
||||
type PartitionTable struct {
|
||||
Size uint64 // Size of the disk (in bytes).
|
||||
UUID string // Unique identifier of the partition table (GPT only).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue