diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-12-20 20:06:15 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-12-20 20:06:15 -0700 |
commit | 8ff81c1ed6a50179166ffc4cfb60bef85394265e (patch) | |
tree | f2395593d4d4cfd12b26ba2030bb94930fe4ba56 /cmd/btrfs-rec | |
parent | 7315c38414b3a6840d71f254b7c8192640b41d7c (diff) | |
parent | 94a86a763157327ac969c98e19d7770db477a6a3 (diff) |
Merge branch 'lukeshu/rebuild-nodes-take2'
Diffstat (limited to 'cmd/btrfs-rec')
-rw-r--r-- | cmd/btrfs-rec/inspect_dumpgraph.go | 44 | ||||
-rw-r--r-- | cmd/btrfs-rec/inspect_rebuildnodes.go | 6 | ||||
-rw-r--r-- | cmd/btrfs-rec/inspect_visualizenodes.go | 44 |
3 files changed, 3 insertions, 91 deletions
diff --git a/cmd/btrfs-rec/inspect_dumpgraph.go b/cmd/btrfs-rec/inspect_dumpgraph.go deleted file mode 100644 index 8e803d3..0000000 --- a/cmd/btrfs-rec/inspect_dumpgraph.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> -// -// SPDX-License-Identifier: GPL-2.0-or-later - -package main - -import ( - "bufio" - "os" - - "github.com/datawire/dlib/dlog" - "github.com/datawire/ocibuild/pkg/cliutil" - "github.com/spf13/cobra" - - "git.lukeshu.com/btrfs-progs-ng/lib/btrfs" - "git.lukeshu.com/btrfs-progs-ng/lib/btrfsprogs/btrfsinspect/rebuildnodes" -) - -func init() { - inspectors = append(inspectors, subcommand{ - Command: cobra.Command{ - Use: "show-loops NODESCAN.json", - Args: cliutil.WrapPositionalArgs(cobra.ExactArgs(1)), - }, - RunE: func(fs *btrfs.FS, cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - - dlog.Infof(ctx, "Reading %q...", args[0]) - nodeScanResults, err := readScanResults(args[0]) - if err != nil { - return err - } - dlog.Infof(ctx, "... done reading %q", args[0]) - - buffer := bufio.NewWriter(os.Stdout) - defer func() { - if _err := buffer.Flush(); err == nil && _err != nil { - err = _err - } - }() - return rebuildnodes.ShowLoops(ctx, buffer, fs, nodeScanResults) - }, - }) -} diff --git a/cmd/btrfs-rec/inspect_rebuildnodes.go b/cmd/btrfs-rec/inspect_rebuildnodes.go index 5d0a54e..5f6d9b5 100644 --- a/cmd/btrfs-rec/inspect_rebuildnodes.go +++ b/cmd/btrfs-rec/inspect_rebuildnodes.go @@ -4,7 +4,6 @@ package main -/* import ( "bufio" "io" @@ -16,8 +15,10 @@ import ( "github.com/spf13/cobra" "git.lukeshu.com/btrfs-progs-ng/lib/btrfs" + "git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsprim" "git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsvol" "git.lukeshu.com/btrfs-progs-ng/lib/btrfsprogs/btrfsinspect/rebuildnodes" + "git.lukeshu.com/btrfs-progs-ng/lib/containers" ) func init() { @@ -52,7 +53,7 @@ func init() { }) } -func writeNodesJSON(w io.Writer, rebuiltNodes map[btrfsvol.LogicalAddr]*rebuildnodes.RebuiltNode) (err error) { +func writeNodesJSON(w io.Writer, rebuiltNodes map[btrfsprim.ObjID]containers.Set[btrfsvol.LogicalAddr]) (err error) { buffer := bufio.NewWriter(w) defer func() { if _err := buffer.Flush(); err == nil && _err != nil { @@ -66,4 +67,3 @@ func writeNodesJSON(w io.Writer, rebuiltNodes map[btrfsvol.LogicalAddr]*rebuildn ForceTrailingNewlines: true, }, rebuiltNodes) } -*/ diff --git a/cmd/btrfs-rec/inspect_visualizenodes.go b/cmd/btrfs-rec/inspect_visualizenodes.go deleted file mode 100644 index 89c8ad6..0000000 --- a/cmd/btrfs-rec/inspect_visualizenodes.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> -// -// SPDX-License-Identifier: GPL-2.0-or-later - -package main - -import ( - "bufio" - "os" - - "github.com/datawire/dlib/dlog" - "github.com/datawire/ocibuild/pkg/cliutil" - "github.com/spf13/cobra" - - "git.lukeshu.com/btrfs-progs-ng/lib/btrfs" - "git.lukeshu.com/btrfs-progs-ng/lib/btrfsprogs/btrfsinspect/rebuildnodes" -) - -func init() { - inspectors = append(inspectors, subcommand{ - Command: cobra.Command{ - Use: "visualize-nodes NODESCAN.json", - Args: cliutil.WrapPositionalArgs(cobra.ExactArgs(1)), - }, - RunE: func(fs *btrfs.FS, cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - - dlog.Infof(ctx, "Reading %q...", args[0]) - nodeScanResults, err := readScanResults(args[0]) - if err != nil { - return err - } - dlog.Infof(ctx, "... done reading %q", args[0]) - - buffer := bufio.NewWriter(os.Stdout) - defer func() { - if _err := buffer.Flush(); err == nil && _err != nil { - err = _err - } - }() - return rebuildnodes.VisualizeNodes(ctx, buffer, fs, nodeScanResults) - }, - }) -} |