diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-02 16:42:13 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-02 17:04:11 -0600 |
commit | cd46b6b734d833a9e2d83ba92e8f7348e63afe7e (patch) | |
tree | 929fc86215381fe43927894d86869e0c17d808c8 /pkg/btrfs/btrfsitem/items.go | |
parent | 9ddcd2c3ed2f85247161c5ffa653f33e6a01a9cd (diff) |
implement EXTENT_CSUM
Diffstat (limited to 'pkg/btrfs/btrfsitem/items.go')
-rw-r--r-- | pkg/btrfs/btrfsitem/items.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/btrfs/btrfsitem/items.go b/pkg/btrfs/btrfsitem/items.go index 1a3b883..5ad3471 100644 --- a/pkg/btrfs/btrfsitem/items.go +++ b/pkg/btrfs/btrfsitem/items.go @@ -5,6 +5,7 @@ import ( "reflect" "lukeshu.com/btrfs-tools/pkg/binstruct" + "lukeshu.com/btrfs-tools/pkg/btrfs/btrfssum" "lukeshu.com/btrfs-tools/pkg/btrfs/internal" ) @@ -31,7 +32,7 @@ func (o *Error) UnmarshalBinary(dat []byte) (int, error) { } // Rather than returning a separate error value, return an Error item. -func UnmarshalItem(key internal.Key, dat []byte) Item { +func UnmarshalItem(key internal.Key, csumType btrfssum.CSumType, dat []byte) Item { var gotyp reflect.Type if key.ItemType == UNTYPED_KEY { var ok bool @@ -54,6 +55,9 @@ func UnmarshalItem(key internal.Key, dat []byte) Item { } } retPtr := reflect.New(gotyp) + if csums, ok := retPtr.Interface().(*ExtentCSum); ok { + csums.ChecksumSize = csumType.Size() + } n, err := binstruct.Unmarshal(dat, retPtr.Interface()) if err != nil { return Error{ |