make device node list public
This commit is contained in:
parent
8ab8ae3c7f
commit
3a210984eb
1 changed files with 4 additions and 4 deletions
8
base.go
8
base.go
|
@ -48,24 +48,24 @@ type DevicePathNode interface {
|
||||||
var ErrPathComplete = errors.New("device path already complete")
|
var ErrPathComplete = errors.New("device path already complete")
|
||||||
|
|
||||||
type DevicePath struct {
|
type DevicePath struct {
|
||||||
nodes []DevicePathNode
|
Nodes []DevicePathNode
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dp *DevicePath) complete() bool {
|
func (dp *DevicePath) complete() bool {
|
||||||
return len(dp.nodes) > 0 && dp.nodes[len(dp.nodes)-1].Type() == EndOfHardwareDevicePath
|
return len(dp.Nodes) > 0 && dp.Nodes[len(dp.Nodes)-1].Type() == EndOfHardwareDevicePath
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dp *DevicePath) PushNode(node DevicePathNode) error {
|
func (dp *DevicePath) PushNode(node DevicePathNode) error {
|
||||||
if dp.complete() {
|
if dp.complete() {
|
||||||
return ErrPathComplete
|
return ErrPathComplete
|
||||||
}
|
}
|
||||||
dp.nodes = append(dp.nodes, node)
|
dp.Nodes = append(dp.Nodes, node)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dp *DevicePath) String() string {
|
func (dp *DevicePath) String() string {
|
||||||
var res []string
|
var res []string
|
||||||
for _, node := range dp.nodes {
|
for _, node := range dp.Nodes {
|
||||||
if node.String() != "" {
|
if node.String() != "" {
|
||||||
res = append(res, node.String())
|
res = append(res, node.String())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue