summaryrefslogtreecommitdiff
path: root/lib/btrfs/btrfstree/types_node.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-03-29 22:14:49 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2023-03-30 00:11:50 -0600
commit755ac780df4f653879cb376d27cad7ff8e8d7b0f (patch)
treedbb9cc24a2ed4c800bf489101aad13e86fd703e4 /lib/btrfs/btrfstree/types_node.go
parent9317e6ec41ebafe1a6950a2996dcd8c4e35650fd (diff)
btrfstree: Maximum node level is 8
Diffstat (limited to 'lib/btrfs/btrfstree/types_node.go')
-rw-r--r--lib/btrfs/btrfstree/types_node.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/btrfs/btrfstree/types_node.go b/lib/btrfs/btrfstree/types_node.go
index ed9ba58..28b93cf 100644
--- a/lib/btrfs/btrfstree/types_node.go
+++ b/lib/btrfs/btrfstree/types_node.go
@@ -103,10 +103,13 @@ type NodeHeader struct {
Generation btrfsprim.Generation `bin:"off=0x50, siz=0x8"`
Owner btrfsprim.ObjID `bin:"off=0x58, siz=0x8"` // The ID of the tree that contains this node
NumItems uint32 `bin:"off=0x60, siz=0x4"` // [ignored-when-writing]
- Level uint8 `bin:"off=0x64, siz=0x1"` // 0 for leaf nodes, >=1 for interior nodes
+ Level uint8 `bin:"off=0x64, siz=0x1"` // 0 for leaf nodes, >=1 for interior nodes (max 8)
binstruct.End `bin:"off=0x65"`
}
+// MaxLevel is the maximum valid NodeHeader.Level.
+const MaxLevel = 8
+
// MaxItems returns the maximum possible valid value of
// .Head.NumItems.
func (node Node) MaxItems() uint32 {