diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-13 18:49:47 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-19 00:44:12 -0400 |
commit | 0d6880131e90b43e03e0878dfc2ea2b6f0f2291e (patch) | |
tree | b05e9ede108bbb331bf3b111fac729e35b5a4e51 /lib/btrfs/btrfstree | |
parent | 0f96c9ce920875babd4cd23819a2fb2960dc0cc6 (diff) |
btrfstree: Have LookupTreeRoot take a Context
Diffstat (limited to 'lib/btrfs/btrfstree')
-rw-r--r-- | lib/btrfs/btrfstree/btree_forrest.go | 3 | ||||
-rw-r--r-- | lib/btrfs/btrfstree/btree_tree.go | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/btrfs/btrfstree/btree_forrest.go b/lib/btrfs/btrfstree/btree_forrest.go index 0f46d42..d4317d6 100644 --- a/lib/btrfs/btrfstree/btree_forrest.go +++ b/lib/btrfs/btrfstree/btree_forrest.go @@ -5,6 +5,7 @@ package btrfstree import ( + "context" "errors" "fmt" @@ -24,7 +25,7 @@ type TreeRoot struct { // LookupTreeRoot is a utility function to help with implementing the // 'TreeOperator' interface. -func LookupTreeRoot(fs TreeOperator, sb Superblock, treeID btrfsprim.ObjID) (*TreeRoot, error) { +func LookupTreeRoot(_ context.Context, fs TreeOperator, sb Superblock, treeID btrfsprim.ObjID) (*TreeRoot, error) { switch treeID { case btrfsprim.ROOT_TREE_OBJECTID: return &TreeRoot{ diff --git a/lib/btrfs/btrfstree/btree_tree.go b/lib/btrfs/btrfstree/btree_tree.go index 459f481..a34946e 100644 --- a/lib/btrfs/btrfstree/btree_tree.go +++ b/lib/btrfs/btrfstree/btree_tree.go @@ -28,7 +28,7 @@ func (fs TreeOperatorImpl) TreeWalk(ctx context.Context, treeID btrfsprim.ObjID, if err != nil { errHandle(&TreeError{Path: Path{{FromTree: treeID, ToMaxKey: btrfsprim.MaxKey}}, Err: err}) } - rootInfo, err := LookupTreeRoot(fs, *sb, treeID) + rootInfo, err := LookupTreeRoot(ctx, fs, *sb, treeID) if err != nil { errHandle(&TreeError{Path: Path{{FromTree: treeID, ToMaxKey: btrfsprim.MaxKey}}, Err: err}) return @@ -405,11 +405,12 @@ func (fs TreeOperatorImpl) next(path Path, node *Node) (Path, *Node, error) { // TreeSearch implements the 'TreeOperator' interface. func (fs TreeOperatorImpl) TreeSearch(treeID btrfsprim.ObjID, searcher TreeSearcher) (Item, error) { + ctx := context.TODO() sb, err := fs.Superblock() if err != nil { return Item{}, err } - rootInfo, err := LookupTreeRoot(fs, *sb, treeID) + rootInfo, err := LookupTreeRoot(ctx, fs, *sb, treeID) if err != nil { return Item{}, err } @@ -430,11 +431,12 @@ func (fs TreeOperatorImpl) TreeLookup(treeID btrfsprim.ObjID, key btrfsprim.Key) // TreeSearchAll implements the 'TreeOperator' interface. func (fs TreeOperatorImpl) TreeSearchAll(treeID btrfsprim.ObjID, searcher TreeSearcher) ([]Item, error) { + ctx := context.TODO() sb, err := fs.Superblock() if err != nil { return nil, err } - rootInfo, err := LookupTreeRoot(fs, *sb, treeID) + rootInfo, err := LookupTreeRoot(ctx, fs, *sb, treeID) if err != nil { return nil, err } |