summaryrefslogtreecommitdiff
path: root/lib/btrfsutil/rebuilt_callbacks.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/btrfsutil/rebuilt_callbacks.go')
-rw-r--r--lib/btrfsutil/rebuilt_callbacks.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/btrfsutil/rebuilt_callbacks.go b/lib/btrfsutil/rebuilt_callbacks.go
index 0b51d08..b5fbc91 100644
--- a/lib/btrfsutil/rebuilt_callbacks.go
+++ b/lib/btrfsutil/rebuilt_callbacks.go
@@ -16,8 +16,8 @@ import (
type RebuiltForrestCallbacks interface {
AddedRoot(ctx context.Context, tree btrfsprim.ObjID, root btrfsvol.LogicalAddr)
- LookupRoot(ctx context.Context, tree btrfsprim.ObjID) (offset btrfsprim.Generation, item btrfsitem.Root, ok bool)
- LookupUUID(ctx context.Context, uuid btrfsprim.UUID) (id btrfsprim.ObjID, ok bool)
+ LookupRoot(ctx context.Context, tree btrfsprim.ObjID) (offset btrfsprim.Generation, item btrfsitem.Root, err error)
+ LookupUUID(ctx context.Context, uuid btrfsprim.UUID) (id btrfsprim.ObjID, err error)
}
type RebuiltForrestExtendedCallbacks interface {
@@ -32,21 +32,21 @@ type noopRebuiltForrestCallbacks struct {
func (noopRebuiltForrestCallbacks) AddedRoot(context.Context, btrfsprim.ObjID, btrfsvol.LogicalAddr) {
}
-func (cb noopRebuiltForrestCallbacks) LookupRoot(ctx context.Context, tree btrfsprim.ObjID) (offset btrfsprim.Generation, _item btrfsitem.Root, ok bool) {
+func (cb noopRebuiltForrestCallbacks) LookupRoot(ctx context.Context, tree btrfsprim.ObjID) (offset btrfsprim.Generation, _item btrfsitem.Root, err error) {
rootTree, err := cb.forrest.ForrestLookup(ctx, btrfsprim.ROOT_TREE_OBJECTID)
if err != nil {
- return 0, btrfsitem.Root{}, false
+ return 0, btrfsitem.Root{}, err
}
item, err := rootTree.TreeSearch(ctx, btrfstree.SearchRootItem(tree))
if err != nil {
- return 0, btrfsitem.Root{}, false
+ return 0, btrfsitem.Root{}, err
}
defer item.Body.Free()
switch itemBody := item.Body.(type) {
case *btrfsitem.Root:
- return btrfsprim.Generation(item.Key.Offset), *itemBody, true
+ return btrfsprim.Generation(item.Key.Offset), *itemBody, nil
case *btrfsitem.Error:
- return 0, btrfsitem.Root{}, false
+ return 0, btrfsitem.Root{}, itemBody.Err
default:
// This is a panic because the item decoder should not emit ROOT_ITEM items as anything but
// btrfsitem.Root or btrfsitem.Error without this code also being updated.
@@ -54,22 +54,22 @@ func (cb noopRebuiltForrestCallbacks) LookupRoot(ctx context.Context, tree btrfs
}
}
-func (cb noopRebuiltForrestCallbacks) LookupUUID(ctx context.Context, uuid btrfsprim.UUID) (id btrfsprim.ObjID, ok bool) {
+func (cb noopRebuiltForrestCallbacks) LookupUUID(ctx context.Context, uuid btrfsprim.UUID) (id btrfsprim.ObjID, err error) {
uuidTree, err := cb.forrest.ForrestLookup(ctx, btrfsprim.UUID_TREE_OBJECTID)
if err != nil {
- return 0, false
+ return 0, err
}
tgt := btrfsitem.UUIDToKey(uuid)
item, err := uuidTree.TreeLookup(ctx, tgt)
if err != nil {
- return 0, false
+ return 0, err
}
defer item.Body.Free()
switch itemBody := item.Body.(type) {
case *btrfsitem.UUIDMap:
- return itemBody.ObjID, true
+ return itemBody.ObjID, nil
case *btrfsitem.Error:
- return 0, false
+ return 0, itemBody.Err
default:
// This is a panic because the item decoder should not emit UUID_SUBVOL items as anything but
// btrfsitem.UUIDMap or btrfsitem.Error without this code also being updated.