disk: add partition type helpers
Add helper methods on `Partition` so that we can easily "detect" if they are of the type BIOS-BOOT or PReP. Add the PReP GUID for GPT as well.
This commit is contained in:
parent
1060885386
commit
ca61baf03b
2 changed files with 18 additions and 0 deletions
|
|
@ -41,6 +41,8 @@ const (
|
|||
EFISystemPartitionUUID = "68B2905B-DF3E-4FB3-80FA-49D1E773AA33"
|
||||
EFIFilesystemUUID = "7B77-95E7"
|
||||
|
||||
PRePartitionGUID = "9E1A2D38-C612-4316-AA26-8B49521E5A8B"
|
||||
|
||||
RootPartitionUUID = "6264D520-3FB9-423F-8AB8-7A0A8E3D3562"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -69,3 +69,19 @@ func (p *Partition) EnsureSize(s uint64) bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *Partition) IsBIOSBoot() bool {
|
||||
if p == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return p.Type == BIOSBootPartitionGUID
|
||||
}
|
||||
|
||||
func (p *Partition) IsPReP() bool {
|
||||
if p == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return p.Type == "41" || p.Type == PRePartitionGUID
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue