summaryrefslogtreecommitdiff
path: root/cmd/btrfs-rec
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-07-13 21:22:14 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-07-13 21:39:42 -0600
commit72a458520fccafe4df8c02c811cb6f64a310616e (patch)
tree1c424b5376c31524b01f8461b02950eb04d48345 /cmd/btrfs-rec
parent952b677bf7f10da93673e3671f764c54c454bbfe (diff)
Move the remaining former-generic.go parts out of lib/util/
Diffstat (limited to 'cmd/btrfs-rec')
-rw-r--r--cmd/btrfs-rec/inspect_lsfiles.go6
-rw-r--r--cmd/btrfs-rec/inspect_lstrees.go7
2 files changed, 7 insertions, 6 deletions
diff --git a/cmd/btrfs-rec/inspect_lsfiles.go b/cmd/btrfs-rec/inspect_lsfiles.go
index 56f76b1..5abfbaf 100644
--- a/cmd/btrfs-rec/inspect_lsfiles.go
+++ b/cmd/btrfs-rec/inspect_lsfiles.go
@@ -16,7 +16,7 @@ import (
"git.lukeshu.com/btrfs-progs-ng/lib/btrfs"
"git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsitem"
"git.lukeshu.com/btrfs-progs-ng/lib/containers"
- "git.lukeshu.com/btrfs-progs-ng/lib/util"
+ "git.lukeshu.com/btrfs-progs-ng/lib/maps"
)
func init() {
@@ -129,7 +129,7 @@ func printDir(fs *btrfs.FS, fsTree btrfs.ObjID, prefix0, prefix1, dirName string
}
fmt.Printf("]\terror: %v\n", err)
}
- for i, index := range util.SortedMapKeys(membersByIndex) {
+ for i, index := range maps.SortedKeys(membersByIndex) {
entry := membersByIndex[index]
namehash := btrfsitem.NameHash(entry.Name)
if other, ok := membersByNameHash[namehash]; ok {
@@ -148,7 +148,7 @@ func printDir(fs *btrfs.FS, fsTree btrfs.ObjID, prefix0, prefix1, dirName string
}
printDirEntry(fs, fsTree, prefix1+p0, prefix1+p1, entry)
}
- for _, namehash := range util.SortedMapKeys(membersByNameHash) {
+ for _, namehash := range maps.SortedKeys(membersByNameHash) {
entry := membersByNameHash[namehash]
errs = append(errs, fmt.Errorf("read dir: no DIR_INDEX for DIR_ITEM crc32c(%q)=%#x",
entry.Name, namehash))
diff --git a/cmd/btrfs-rec/inspect_lstrees.go b/cmd/btrfs-rec/inspect_lstrees.go
index 590ec23..003e7ae 100644
--- a/cmd/btrfs-rec/inspect_lstrees.go
+++ b/cmd/btrfs-rec/inspect_lstrees.go
@@ -16,7 +16,8 @@ import (
"git.lukeshu.com/btrfs-progs-ng/lib/btrfs"
"git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsitem"
"git.lukeshu.com/btrfs-progs-ng/lib/btrfsprogs/btrfsutil"
- "git.lukeshu.com/btrfs-progs-ng/lib/util"
+ "git.lukeshu.com/btrfs-progs-ng/lib/maps"
+ "git.lukeshu.com/btrfs-progs-ng/lib/slices"
)
func init() {
@@ -55,11 +56,11 @@ func init() {
for _, cnt := range treeItemCnt {
totalItems += cnt
}
- numWidth := len(strconv.Itoa(util.Max(treeErrCnt, totalItems)))
+ numWidth := len(strconv.Itoa(slices.Max(treeErrCnt, totalItems)))
table := tabwriter.NewWriter(os.Stdout, 0, 8, 2, ' ', 0)
fmt.Fprintf(table, " errors\t% *s\n", numWidth, strconv.Itoa(treeErrCnt))
- for _, typ := range util.SortedMapKeys(treeItemCnt) {
+ for _, typ := range maps.SortedKeys(treeItemCnt) {
fmt.Fprintf(table, " %v items\t% *s\n", typ, numWidth, strconv.Itoa(treeItemCnt[typ]))
}
fmt.Fprintf(table, " total items\t% *s\n", numWidth, strconv.Itoa(totalItems))