diff options
Diffstat (limited to 'pkg/binstruct/binstruct_test.go')
-rw-r--r-- | pkg/binstruct/binstruct_test.go | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/pkg/binstruct/binstruct_test.go b/pkg/binstruct/binstruct_test.go index 1070d06..00c9e37 100644 --- a/pkg/binstruct/binstruct_test.go +++ b/pkg/binstruct/binstruct_test.go @@ -6,31 +6,27 @@ import ( "github.com/stretchr/testify/assert" "lukeshu.com/btrfs-tools/pkg/binstruct" - . "lukeshu.com/btrfs-tools/pkg/binstruct/binint" ) func TestSmoke(t *testing.T) { - type UUID [16]U8 - type PhysicalAddr I64le - func (PhysicalAddr) BinaryStaticSize() int { return I64le(0).BinaryStaticSize() } - func (x PhysicalAddr) MarshalBinary() ([]byte, error) { return I64le(x).MarshalBinary() } - func (x *PhysicalAddr) UnmarshalBinary([]byte) (int, error) { return I64le(x).UnmarshalBinary(dat) } + type UUID [16]byte + type PhysicalAddr int64 type DevItem struct { - DeviceID U64le `bin:"off=0x0, siz=0x8"` // device id + DeviceID uint64 `bin:"off=0x0, siz=0x8"` // device id - NumBytes U64le `bin:"off=0x8, siz=0x8"` // number of bytes - NumBytesUsed U64le `bin:"off=0x10, siz=0x8"` // number of bytes used + NumBytes uint64 `bin:"off=0x8, siz=0x8"` // number of bytes + NumBytesUsed uint64 `bin:"off=0x10, siz=0x8"` // number of bytes used - IOOptimalAlign U32le `bin:"off=0x18, siz=0x4"` // optimal I/O align - IOOptimalWidth U32le `bin:"off=0x1c, siz=0x4"` // optimal I/O width - IOMinSize U32le `bin:"off=0x20, siz=0x4"` // minimal I/O size (sector size) + IOOptimalAlign uint32 `bin:"off=0x18, siz=0x4"` // optimal I/O align + IOOptimalWidth uint32 `bin:"off=0x1c, siz=0x4"` // optimal I/O width + IOMinSize uint32 `bin:"off=0x20, siz=0x4"` // minimal I/O size (sector size) - Type U64le `bin:"off=0x24, siz=0x8"` // type - Generation U64le `bin:"off=0x2c, siz=0x8"` // generation - StartOffset U64le `bin:"off=0x34, siz=0x8"` // start offset - DevGroup U32le `bin:"off=0x3c, siz=0x4"` // dev group - SeekSpeed U8 `bin:"off=0x40, siz=0x1"` // seek speed - Bandwidth U8 `bin:"off=0x41, siz=0x1"` // bandwidth + Type uint64 `bin:"off=0x24, siz=0x8"` // type + Generation uint64 `bin:"off=0x2c, siz=0x8"` // generation + StartOffset uint64 `bin:"off=0x34, siz=0x8"` // start offset + DevGroup uint32 `bin:"off=0x3c, siz=0x4"` // dev group + SeekSpeed uint8 `bin:"off=0x40, siz=0x1"` // seek speed + Bandwidth uint8 `bin:"off=0x41, siz=0x1"` // bandwidth DevUUID UUID `bin:"off=0x42, siz=0x10"` // device UUID FSUUID UUID `bin:"off=0x52, siz=0x10"` // FS UUID |