From 6f1914f5db33a0d4431069eb9378cac68daf8cc0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 9 Mar 2023 16:43:39 -0700 Subject: btrfstree: Rethink 'Path' yet again --- cmd/btrfs-rec/inspect/dumptrees/print_tree.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'cmd/btrfs-rec/inspect') 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) -- cgit v1.2.3-2-g168b