summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/btrfs/btrfsitem/item_dir.go4
-rw-r--r--lib/btrfs/io3_btree.go80
-rw-r--r--lib/btrfsprogs/btrfsutil/broken_btree.go16
-rw-r--r--lib/containers/rbtree.go20
-rw-r--r--lib/fmtutil/fmt.go14
-rw-r--r--lib/slices/sliceutil.go32
6 files changed, 83 insertions, 83 deletions
diff --git a/lib/btrfs/btrfsitem/item_dir.go b/lib/btrfs/btrfsitem/item_dir.go
index 2fb2d41..9df1b8d 100644
--- a/lib/btrfs/btrfsitem/item_dir.go
+++ b/lib/btrfs/btrfsitem/item_dir.go
@@ -21,8 +21,8 @@ func NameHash(dat []byte) uint64 {
// key.objectid = inode of directory containing this entry
// key.offset =
-// for DIR_ITEM and XATTR_ITEM = NameHash(name)
-// for DIR_INDEX = index id in the directory (starting at 2, because "." and "..")
+// - for DIR_ITEM and XATTR_ITEM = NameHash(name)
+// - for DIR_INDEX = index id in the directory (starting at 2, because "." and "..")
type DirEntry struct { // DIR_ITEM=84 DIR_INDEX=96 XATTR_ITEM=24
Location internal.Key `bin:"off=0x0, siz=0x11"`
TransID int64 `bin:"off=0x11, siz=8"`
diff --git a/lib/btrfs/io3_btree.go b/lib/btrfs/io3_btree.go
index 73f9804..2efef89 100644
--- a/lib/btrfs/io3_btree.go
+++ b/lib/btrfs/io3_btree.go
@@ -66,52 +66,52 @@ var _ Trees = (*FS)(nil)
// - The first element will always have an ItemIdx of -1.
//
-// - For .Item() callbacks, the last element will always have a
-// NodeAddr of 0.
+// - For .Item() callbacks, the last element will always have a
+// NodeAddr of 0.
//
// For example, given the tree structure
//
-// [superblock]
-// |
-// | <------------------------------------------ pathElem={idx:-1, addr:0x01, lvl:3}
-// |
-// +[0x01]-----------+
-// | lvl=3 |
-// +-+-+-+-+-+-+-+-+-+
-// |1|2|3|4|5|6|7|8|9|
-// +---+---+---+---+-+
-// |
-// | <------------------------------ pathElem={idx:8, addr:0x02, lvl:2}
-// |
-// +[0x02]-----------+
-// | lvl=2 |
-// +-+-+-+-+-+-+-+-+-+
-// |1|2|3|4|5|6|7|8|9|
-// +---+---+---+---+-+
-// |
-// | <-------------------- pathElem={idx:7, addr:0x03, lvl:1}
-// |
-// +[0x03]-----------+
-// | lvl=1 |
-// +-+-+-+-+-+-+-+-+-+
-// |1|2|3|4|5|6|7|8|9|
-// +---+---+---+---+-+
-// |
-// | <---------------- pathElem={idx:4, addr:0x04, lvl:0}
-// |
-// +[0x04]-----------+
-// | lvl=0 |
-// +-+-+-+-+-+-+-+-+-+
-// |1|2|3|4|5|6|7|8|9|
-// +---+---+---+---+-+
-// |
-// | <--------------- pathElem={idx:5, addr:0, lvl:0}
-// |
-// [item]
+// [superblock]
+// |
+// | <------------------------------------------ pathElem={idx:-1, addr:0x01, lvl:3}
+// |
+// +[0x01]-----------+
+// | lvl=3 |
+// +-+-+-+-+-+-+-+-+-+
+// |1|2|3|4|5|6|7|8|9|
+// +---+---+---+---+-+
+// |
+// | <------------------------------ pathElem={idx:8, addr:0x02, lvl:2}
+// |
+// +[0x02]-----------+
+// | lvl=2 |
+// +-+-+-+-+-+-+-+-+-+
+// |1|2|3|4|5|6|7|8|9|
+// +---+---+---+---+-+
+// |
+// | <-------------------- pathElem={idx:7, addr:0x03, lvl:1}
+// |
+// +[0x03]-----------+
+// | lvl=1 |
+// +-+-+-+-+-+-+-+-+-+
+// |1|2|3|4|5|6|7|8|9|
+// +---+---+---+---+-+
+// |
+// | <---------------- pathElem={idx:4, addr:0x04, lvl:0}
+// |
+// +[0x04]-----------+
+// | lvl=0 |
+// +-+-+-+-+-+-+-+-+-+
+// |1|2|3|4|5|6|7|8|9|
+// +---+---+---+---+-+
+// |
+// | <--------------- pathElem={idx:5, addr:0, lvl:0}
+// |
+// [item]
//
// the path would be
//
-// {-1, 0x01, 3}→{8, 0x02, 2}→{7, 0x03, 1}→{4, 0x04, 0}→{2, 0, 0}
+// {-1, 0x01, 3}→{8, 0x02, 2}→{7, 0x03, 1}→{4, 0x04, 0}→{2, 0, 0}
type TreePath struct {
TreeID ObjID
Nodes []TreePathElem
diff --git a/lib/btrfsprogs/btrfsutil/broken_btree.go b/lib/btrfsprogs/btrfsutil/broken_btree.go
index 7fc812d..0d71cfb 100644
--- a/lib/btrfsprogs/btrfsutil/broken_btree.go
+++ b/lib/btrfsprogs/btrfsutil/broken_btree.go
@@ -108,14 +108,14 @@ var _ btrfs.Trees = (*brokenTrees)(nil)
//
// Of the btrfs.FS.Tree{Verb}Trees methods:
//
-// - TreeWalk works on broken trees
-// - TreeLookup relies on the tree being properly ordered (which a
-// broken tree might not be).
-// - TreeSearch relies on the tree being properly ordered (which a
-// broken tree might not be).
-// - TreeSearchAll relies on the tree being properly ordered (which a
-// broken tree might not be), and a bad node may cause it to not
-// return a truncated list of results.
+// - TreeWalk works on broken trees
+// - TreeLookup relies on the tree being properly ordered (which a
+// broken tree might not be).
+// - TreeSearch relies on the tree being properly ordered (which a
+// broken tree might not be).
+// - TreeSearchAll relies on the tree being properly ordered (which a
+// broken tree might not be), and a bad node may cause it to not
+// return a truncated list of results.
//
// NewBrokenTrees attempts to remedy these deficiencies by using
// .TreeWalk to build an out-of-FS index of all of the items in the
diff --git a/lib/containers/rbtree.go b/lib/containers/rbtree.go
index 0eef553..36da29d 100644
--- a/lib/containers/rbtree.go
+++ b/lib/containers/rbtree.go
@@ -63,16 +63,16 @@ func (node *RBNode[V]) walk(fn func(*RBNode[V]) error) error {
// means to go left on the tree (the value is too high), >0 means to
// go right on th etree (the value is too low).
//
-// +-----+
-// | v=8 | == 0 : this is it
-// +-----+
-// / \
-// / \
-// <0 : go left >0 : go right
-// / \
-// +---+ +---+
-// | 7 | | 9 |
-// +---+ +---+
+// +-----+
+// | v=8 | == 0 : this is it
+// +-----+
+// / \
+// / \
+// <0 : go left >0 : go right
+// / \
+// +---+ +---+
+// | 7 | | 9 |
+// +---+ +---+
//
// Returns nil if no such value is found.
//
diff --git a/lib/fmtutil/fmt.go b/lib/fmtutil/fmt.go
index a45ac58..3898046 100644
--- a/lib/fmtutil/fmt.go
+++ b/lib/fmtutil/fmt.go
@@ -37,15 +37,15 @@ func FmtStateString(st fmt.State, verb rune) string {
// fmt.Formatter for []byte or [n]byte types that have a custom string
// representation. Use it like:
//
-// type MyType [16]byte
+// type MyType [16]byte
//
-// func (val MyType) String() string {
-// …
-// }
+// func (val MyType) String() string {
+// …
+// }
//
-// func (val MyType) Format(f fmt.State, verb rune) {
-// util.FormatByteArrayStringer(val, val[:], f, verb)
-// }
+// func (val MyType) Format(f fmt.State, verb rune) {
+// util.FormatByteArrayStringer(val, val[:], f, verb)
+// }
func FormatByteArrayStringer(
obj interface {
fmt.Stringer
diff --git a/lib/slices/sliceutil.go b/lib/slices/sliceutil.go
index f95c7e7..567f9ec 100644
--- a/lib/slices/sliceutil.go
+++ b/lib/slices/sliceutil.go
@@ -95,15 +95,15 @@ func max(a, b int) int {
// Search the slice for a value for which `fn(slice[i]) = 0`.
//
-// + + + 0 0 0 - - -
-// ^ ^ ^
-// any of
+// : + + + 0 0 0 - - -
+// : ^ ^ ^
+// : any of
//
// You can conceptualize `fn` as subtraction:
//
-// func(straw T) int {
-// return needle - straw
-// }
+// func(straw T) int {
+// return needle - straw
+// }
func Search[T any](slice []T, fn func(T) int) (int, bool) {
beg, end := 0, len(slice)
for beg < end {
@@ -123,14 +123,14 @@ func Search[T any](slice []T, fn func(T) int) (int, bool) {
// Search the slice for the left-most value for which `fn(slice[i]) = 0`.
//
-// + + + 0 0 0 - - -
-// ^
+// : + + + 0 0 0 - - -
+// : ^
//
// You can conceptualize `fn` as subtraction:
//
-// func(straw T) int {
-// return needle - straw
-// }
+// func(straw T) int {
+// return needle - straw
+// }
func SearchLowest[T any](slice []T, fn func(T) int) (int, bool) {
lastBad, firstGood, firstBad := -1, len(slice), len(slice)
for lastBad+1 < min(firstGood, firstBad) {
@@ -153,14 +153,14 @@ func SearchLowest[T any](slice []T, fn func(T) int) (int, bool) {
// Search the slice for the right-most value for which `fn(slice[i]) = 0`.
//
-// + + + 0 0 0 - - -
-// ^
+// : + + + 0 0 0 - - -
+// : ^
//
// You can conceptualize `fn` as subtraction:
//
-// func(straw T) int {
-// return needle - straw
-// }
+// func(straw T) int {
+// return needle - straw
+// }
func SearchHighest[T any](slice []T, fn func(T) int) (int, bool) {
lastBad, lastGood, firstBad := -1, -1, len(slice)
for max(lastBad, lastGood)+1 < firstBad {