From dfc92fe2b1a5c208e756803a10489530dd90054d Mon Sep 17 00:00:00 2001 From: lasith-kg Date: Mon, 20 May 2024 12:53:19 +0000 Subject: [PATCH] (feat): Suggestions from Pull Request --- configs/ubuntu.yml | 2 +- internal/config/modifier.go | 5 ++--- internal/datastructures/lvm_graph.go | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/configs/ubuntu.yml b/configs/ubuntu.yml index af81fb6..2ab6075 100644 --- a/configs/ubuntu.yml +++ b/configs/ubuntu.yml @@ -14,4 +14,4 @@ devices: mountPoint: /mnt/bar user: ubuntu group: ubuntu - permissions: 755 \ No newline at end of file + permissions: 755 diff --git a/internal/config/modifier.go b/internal/config/modifier.go index 09f7fcc..4dc5d99 100644 --- a/internal/config/modifier.go +++ b/internal/config/modifier.go @@ -70,9 +70,8 @@ func NewLvmModifier() *LvmModifier { } func (lm *LvmModifier) Modify(c *Config) error { - // Fetch a copy of the original keys as we are updating - // the config in-place and it is unsafe to iterate over it - // directly + // Fetch a copy of the original keys as we are updating the + // config in-place and it is unsafe to iterate over it directly keys := make([]string, len(c.Devices)) for name := range c.Devices { keys = append(keys, name) diff --git a/internal/datastructures/lvm_graph.go b/internal/datastructures/lvm_graph.go index 7e87f02..29bbd89 100644 --- a/internal/datastructures/lvm_graph.go +++ b/internal/datastructures/lvm_graph.go @@ -197,6 +197,7 @@ func (lg *LvmGraph) GetLogicalVolume(name string, vg string) (*LvmNode, error) { func (lg *LvmGraph) GetParents(node *LvmNode, state LvmNodeCategory) []*LvmNode { parents := []*LvmNode{} for _, p := range node.parents { + // Bitmasking to check if the parent nodes is of the desired category if int32(p.State)&int32(state) > 0 { parents = append(parents, p) } @@ -207,6 +208,7 @@ func (lg *LvmGraph) GetParents(node *LvmNode, state LvmNodeCategory) []*LvmNode func (lg *LvmGraph) GetChildren(node *LvmNode, state LvmNodeCategory) []*LvmNode { children := []*LvmNode{} for _, c := range node.children { + // Bitmasking to check if children nodes is of the desired category if int32(c.State)&int32(state) > 0 { children = append(children, c) }