diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-04-17 18:21:04 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-04-17 19:52:26 -0600 |
commit | 6b521d08bbb75430432834e5fcd2cb1da3de1e2e (patch) | |
tree | 89a729827ca956234cea97269e12c0859b8fb08f /lib/btrfsutil/rebuilt_callbacks.go | |
parent | 3a7fec8e6fe4d36c976540f88bce2c186dd47d1f (diff) |
btrfsutil: RebuiltForrest: Have LookupRoot return an error
Diffstat (limited to 'lib/btrfsutil/rebuilt_callbacks.go')
-rw-r--r-- | lib/btrfsutil/rebuilt_callbacks.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/btrfsutil/rebuilt_callbacks.go b/lib/btrfsutil/rebuilt_callbacks.go index 9ed3177..b5fbc91 100644 --- a/lib/btrfsutil/rebuilt_callbacks.go +++ b/lib/btrfsutil/rebuilt_callbacks.go @@ -16,7 +16,7 @@ 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) + 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) } @@ -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. |