-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloneflags.go
More file actions
37 lines (28 loc) · 812 Bytes
/
cloneflags.go
File metadata and controls
37 lines (28 loc) · 812 Bytes
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
package reflink
// CloneFlags are the flags
type CloneFlags int
// Available clone flags
const (
// Preserve file permissions
PreserveMode CloneFlags = 1
// Preserve file owner
PreserveOwner CloneFlags = 1 << 1
// Preserve file times
PreserveTimes CloneFlags = 1 << 2
// Don't return an error if mode / owner / times cannot be set on target file
FailSafe CloneFlags = 1 << 6
// Delete the target file if the operation fails
UnlinkOnFailure CloneFlags = 1 << 7
)
// Set returns a copy of cf with f set
func (cf CloneFlags) Set(f CloneFlags) CloneFlags {
return cf | f
}
// UnSet returns a copy of cf with f unset
func (cf CloneFlags) UnSet(f CloneFlags) CloneFlags {
return cf & ^f
}
// IsSet returns whether f is set on cf
func (cf CloneFlags) IsSet(f CloneFlags) bool {
return cf&f != 0
}