diff options
Diffstat (limited to 'cmd/btrfs-rec/inspect_lstrees.go')
-rw-r--r-- | cmd/btrfs-rec/inspect_lstrees.go | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/cmd/btrfs-rec/inspect_lstrees.go b/cmd/btrfs-rec/inspect_lstrees.go index 24622b4..decb75c 100644 --- a/cmd/btrfs-rec/inspect_lstrees.go +++ b/cmd/btrfs-rec/inspect_lstrees.go @@ -25,28 +25,16 @@ import ( ) func init() { - var nodeListFilename string - cmd := &cobra.Command{ + inspectors.AddCommand(&cobra.Command{ Use: "ls-trees", Short: "A brief view what types of items are in each tree", Long: "" + "If no --node-list is given, then a slow sector-by-sector scan " + "will be used to find all lost+found nodes.", Args: cliutil.WrapPositionalArgs(cobra.NoArgs), - RunE: runWithRawFS(func(fs *btrfs.FS, cmd *cobra.Command, _ []string) error { + RunE: runWithReadableFSAndNodeList(func(fs btrfs.ReadableFS, nodeList []btrfsvol.LogicalAddr, cmd *cobra.Command, _ []string) error { ctx := cmd.Context() - var nodeList []btrfsvol.LogicalAddr - var err error - if nodeListFilename != "" { - nodeList, err = readJSONFile[[]btrfsvol.LogicalAddr](ctx, nodeListFilename) - } else { - nodeList, err = btrfsutil.ListNodes(ctx, fs) - } - if err != nil { - return err - } - var treeErrCnt int var treeItemCnt map[btrfsitem.Type]int flush := func() { @@ -124,10 +112,5 @@ func init() { return nil }), - } - cmd.Flags().StringVar(&nodeListFilename, "node-list", "", - "Output of 'btrfs-recs inspect [rebuild-mappings] list-nodes' to use for a lost+found tree") - noError(cmd.MarkFlagFilename("node-list")) - - inspectors.AddCommand(cmd) + }) } |