summaryrefslogtreecommitdiff
path: root/pkg/btrfs/btrfsitem/item_fileextent.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-07-05 12:26:45 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-07-08 00:15:09 -0600
commitb392ad64a8fd04d20b35ad21d2d4ea3ff2778e3f (patch)
treefea515cb26435c767320ecb7b07fe1fec01ce388 /pkg/btrfs/btrfsitem/item_fileextent.go
parent08a2266c346edc20ad7bfdda62dc8f685f0be27d (diff)
wip file io
Diffstat (limited to 'pkg/btrfs/btrfsitem/item_fileextent.go')
-rw-r--r--pkg/btrfs/btrfsitem/item_fileextent.go29
1 files changed, 17 insertions, 12 deletions
diff --git a/pkg/btrfs/btrfsitem/item_fileextent.go b/pkg/btrfs/btrfsitem/item_fileextent.go
index 5e87021..f3cbffe 100644
--- a/pkg/btrfs/btrfsitem/item_fileextent.go
+++ b/pkg/btrfs/btrfsitem/item_fileextent.go
@@ -4,9 +4,12 @@ import (
"fmt"
"lukeshu.com/btrfs-tools/pkg/binstruct"
+ "lukeshu.com/btrfs-tools/pkg/btrfs/btrfsvol"
"lukeshu.com/btrfs-tools/pkg/btrfs/internal"
)
+// key.objectid = inode
+// key.offset = offset within file
type FileExtent struct { // EXTENT_DATA=108
Generation internal.Generation `bin:"off=0x0, siz=0x8"` // transaction ID that created this extent
RAMBytes int64 `bin:"off=0x8, siz=0x8"` // upper bound of what compressed data will decompress to
@@ -23,23 +26,25 @@ type FileExtent struct { // EXTENT_DATA=108
// only one of these, depending on .Type
BodyInline []byte `bin:"-"`
BodyReg struct {
- // Position within the device
- DiskByteNr int64 `bin:"off=0x0, siz=0x8"`
- DiskNumBytes int64 `bin:"off=0x8, siz=0x8"`
+ // Position of extent within the device
+ DiskByteNr btrfsvol.LogicalAddr `bin:"off=0x0, siz=0x8"`
+ DiskNumBytes btrfsvol.AddrDelta `bin:"off=0x8, siz=0x8"`
+
+ // Position of data within the extent
+ Offset btrfsvol.AddrDelta `bin:"off=0x10, siz=0x8"`
+ NumBytes btrfsvol.AddrDelta `bin:"off=0x18, siz=0x8"`
- // Position within the file
- Offset int64 `bin:"off=0x10, siz=0x8"`
- NumBytes int64 `bin:"off=0x18, siz=0x8"`
binstruct.End `bin:"off=0x20"`
} `bin:"-"`
BodyPrealloc struct {
- // Position within the device
- DiskByteNr int64 `bin:"off=0x0, siz=0x8"`
- DiskNumBytes int64 `bin:"off=0x8, siz=0x8"`
+ // Position of extent within the device
+ DiskByteNr btrfsvol.LogicalAddr `bin:"off=0x0, siz=0x8"`
+ DiskNumBytes btrfsvol.AddrDelta `bin:"off=0x8, siz=0x8"`
+
+ // Position of data within the extent
+ Offset btrfsvol.AddrDelta `bin:"off=0x10, siz=0x8"`
+ NumBytes btrfsvol.AddrDelta `bin:"off=0x18, siz=0x8"`
- // Position within the file
- Offset int64 `bin:"off=0x10, siz=0x8"`
- NumBytes int64 `bin:"off=0x18, siz=0x8"`
binstruct.End `bin:"off=0x20"`
} `bin:"-"`
}