-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: rename memory to memorymodules
Rename `memory` to `memorymodules` to be more explicit Signed-off-by: Noel Georgi <[email protected]>
- Loading branch information
Showing
9 changed files
with
81 additions
and
81 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
internal/app/machined/pkg/adapters/hardware/memorymodule.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
package hardware | ||
|
||
import ( | ||
"github.com/talos-systems/go-smbios/smbios" | ||
|
||
"github.com/talos-systems/talos/pkg/machinery/resources/hardware" | ||
) | ||
|
||
// MemoryModule adapter provider conversion from smbios.SMBIOS. | ||
// | ||
//nolint:revive,golint | ||
func MemoryModule(m *hardware.MemoryModule) memoryModule { | ||
return memoryModule{ | ||
MemoryModule: m, | ||
} | ||
} | ||
|
||
type memoryModule struct { | ||
*hardware.MemoryModule | ||
} | ||
|
||
// Update current processor info. | ||
func (m memoryModule) Update(memory *smbios.MemoryDevice) { | ||
translateMemoryModuleInfo := func(in *smbios.MemoryDevice) hardware.MemoryModuleSpec { | ||
var memoryModuleSpec hardware.MemoryModuleSpec | ||
|
||
if in.Size != 0 && in.Size != 0xFFFF { | ||
var size uint32 | ||
|
||
if in.Size == 0x7FFF { | ||
size = uint32(in.ExtendedSize) | ||
} else { | ||
size = uint32(in.Size) | ||
} | ||
|
||
memoryModuleSpec.AssetTag = in.AssetTag | ||
memoryModuleSpec.BankLocator = in.BankLocator | ||
memoryModuleSpec.DeviceLocator = in.DeviceLocator | ||
memoryModuleSpec.Manufacturer = in.Manufacturer | ||
memoryModuleSpec.ProductName = in.PartNumber | ||
memoryModuleSpec.SerialNumber = in.SerialNumber | ||
memoryModuleSpec.Size = size | ||
memoryModuleSpec.Speed = uint32(in.Speed) | ||
} | ||
|
||
return memoryModuleSpec | ||
} | ||
|
||
*m.MemoryModule.TypedSpec() = translateMemoryModuleInfo(memory) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters