summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-06-06 12:35:02 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-06-06 12:35:02 -0600
commitb35032f7aa821ec48612ccc78bc36f30c589c9b9 (patch)
treea13f18b441115746ca846d019515a70899dff7f3 /pkg
parent7a464fd038977ba1d57d730e7f15a4df5c8ca91a (diff)
show progress
Diffstat (limited to 'pkg')
-rw-r--r--pkg/btrfsmisc/fsck.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/btrfsmisc/fsck.go b/pkg/btrfsmisc/fsck.go
index e44dcb6..81317ce 100644
--- a/pkg/btrfsmisc/fsck.go
+++ b/pkg/btrfsmisc/fsck.go
@@ -11,7 +11,7 @@ import (
// ScanForNodes mimics btrfs-progs
// cmds/rescue-chunk-recover.c:scan_one_device(), except it doesn't do
// anything but log when it finds a node.
-func ScanForNodes(dev *btrfs.Device, sb btrfs.Superblock, fn func(*util.Ref[btrfs.PhysicalAddr, btrfs.Node], error)) error {
+func ScanForNodes(dev *btrfs.Device, sb btrfs.Superblock, fn func(*util.Ref[btrfs.PhysicalAddr, btrfs.Node], error), prog func(btrfs.PhysicalAddr)) error {
devSize, err := dev.Size()
if err != nil {
return err
@@ -29,6 +29,10 @@ func ScanForNodes(dev *btrfs.Device, sb btrfs.Superblock, fn func(*util.Ref[btrf
continue
}
+ if prog != nil {
+ prog(pos)
+ }
+
// read
if _, err := dev.ReadAt(nodeBuf, pos); err != nil {