diff options
Diffstat (limited to 'pkg/btrfs/btrfsitem/item_blockgroup.go')
-rw-r--r-- | pkg/btrfs/btrfsitem/item_blockgroup.go | 15 |
1 files changed, 14 insertions, 1 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 +} |