summaryrefslogtreecommitdiff
path: root/pkg/btrfs/bitfields.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-05-24 21:53:28 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-05-24 21:53:28 -0600
commit23ab1f8be6a1f4b5ce01e05f8ed3f6b5dae30d0b (patch)
tree854801aa60dd204cd390c40f7cafb326e981014f /pkg/btrfs/bitfields.go
parentb0dd4d1f0c8262e3680570d529d00c9ebead1a91 (diff)
stuff
Diffstat (limited to 'pkg/btrfs/bitfields.go')
-rw-r--r--pkg/btrfs/bitfields.go68
1 files changed, 0 insertions, 68 deletions
diff --git a/pkg/btrfs/bitfields.go b/pkg/btrfs/bitfields.go
deleted file mode 100644
index ead4b0f..0000000
--- a/pkg/btrfs/bitfields.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package btrfs
-
-import (
- "fmt"
- "strings"
-)
-
-func bitfieldString[T ~uint8 | ~uint16 | ~uint32 | ~uint64](bitfield T, bitnames []string) string {
- if bitfield == 0 {
- return "0"
- }
- var out strings.Builder
- fmt.Fprintf(&out, "(0x%0X)", uint64(bitfield))
- rest := bitfield
- sep := ' '
- for i := 0; rest != 0; i++ {
- if rest&(1<<i) != 0 {
- out.WriteRune(sep)
- if i < len(bitnames) {
- out.WriteString(bitnames[i])
- } else {
- fmt.Fprintf(&out, "(1<<%d)", i)
- }
- sep = '|'
- }
- rest &^= 1 << i
- }
- return out.String()
-}
-
-type IncompatFlags uint64
-
-const (
- FeatureIncompatMixedBackref = IncompatFlags(1 << iota)
- FeatureIncompatDefaultSubvol
- FeatureIncompatMixedGroups
- FeatureIncompatCompressLZO
- FeatureIncompatCompressZSTD
- FeatureIncompatBigMetadata // buggy
- FeatureIncompatExtendedIRef
- FeatureIncompatRAID56
- FeatureIncompatSkinnyMetadata
- FeatureIncompatNoHoles
- FeatureIncompatMetadataUUID
- FeatureIncompatRAID1C34
- FeatureIncompatZoned
- FeatureIncompatExtentTreeV2
-)
-
-var incompatFlagNames = []string{
- "FeatureIncompatMixedBackref",
- "FeatureIncompatDefaultSubvol",
- "FeatureIncompatMixedGroups",
- "FeatureIncompatCompressLZO",
- "FeatureIncompatCompressZSTD",
- "FeatureIncompatBigMetadata ",
- "FeatureIncompatExtendedIRef",
- "FeatureIncompatRAID56",
- "FeatureIncompatSkinnyMetadata",
- "FeatureIncompatNoHoles",
- "FeatureIncompatMetadataUUID",
- "FeatureIncompatRAID1C34",
- "FeatureIncompatZoned",
- "FeatureIncompatExtentTreeV2",
-}
-
-func (f IncompatFlags) Has(req IncompatFlags) bool { return f&req == req }
-func (f IncompatFlags) String() string { return bitfieldString(f, incompatFlagNames) }