diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-05 11:15:55 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-05 11:15:55 -0600 |
commit | b6c0f9893cf69eac1608e769b97fa5fe247af3b8 (patch) | |
tree | ce2745d099dab04dc9dbfa9b0bb63633331e5ca5 /pkg/btrfs | |
parent | 65fe72e1daf67d0c9ca3e460e6ec72e0e4a948fe (diff) |
more
# Conflicts:
# pkg/btrfs/btrfsitem/items.txt
# pkg/btrfs/btrfsitem/items_gen.go
# pkg/btrfs/internal/itemtype.go
Diffstat (limited to 'pkg/btrfs')
-rw-r--r-- | pkg/btrfs/btrfsitem/item_empty.go | 2 | ||||
-rw-r--r-- | pkg/btrfs/btrfsitem/item_freespacebitmap.go | 12 | ||||
-rw-r--r-- | pkg/btrfs/btrfsitem/item_freespaceinfo.go | 11 | ||||
-rw-r--r-- | pkg/btrfs/btrfsitem/item_orphan.go | 9 | ||||
-rw-r--r-- | pkg/btrfs/btrfsitem/items.txt | 5 | ||||
-rw-r--r-- | pkg/btrfs/btrfsitem/items_gen.go | 41 | ||||
-rw-r--r-- | pkg/btrfs/internal/itemtype.go | 6 |
7 files changed, 58 insertions, 28 deletions
diff --git a/pkg/btrfs/btrfsitem/item_empty.go b/pkg/btrfs/btrfsitem/item_empty.go index 5a26104..db7053f 100644 --- a/pkg/btrfs/btrfsitem/item_empty.go +++ b/pkg/btrfs/btrfsitem/item_empty.go @@ -4,6 +4,6 @@ import ( "lukeshu.com/btrfs-tools/pkg/binstruct" ) -type Empty struct { // UNTYPED=0, TREE_BLOCK_REF=176, SHARED_BLOCK_REF=182, QGROUP_RELATION=246 +type Empty struct { // UNTYPED=0, ORPHAN_ITEM=48, TREE_BLOCK_REF=176, SHARED_BLOCK_REF=182, FREE_SPACE_EXTENT=199, QGROUP_RELATION=246 binstruct.End `bin:"off=0"` } diff --git a/pkg/btrfs/btrfsitem/item_freespacebitmap.go b/pkg/btrfs/btrfsitem/item_freespacebitmap.go new file mode 100644 index 0000000..6158eb0 --- /dev/null +++ b/pkg/btrfs/btrfsitem/item_freespacebitmap.go @@ -0,0 +1,12 @@ +package btrfsitem + +type FreeSpaceBitmap []byte // FREE_SPACE_BITMAP=200 + +func (o *FreeSpaceBitmap) UnmarshalBinary(dat []byte) (int, error) { + *o = dat + return len(dat), nil +} + +func (o FreeSpaceBitmap) MarshalBinary() ([]byte, error) { + return []byte(o), nil +} diff --git a/pkg/btrfs/btrfsitem/item_freespaceinfo.go b/pkg/btrfs/btrfsitem/item_freespaceinfo.go new file mode 100644 index 0000000..4931844 --- /dev/null +++ b/pkg/btrfs/btrfsitem/item_freespaceinfo.go @@ -0,0 +1,11 @@ +package btrfsitem + +import ( + "lukeshu.com/btrfs-tools/pkg/binstruct" +) + +type FreeSpaceInfo struct { // FREE_SPACE_INFO=198 + ExtentCount int32 `bin:"off=0, siz=4"` + Flags uint32 `bin:"off=4, siz=4"` + binstruct.End `bin:"off=8"` +} diff --git a/pkg/btrfs/btrfsitem/item_orphan.go b/pkg/btrfs/btrfsitem/item_orphan.go deleted file mode 100644 index 6cf29b0..0000000 --- a/pkg/btrfs/btrfsitem/item_orphan.go +++ /dev/null @@ -1,9 +0,0 @@ -package btrfsitem - -import ( - "lukeshu.com/btrfs-tools/pkg/binstruct" -) - -type Orphan struct { // ORPHAN_ITEM=48 - binstruct.End `bin:"off=0"` -} diff --git a/pkg/btrfs/btrfsitem/items.txt b/pkg/btrfs/btrfsitem/items.txt index e713a80..73bdbe8 100644 --- a/pkg/btrfs/btrfsitem/items.txt +++ b/pkg/btrfs/btrfsitem/items.txt @@ -6,10 +6,13 @@ DIR_INDEX=96, DirList DIR_ITEM=84, DirList EXTENT_DATA_REF=178 ExtentDataRef EXTENT_ITEM=168 Extent +FREE_SPACE_BITMAP=200 FreeSpaceBitmap +FREE_SPACE_EXTENT=199, Empty +FREE_SPACE_INFO=198 FreeSpaceInfo INODE_ITEM=1 Inode INODE_REF=12 InodeRefList METADATA_ITEM=169 Metadata -ORPHAN_ITEM=48 Orphan +ORPHAN_ITEM=48, Empty PERSISTENT_ITEM=249 DevStats QGROUP_RELATION=246 Empty ROOT_ITEM=132 Root diff --git a/pkg/btrfs/btrfsitem/items_gen.go b/pkg/btrfs/btrfsitem/items_gen.go index 063c2e7..27fc5c2 100644 --- a/pkg/btrfs/btrfsitem/items_gen.go +++ b/pkg/btrfs/btrfsitem/items_gen.go @@ -17,6 +17,9 @@ const ( DIR_ITEM_KEY = internal.DIR_ITEM_KEY EXTENT_DATA_REF_KEY = internal.EXTENT_DATA_REF_KEY EXTENT_ITEM_KEY = internal.EXTENT_ITEM_KEY + FREE_SPACE_BITMAP_KEY = internal.FREE_SPACE_BITMAP_KEY + FREE_SPACE_EXTENT_KEY = internal.FREE_SPACE_EXTENT_KEY + FREE_SPACE_INFO_KEY = internal.FREE_SPACE_INFO_KEY INODE_ITEM_KEY = internal.INODE_ITEM_KEY INODE_REF_KEY = internal.INODE_REF_KEY METADATA_ITEM_KEY = internal.METADATA_ITEM_KEY @@ -42,10 +45,13 @@ var keytype2gotype = map[Type]reflect.Type{ DIR_ITEM_KEY: reflect.TypeOf(DirList{}), EXTENT_DATA_REF_KEY: reflect.TypeOf(ExtentDataRef{}), EXTENT_ITEM_KEY: reflect.TypeOf(Extent{}), + FREE_SPACE_BITMAP_KEY: reflect.TypeOf(FreeSpaceBitmap{}), + FREE_SPACE_EXTENT_KEY: reflect.TypeOf(Empty{}), + FREE_SPACE_INFO_KEY: reflect.TypeOf(FreeSpaceInfo{}), INODE_ITEM_KEY: reflect.TypeOf(Inode{}), INODE_REF_KEY: reflect.TypeOf(InodeRefList{}), METADATA_ITEM_KEY: reflect.TypeOf(Metadata{}), - ORPHAN_ITEM_KEY: reflect.TypeOf(Orphan{}), + ORPHAN_ITEM_KEY: reflect.TypeOf(Empty{}), PERSISTENT_ITEM_KEY: reflect.TypeOf(DevStats{}), QGROUP_RELATION_KEY: reflect.TypeOf(Empty{}), ROOT_ITEM_KEY: reflect.TypeOf(Root{}), @@ -58,19 +64,20 @@ var keytype2gotype = map[Type]reflect.Type{ XATTR_ITEM_KEY: reflect.TypeOf(DirList{}), } -func (BlockGroup) isItem() {} -func (Chunk) isItem() {} -func (Dev) isItem() {} -func (DevExtent) isItem() {} -func (DevStats) isItem() {} -func (DirList) isItem() {} -func (Empty) isItem() {} -func (Extent) isItem() {} -func (ExtentDataRef) isItem() {} -func (Inode) isItem() {} -func (InodeRefList) isItem() {} -func (Metadata) isItem() {} -func (Orphan) isItem() {} -func (Root) isItem() {} -func (SharedDataRef) isItem() {} -func (UUIDMap) isItem() {} +func (BlockGroup) isItem() {} +func (Chunk) isItem() {} +func (Dev) isItem() {} +func (DevExtent) isItem() {} +func (DevStats) isItem() {} +func (DirList) isItem() {} +func (Empty) isItem() {} +func (Extent) isItem() {} +func (ExtentDataRef) isItem() {} +func (FreeSpaceBitmap) isItem() {} +func (FreeSpaceInfo) isItem() {} +func (Inode) isItem() {} +func (InodeRefList) isItem() {} +func (Metadata) isItem() {} +func (Root) isItem() {} +func (SharedDataRef) isItem() {} +func (UUIDMap) isItem() {} diff --git a/pkg/btrfs/internal/itemtype.go b/pkg/btrfs/internal/itemtype.go index cc38d94..aa6e4f9 100644 --- a/pkg/btrfs/internal/itemtype.go +++ b/pkg/btrfs/internal/itemtype.go @@ -15,6 +15,9 @@ const ( DIR_ITEM_KEY = ItemType(84) EXTENT_DATA_REF_KEY = ItemType(178) EXTENT_ITEM_KEY = ItemType(168) + FREE_SPACE_BITMAP_KEY = ItemType(200) + FREE_SPACE_EXTENT_KEY = ItemType(199) + FREE_SPACE_INFO_KEY = ItemType(198) INODE_ITEM_KEY = ItemType(1) INODE_REF_KEY = ItemType(12) METADATA_ITEM_KEY = ItemType(169) @@ -41,6 +44,9 @@ func (t ItemType) String() string { DIR_ITEM_KEY: "DIR_ITEM", EXTENT_DATA_REF_KEY: "EXTENT_DATA_REF", EXTENT_ITEM_KEY: "EXTENT_ITEM", + FREE_SPACE_BITMAP_KEY: "FREE_SPACE_BITMAP", + FREE_SPACE_EXTENT_KEY: "FREE_SPACE_EXTENT", + FREE_SPACE_INFO_KEY: "FREE_SPACE_INFO", INODE_ITEM_KEY: "INODE_ITEM", INODE_REF_KEY: "INODE_REF", METADATA_ITEM_KEY: "METADATA_ITEM", |