diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-30 10:05:10 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-30 10:05:10 -0600 |
commit | e62b128e088346e891b8b2a5e6458cf77abc9d02 (patch) | |
tree | f92fd945ea2393431c01a1bd49ac16264673d467 /cmd/btrfs-rec/inspect | |
parent | cdc2df19c59965149e11c3a5710458c626ea0668 (diff) | |
parent | 6f1914f5db33a0d4431069eb9378cac68daf8cc0 (diff) |
Merge branch 'lukeshu/tree-api-pt2-path'
Diffstat (limited to 'cmd/btrfs-rec/inspect')
-rw-r--r-- | cmd/btrfs-rec/inspect/dumptrees/print_tree.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/cmd/btrfs-rec/inspect/dumptrees/print_tree.go b/cmd/btrfs-rec/inspect/dumptrees/print_tree.go index 7703078..75797a8 100644 --- a/cmd/btrfs-rec/inspect/dumptrees/print_tree.go +++ b/cmd/btrfs-rec/inspect/dumptrees/print_tree.go @@ -102,8 +102,7 @@ func printTree(ctx context.Context, out io.Writer, fs *btrfs.FS, treeID btrfspri printHeaderInfo(out, node) itemOffset = node.Size - uint32(nodeHeaderSize) }, - KeyPointer: func(path btrfstree.Path, item btrfstree.KeyPointer) bool { - treeID := path[0].FromTree + KeyPointer: func(_ btrfstree.Path, item btrfstree.KeyPointer) bool { textui.Fprintf(out, "\tkey %v block %v gen %v\n", item.Key.Format(treeID), item.BlockPtr, @@ -111,13 +110,11 @@ func printTree(ctx context.Context, out io.Writer, fs *btrfs.FS, treeID btrfspri return true }, Item: func(path btrfstree.Path, item btrfstree.Item) { - treeID := path[0].FromTree - i := path.Node(-1).FromItemSlot bs, _ := binstruct.Marshal(item.Body) itemSize := uint32(len(bs)) itemOffset -= itemSize textui.Fprintf(out, "\titem %v key %v itemoff %v itemsize %v\n", - i, + path[len(path)-1].(btrfstree.PathItem).FromSlot, //nolint:forcetypeassert // has to be item.Key.Format(treeID), itemOffset, itemSize) |