diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-01 00:31:57 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-01 00:31:57 -0600 |
commit | b589943af25661c140bacdc0afc2550e1e2db852 (patch) | |
tree | 99fb838ed9a00d335a1543431145b1f6680753e4 /cmd/btrfs-fsck/pass1.go | |
parent | 7d2d4ae383e02a03dec6aa60207e3a1dfa8e79a9 (diff) |
add more callbacks to WalkFS
Diffstat (limited to 'cmd/btrfs-fsck/pass1.go')
-rw-r--r-- | cmd/btrfs-fsck/pass1.go | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/cmd/btrfs-fsck/pass1.go b/cmd/btrfs-fsck/pass1.go index 6812c73..5188d65 100644 --- a/cmd/btrfs-fsck/pass1.go +++ b/cmd/btrfs-fsck/pass1.go @@ -22,19 +22,22 @@ func pass1(fs *btrfs.FS, superblock *util.Ref[btrfs.PhysicalAddr, btrfs.Superblo fmt.Printf("Pass 1: ... walking fs\n") visitedNodes := make(map[btrfs.LogicalAddr]struct{}) - btrfsmisc.WalkFS(fs, btrfs.WalkTreeHandler{ - Node: func(path btrfs.WalkTreePath, node *util.Ref[btrfs.LogicalAddr, btrfs.Node], err error) error { - if err != nil { - err = fmt.Errorf("%v: %w", path, err) - fmt.Printf("Pass 1: ... walk fs: error: %v\n", err) - } - if node != nil { - visitedNodes[node.Addr] = struct{}{} - } - return err + btrfsmisc.WalkFS(fs, btrfsmisc.WalkFSHandler{ + WalkTreeHandler: btrfs.WalkTreeHandler{ + Node: func(path btrfs.WalkTreePath, node *util.Ref[btrfs.LogicalAddr, btrfs.Node], err error) error { + if err != nil { + err = fmt.Errorf("%v: %w", path, err) + fmt.Printf("Pass 1: ... walk fs: error: %v\n", err) + } + if node != nil { + visitedNodes[node.Addr] = struct{}{} + } + return err + }, + }, + Err: func(err error) { + fmt.Printf("Pass 1: ... walk fs: error: %v\n", err) }, - }, func(err error) { - fmt.Printf("Pass 1: ... walk fs: error: %v\n", err) }) fsFoundNodes := make(map[btrfs.LogicalAddr]struct{}) |