diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-08-09 16:01:20 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-08-17 22:50:57 -0600 |
commit | 286db83409b56de7b0ac3a74709018c01de43f44 (patch) | |
tree | 147229cdaebb3fa8681bc6e07e3cce6fd40300ae /cmd/btrfs-rec/inspect_scanforextents.go | |
parent | 51659255af92e050ce0d2bca65629512a833eae4 (diff) |
cli: wip: Rethink the "scan" CLI commands
Diffstat (limited to 'cmd/btrfs-rec/inspect_scanforextents.go')
-rw-r--r-- | cmd/btrfs-rec/inspect_scanforextents.go | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/cmd/btrfs-rec/inspect_scanforextents.go b/cmd/btrfs-rec/inspect_scanforextents.go deleted file mode 100644 index 9b5ada4..0000000 --- a/cmd/btrfs-rec/inspect_scanforextents.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com> -// -// SPDX-License-Identifier: GPL-2.0-or-later - -package main - -import ( - "os" - "runtime" - - "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/rebuildmappings" -) - -func init() { - inspectors = append(inspectors, subcommand{ - Command: cobra.Command{ - Use: "scan-for-extents NODESCAN.json DUMPSUMS.gob", - Args: cliutil.WrapPositionalArgs(cobra.ExactArgs(2)), - }, - RunE: func(fs *btrfs.FS, cmd *cobra.Command, args []string) error { - ctx := cmd.Context() - - dlog.Infof(ctx, "Reading %q...", args[0]) - bgs, err := rebuildmappings.ReadNodeScanResults(fs, args[0]) - if err != nil { - return err - } - runtime.GC() - dlog.Infof(ctx, "... done reading %q", args[0]) - - dlog.Infof(ctx, "Reading %q...", args[1]) - sums, err := rebuildmappings.ReadAllSums(args[1]) - if err != nil { - return err - } - dlog.Infof(ctx, "... done reading %q", args[1]) - - if err := rebuildmappings.ScanForExtents(ctx, fs, bgs, sums); err != nil { - return err - } - - dlog.Infof(ctx, "Writing reconstructed mappings to stdout...") - if err := writeMappingsJSON(os.Stdout, fs); err != nil { - return err - } - - return nil - }, - }) -} |