linuxkit/pkg/metadata/vendor/github.com/diskfs/go-diskfs/partition/partition.go
Itxaka ea6268dd74
Bump go-diskfs to latest (#3902)
Also fix cdrom provider use of the new diskfs

Signed-off-by: Itxaka <itxaka@spectrocloud.com>

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
Co-authored-by: Itxaka <itxaka@spectrocloud.com>
2023-01-23 16:19:32 +02:00

27 lines
778 B
Go
Vendored

// Package partition provides ability to work with individual partitions.
// All useful implementations are subpackages of this package, e.g. github.com/diskfs/go-diskfs/gpt
package partition
import (
"fmt"
"github.com/diskfs/go-diskfs/partition/gpt"
"github.com/diskfs/go-diskfs/partition/mbr"
"github.com/diskfs/go-diskfs/util"
)
// Read read a partition table from a disk
func Read(f util.File, logicalBlocksize, physicalBlocksize int) (Table, error) {
// just try each type
gptTable, err := gpt.Read(f, logicalBlocksize, physicalBlocksize)
if err == nil {
return gptTable, nil
}
mbrTable, err := mbr.Read(f, logicalBlocksize, physicalBlocksize)
if err == nil {
return mbrTable, nil
}
// we are out
return nil, fmt.Errorf("unknown disk partition type")
}