diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-10-17 00:15:06 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-12-20 19:58:11 -0700 |
commit | 53a2ce3b4dcbfd17ac15230da17130a2aeae42dc (patch) | |
tree | 4d915a8ae475b82f53014b2c8c90a31932794168 /lib/btrfs/btrfsitem/item_freespaceinfo.go | |
parent | 85169c799b4a0d4ba7d39347c07690dc0b49a1d1 (diff) |
Add and improve comments
Diffstat (limited to 'lib/btrfs/btrfsitem/item_freespaceinfo.go')
-rw-r--r-- | lib/btrfs/btrfsitem/item_freespaceinfo.go | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/btrfs/btrfsitem/item_freespaceinfo.go b/lib/btrfs/btrfsitem/item_freespaceinfo.go index 844f664..b38da20 100644 --- a/lib/btrfs/btrfsitem/item_freespaceinfo.go +++ b/lib/btrfs/btrfsitem/item_freespaceinfo.go @@ -6,10 +6,28 @@ package btrfsitem import ( "git.lukeshu.com/btrfs-progs-ng/lib/binstruct" + "git.lukeshu.com/btrfs-progs-ng/lib/fmtutil" ) +// key.objectid = object ID of the BlockGroup (logical_addr) +// key.offset = offset of the BlockGroup (size) type FreeSpaceInfo struct { // FREE_SPACE_INFO=198 - ExtentCount int32 `bin:"off=0, siz=4"` - Flags uint32 `bin:"off=4, siz=4"` + ExtentCount int32 `bin:"off=0, siz=4"` + Flags FreeSpaceFlags `bin:"off=4, siz=4"` binstruct.End `bin:"off=8"` } + +type FreeSpaceFlags uint32 + +const ( + FREE_SPACE_USING_BITMAPS = FreeSpaceFlags(1 << iota) +) + +var freeSpaceFlagNames = []string{ + "USING_BITMAPS", +} + +func (f FreeSpaceFlags) Has(req FreeSpaceFlags) bool { return f&req == req } +func (f FreeSpaceFlags) String() string { + return fmtutil.BitfieldString(f, freeSpaceFlagNames, fmtutil.HexNone) +} |