diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-07 01:34:15 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-07 01:34:15 -0600 |
commit | a169e17d28ce89ab243685f00e8bb9b418fe3130 (patch) | |
tree | a5c86e4f7524d4b38dba82dc6cc6164d9788c489 /pkg | |
parent | 8d6bd496c2ed027739a3edf02fe1785009f5a89f (diff) |
fix em up
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/btrfs/types_btree.go | 5 | ||||
-rw-r--r-- | pkg/btrfsmisc/print_tree.go | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/pkg/btrfs/types_btree.go b/pkg/btrfs/types_btree.go index 734c859..e58e33b 100644 --- a/pkg/btrfs/types_btree.go +++ b/pkg/btrfs/types_btree.go @@ -146,6 +146,11 @@ func (node Node) MarshalBinary() ([]byte, error) { return nil, fmt.Errorf("btrfs.Node.MarshalBinary: .Size must be greater than %d", binstruct.StaticSize(NodeHeader{})) } + if node.Head.Level > 0 { + node.Head.NumItems = uint32(len(node.BodyInternal)) + } else { + node.Head.NumItems = uint32(len(node.BodyLeaf)) + } buf := make([]byte, node.Size) diff --git a/pkg/btrfsmisc/print_tree.go b/pkg/btrfsmisc/print_tree.go index 3211d1d..de216c2 100644 --- a/pkg/btrfsmisc/print_tree.go +++ b/pkg/btrfsmisc/print_tree.go @@ -277,11 +277,11 @@ func printHeaderInfo(node btrfs.Node) { node.Head.Flags, node.Head.BackrefRev) - fmt.Printf("checksum stored %x\n", node.Head.Checksum) + fmt.Printf("checksum stored %v\n", node.Head.Checksum) if calcSum, err := node.CalculateChecksum(); err != nil { fmt.Printf("checksum calced %v\n", err) } else { - fmt.Printf("checksum calced %x\n", calcSum) + fmt.Printf("checksum calced %v\n", calcSum) } fmt.Printf("fs uuid %s\n", node.Head.MetadataUUID) |