diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-05 10:02:53 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-06-05 10:02:53 -0600 |
commit | 30a2a24901e024dba8b40ca4102af9b4e64718c8 (patch) | |
tree | 3c1bbf225e220455bfb2411fbcf60bc4a7da3f5a /pkg/btrfs | |
parent | ba31d3a4a48ca96517db50cdfa7d71b7721c5b55 (diff) |
fuss with formatting
Diffstat (limited to 'pkg/btrfs')
-rw-r--r-- | pkg/btrfs/btrfsitem/item_blockgroup.go | 15 | ||||
-rw-r--r-- | pkg/btrfs/btrfsitem/item_dir.go | 2 | ||||
-rw-r--r-- | pkg/btrfs/btrfsitem/item_extent.go | 2 | ||||
-rw-r--r-- | pkg/btrfs/btrfsitem/item_inode.go | 2 | ||||
-rw-r--r-- | pkg/btrfs/btrfsitem/item_root.go | 2 | ||||
-rw-r--r-- | pkg/btrfs/types_btree.go | 2 | ||||
-rw-r--r-- | pkg/btrfs/types_superblock.go | 2 |
7 files changed, 20 insertions, 7 deletions
diff --git a/pkg/btrfs/btrfsitem/item_blockgroup.go b/pkg/btrfs/btrfsitem/item_blockgroup.go index 565aae8..a28d4bf 100644 --- a/pkg/btrfs/btrfsitem/item_blockgroup.go +++ b/pkg/btrfs/btrfsitem/item_blockgroup.go @@ -27,12 +27,15 @@ const ( BLOCK_GROUP_RAID6 BLOCK_GROUP_RAID1C3 BLOCK_GROUP_RAID1C4 + + BLOCK_GROUP_RAID_MASK = (BLOCK_GROUP_RAID1 | BLOCK_GROUP_DUP | BLOCK_GROUP_RAID10 | BLOCK_GROUP_RAID5 | BLOCK_GROUP_RAID6 | BLOCK_GROUP_RAID1C3 | BLOCK_GROUP_RAID1C4) ) var blockGroupFlagNames = []string{ "DATA", "SYSTEM", "METADATA", + "RAID0", "RAID1", "DUP", @@ -44,4 +47,14 @@ var blockGroupFlagNames = []string{ } func (f BlockGroupFlags) Has(req BlockGroupFlags) bool { return f&req == req } -func (f BlockGroupFlags) String() string { return util.BitfieldString(f, blockGroupFlagNames) } +func (f BlockGroupFlags) String() string { + ret := util.BitfieldString(f, blockGroupFlagNames, util.HexNone) + if f&BLOCK_GROUP_RAID_MASK == 0 { + if ret == "" { + ret = "single" + } else { + ret += "|single" + } + } + return ret +} diff --git a/pkg/btrfs/btrfsitem/item_dir.go b/pkg/btrfs/btrfsitem/item_dir.go index 44cfb75..afef12d 100644 --- a/pkg/btrfs/btrfsitem/item_dir.go +++ b/pkg/btrfs/btrfsitem/item_dir.go @@ -88,7 +88,7 @@ const ( func (ft FileType) String() string { names := map[FileType]string{ FT_UNKNOWN: "UNKNOWN", - FT_REG_FILE: "REG_FILE", + FT_REG_FILE: "FILE", // XXX FT_DIR: "DIR", FT_CHRDEV: "CHRDEV", FT_BLKDEV: "BLKDEV", diff --git a/pkg/btrfs/btrfsitem/item_extent.go b/pkg/btrfs/btrfsitem/item_extent.go index b0b208d..a86c2bd 100644 --- a/pkg/btrfs/btrfsitem/item_extent.go +++ b/pkg/btrfs/btrfsitem/item_extent.go @@ -87,7 +87,7 @@ var extentFlagNames = []string{ } func (f ExtentFlags) Has(req ExtentFlags) bool { return f&req == req } -func (f ExtentFlags) String() string { return util.BitfieldString(f, extentFlagNames) } +func (f ExtentFlags) String() string { return util.BitfieldString(f, extentFlagNames, util.HexNone) } type ExtentInlineRef struct { Type Type `bin:"off=0, siz=1"` diff --git a/pkg/btrfs/btrfsitem/item_inode.go b/pkg/btrfs/btrfsitem/item_inode.go index e7ae666..81ed658 100644 --- a/pkg/btrfs/btrfsitem/item_inode.go +++ b/pkg/btrfs/btrfsitem/item_inode.go @@ -60,4 +60,4 @@ var inodeFlagNames = []string{ } func (f InodeFlags) Has(req InodeFlags) bool { return f&req == req } -func (f InodeFlags) String() string { return util.BitfieldString(f, inodeFlagNames) } +func (f InodeFlags) String() string { return util.BitfieldString(f, inodeFlagNames, util.HexLower) } diff --git a/pkg/btrfs/btrfsitem/item_root.go b/pkg/btrfs/btrfsitem/item_root.go index 69d2d97..86fdabe 100644 --- a/pkg/btrfs/btrfsitem/item_root.go +++ b/pkg/btrfs/btrfsitem/item_root.go @@ -47,4 +47,4 @@ var rootFlagNames = []string{ } func (f RootFlags) Has(req RootFlags) bool { return f&req == req } -func (f RootFlags) String() string { return util.BitfieldString(f, rootFlagNames) } +func (f RootFlags) String() string { return util.BitfieldString(f, rootFlagNames, util.HexLower) } diff --git a/pkg/btrfs/types_btree.go b/pkg/btrfs/types_btree.go index 0be7b48..8ec1c9f 100644 --- a/pkg/btrfs/types_btree.go +++ b/pkg/btrfs/types_btree.go @@ -72,7 +72,7 @@ var nodeFlagNames = []string{ } func (f NodeFlags) Has(req NodeFlags) bool { return f&req == req } -func (f NodeFlags) String() string { return util.BitfieldString(f, nodeFlagNames) } +func (f NodeFlags) String() string { return util.BitfieldString(f, nodeFlagNames, util.HexLower) } type KeyPointer struct { Key Key `bin:"off=0x0, siz=0x11"` diff --git a/pkg/btrfs/types_superblock.go b/pkg/btrfs/types_superblock.go index 609ebc6..ec8b497 100644 --- a/pkg/btrfs/types_superblock.go +++ b/pkg/btrfs/types_superblock.go @@ -226,4 +226,4 @@ var incompatFlagNames = []string{ } func (f IncompatFlags) Has(req IncompatFlags) bool { return f&req == req } -func (f IncompatFlags) String() string { return util.BitfieldString(f, incompatFlagNames) } +func (f IncompatFlags) String() string { return util.BitfieldString(f, incompatFlagNames, util.HexLower) } |