summaryrefslogtreecommitdiff
path: root/pkg/btrfs/io2_fs.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-06-01 09:56:56 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-06-01 09:56:56 -0600
commit437bf733021a6aa3b90042a12a35b887b8ed45a2 (patch)
treef9215e2d1453dde5691f27069104ccd97eb73da5 /pkg/btrfs/io2_fs.go
parentb9fa008b4911a534ff49d191539b57d60cc04663 (diff)
lib: eagerly unmarshal items
Diffstat (limited to 'pkg/btrfs/io2_fs.go')
-rw-r--r--pkg/btrfs/io2_fs.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/pkg/btrfs/io2_fs.go b/pkg/btrfs/io2_fs.go
index bcf9777..b7752c7 100644
--- a/pkg/btrfs/io2_fs.go
+++ b/pkg/btrfs/io2_fs.go
@@ -5,7 +5,6 @@ import (
"fmt"
"reflect"
- "lukeshu.com/btrfs-tools/pkg/binstruct"
"lukeshu.com/btrfs-tools/pkg/btrfs/btrfsitem"
"lukeshu.com/btrfs-tools/pkg/util"
)
@@ -123,17 +122,14 @@ func (fs *FS) Init() error {
for _, chunk := range syschunks {
fs.chunks = append(fs.chunks, chunk)
}
- if err := fs.WalkTree(sb.Data.ChunkTree, func(key Key, dat []byte) error {
+ if err := fs.WalkTree(sb.Data.ChunkTree, func(key Key, body btrfsitem.Item) error {
if key.ItemType != btrfsitem.CHUNK_ITEM_KEY {
return nil
}
- pair := SysChunk{
- Key: key,
- }
- if _, err := binstruct.Unmarshal(dat, &pair.Chunk); err != nil {
- return err
- }
- fs.chunks = append(fs.chunks, pair)
+ fs.chunks = append(fs.chunks, SysChunk{
+ Key: key,
+ Chunk: body.(btrfsitem.Chunk),
+ })
return nil
}); err != nil {
fs.initErr = err