-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflags.go
67 lines (60 loc) · 1.24 KB
/
flags.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package squashfs
import "strings"
type Flags uint16
const (
UNCOMPRESSED_INODES Flags = 1 << iota
UNCOMPRESSED_DATA
CHECK
UNCOMPRESSED_FRAGMENTS
NO_FRAGMENTS
ALWAYS_FRAGMENTS
DUPLICATES
EXPORTABLE
UNCOMPRESSED_XATTRS
NO_XATTRS
COMPRESSOR_OPTIONS
UNCOMPRESSED_IDS
)
func (f Flags) String() string {
var opt []string
if f&UNCOMPRESSED_INODES != 0 {
opt = append(opt, "UNCOMPRESSED_INODES")
}
if f&UNCOMPRESSED_DATA != 0 {
opt = append(opt, "UNCOMPRESSED_DATA")
}
if f&CHECK != 0 {
opt = append(opt, "CHECK")
}
if f&UNCOMPRESSED_FRAGMENTS != 0 {
opt = append(opt, "UNCOMPRESSED_FRAGMENTS")
}
if f&NO_FRAGMENTS != 0 {
opt = append(opt, "NO_FRAGMENTS")
}
if f&ALWAYS_FRAGMENTS != 0 {
opt = append(opt, "ALWAYS_FRAGMENTS")
}
if f&DUPLICATES != 0 {
opt = append(opt, "DUPLICATES")
}
if f&EXPORTABLE != 0 {
opt = append(opt, "EXPORTABLE")
}
if f&UNCOMPRESSED_XATTRS != 0 {
opt = append(opt, "UNCOMPRESSED_XATTRS")
}
if f&NO_XATTRS != 0 {
opt = append(opt, "NO_XATTRS")
}
if f&COMPRESSOR_OPTIONS != 0 {
opt = append(opt, "COMPRESSOR_OPTIONS")
}
if f&UNCOMPRESSED_IDS != 0 {
opt = append(opt, "UNCOMPRESSED_IDS")
}
return strings.Join(opt, "|")
}
func (f Flags) Has(what Flags) bool {
return f&what == what
}