Skip to content

Commit

Permalink
fixup! many: formatting improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
  • Loading branch information
ZeyadYasser committed Dec 16, 2024
1 parent 7713d6c commit 0c49e23
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
7 changes: 6 additions & 1 deletion gadget/gadget.go
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,12 @@ func checkCompatibleSchema(old, new *Volume) error {
// LaidOutVolumesFromGadget takes gadget volumes, gadget and kernel rootdirs
// and lays out the partitions on all volumes as specified. It returns the
// volumes mentioned in the gadget.yaml and their laid out representations.
func LaidOutVolumesFromGadget(vols map[string]*Volume, gadgetRoot, kernelRoot string, encType device.EncryptionType, volToGadgetToDiskStruct map[string]map[int]*OnDiskStructure) (all map[string]*LaidOutVolume, err error) {
func LaidOutVolumesFromGadget(
vols map[string]*Volume,
gadgetRoot, kernelRoot string,
encType device.EncryptionType,
volToGadgetToDiskStruct map[string]map[int]*OnDiskStructure,
) (all map[string]*LaidOutVolume, err error) {

all = make(map[string]*LaidOutVolume)
// layout all volumes saving them
Expand Down
7 changes: 6 additions & 1 deletion gadget/gadgettest/gadgettest.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ import (
"github.com/snapcore/snapd/osutil/disks"
)

func LaidOutVolumesFromGadget(gadgetRoot, kernelRoot string, model gadget.Model, encType device.EncryptionType, volToGadgetToDiskStruct map[string]map[int]*gadget.OnDiskStructure) (all map[string]*gadget.LaidOutVolume, err error) {
func LaidOutVolumesFromGadget(
gadgetRoot, kernelRoot string,
model gadget.Model,
encType device.EncryptionType,
volToGadgetToDiskStruct map[string]map[int]*gadget.OnDiskStructure,
) (all map[string]*gadget.LaidOutVolume, err error) {
// rely on the basic validation from ReadInfo to ensure that the system-*
// roles are all on the same volume for example
info, err := gadget.ReadInfoAndValidate(gadgetRoot, model, nil)
Expand Down
15 changes: 13 additions & 2 deletions gadget/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ func saveStorageTraits(mod gadget.Model, allVols map[string]*gadget.Volume, opts
return nil
}

func maybeEncryptPartition(dgpair *gadget.OnDiskAndGadgetStructurePair, encryptionType device.EncryptionType, sectorSize quantity.Size, perfTimings timings.Measurer) (fsParams *mkfsParams, diskEncryptionKey secboot.DiskUnlockKey, err error) {
func maybeEncryptPartition(
dgpair *gadget.OnDiskAndGadgetStructurePair,
encryptionType device.EncryptionType,
sectorSize quantity.Size,
perfTimings timings.Measurer,
) (fsParams *mkfsParams, diskEncryptionKey secboot.DiskUnlockKey, err error) {
diskPart := dgpair.DiskStructure
volStruct := dgpair.GadgetStructure
mustEncrypt := (encryptionType != device.EncryptionTypeNone)
Expand Down Expand Up @@ -630,7 +635,13 @@ func SaveStorageTraits(model gadget.Model, vols map[string]*gadget.Volume, encry
return nil
}

func EncryptPartitions(onVolumes map[string]*gadget.Volume, encryptionType device.EncryptionType, model *asserts.Model, gadgetRoot, kernelRoot string, perfTimings timings.Measurer) (*EncryptionSetupData, error) {
func EncryptPartitions(
onVolumes map[string]*gadget.Volume,
encryptionType device.EncryptionType,
model *asserts.Model,
gadgetRoot, kernelRoot string,
perfTimings timings.Measurer,
) (*EncryptionSetupData, error) {
setupData := &EncryptionSetupData{
parts: make(map[string]partEncryptionData),
}
Expand Down
8 changes: 7 additions & 1 deletion overlord/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,13 @@ func checkFDEFeatures(runSetupHook fde.RunSetupHookFunc) (et device.EncryptionTy
// CheckEncryptionSupport checks the type of encryption support for disks
// available if any and returns the corresponding device.EncryptionType,
// internally it uses GetEncryptionSupportInfo with the provided parameters.
func CheckEncryptionSupport(model *asserts.Model, tpmMode secboot.TPMProvisionMode, kernelInfo *snap.Info, gadgetInfo *gadget.Info, runSetupHook fde.RunSetupHookFunc) (device.EncryptionType, error) {
func CheckEncryptionSupport(
model *asserts.Model,
tpmMode secboot.TPMProvisionMode,
kernelInfo *snap.Info,
gadgetInfo *gadget.Info,
runSetupHook fde.RunSetupHookFunc,
) (device.EncryptionType, error) {
res, err := GetEncryptionSupportInfo(model, tpmMode, kernelInfo, gadgetInfo, runSetupHook)
if err != nil {
return "", err
Expand Down

0 comments on commit 0c49e23

Please sign in to comment.