Documentation
¶
Index ¶
- Constants
- Variables
- func CloneFile(dst, src *os.File) error
- func CreateSubVolume(path string) error
- func DeleteSubVolume(path string) error
- func IsReadOnly(path string) (bool, error)
- func IsSubVolume(path string) (bool, error)
- func Receive(r io.Reader, dstDir string) error
- func Send(w io.Writer, parent string, subvols ...string) error
- func SetCompression(path string, v Compression) error
- func SnapshotSubVolume(subvol, dst string, ro bool) error
- type BalanceFlags
- type BalanceProgress
- type BalanceState
- type Compression
- type DevInfo
- type DevStats
- type ErrCode
- type ErrNotBtrfs
- type FS
- func (f *FS) Balance(flags BalanceFlags) (BalanceProgress, error)
- func (f *FS) Close() error
- func (f *FS) CreateSubVolume(name string) error
- func (f *FS) DeleteSubVolume(name string) error
- func (f *FS) GetDevInfo(id uint64) (out DevInfo, err error)
- func (f *FS) GetDevStats(id uint64) (out DevStats, err error)
- func (f *FS) GetFeatures() (out FSFeatureFlags, err error)
- func (f *FS) GetFlags() (SubvolFlags, error)
- func (f *FS) GetSupportedFeatures() (out FSFeatureFlags, err error)
- func (f *FS) Info() (out Info, err error)
- func (f *FS) ListSubvolumes(filter func(SubvolInfo) bool) ([]SubvolInfo, error)
- func (f *FS) Receive(r io.Reader) error
- func (f *FS) ReceiveTo(r io.Reader, mount string) error
- func (f *FS) Resize(size int64) error
- func (f *FS) ResizeToMax() error
- func (f *FS) Send(w io.Writer, parent string, subvols ...string) error
- func (f *FS) SetFlags(flags SubvolFlags) error
- func (f *FS) Snapshot(dst string, ro bool) error
- func (f *FS) SnapshotSubVolume(name string, dst string, ro bool) error
- func (f *FS) SubVolumeID() (uint64, error)
- func (f *FS) SubvolumeByPath(path string) (*SubvolInfo, error)
- func (f *FS) SubvolumeByReceivedUUID(uuid UUID) (*SubvolInfo, error)
- func (f *FS) SubvolumeByUUID(uuid UUID) (*SubvolInfo, error)
- func (f *FS) Sync() (err error)
- func (f *FS) Usage() (UsageInfo, error)
- type FSFeatureFlags
- type FSID
- type FeatureFlags
- type IncompatFeatures
- type Info
- type SubvolFlags
- type SubvolInfo
- type UUID
- type UsageInfo
Constants ¶
View Source
const ( FeatureIncompatMixedBackRef = IncompatFeatures(1 << 0) FeatureIncompatDefaultSubvol = IncompatFeatures(1 << 1) FeatureIncompatMixedGroups = IncompatFeatures(1 << 2) FeatureIncompatCompressLZO = IncompatFeatures(1 << 3) // Some patches floated around with a second compression method // lets save that incompat here for when they do get in. // Note we don't actually support it, we're just reserving the number. FeatureIncompatCompressLZOv2 = IncompatFeatures(1 << 4) // Older kernels tried to do bigger metadata blocks, but the // code was pretty buggy. Lets not let them try anymore. FeatureIncompatBigMetadata = IncompatFeatures(1 << 5) FeatureIncompatExtendedIRef = IncompatFeatures(1 << 6) FeatureIncompatRAID56 = IncompatFeatures(1 << 7) FeatureIncompatSkinnyMetadata = IncompatFeatures(1 << 8) FeatureIncompatNoHoles = IncompatFeatures(1 << 9) )
View Source
const ( BalanceData = BalanceFlags(1 << 0) BalanceSystem = BalanceFlags(1 << 1) BalanceMetadata = BalanceFlags(1 << 2) BalanceMask = (BalanceData | BalanceSystem | BalanceMetadata) BalanceForce = BalanceFlags(1 << 3) BalanceResume = BalanceFlags(1 << 4) )
Restriper's general type filter.
View Source
const ( ErrDevRAID1MinNotMet = ErrCode(iota + 1) ErrDevRAID10MinNotMet ErrDevRAID5MinNotMet ErrDevRAID6MinNotMet ErrDevTargetReplace ErrDevMissingNotFound ErrDevOnlyWritable ErrDevExclRunInProgress )
View Source
const ( FSIDSize = 16 UUIDSize = 16 )
View Source
const ( SubvolRootReadOnly = SubvolFlags(1 << 0) // BTRFS_ROOT_SUBVOL_RDONLY, only present in search result copies SubvolReadOnly = SubvolFlags(1 << 1) // BTRFS_SUBVOL_RDONLY )
flags for subvolumes
Used by: struct btrfs_ioctl_vol_args_v2.flags
BTRFS_SUBVOL_RDONLY is also provided/consumed by the following ioctls: - BTRFS_IOC_SUBVOL_GETFLAGS - BTRFS_IOC_SUBVOL_SETFLAGS
View Source
const ( CompressionNone = Compression("") LZO = Compression("lzo") ZLIB = Compression("zlib") )
View Source
const (
FeatureCompatROFreeSpaceTree = FeatureFlags(1 << 0)
)
View Source
const SuperMagic uint32 = 0x9123683E
Variables ¶
View Source
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
func CreateSubVolume ¶
func DeleteSubVolume ¶
func IsReadOnly ¶
func IsSubVolume ¶
func SetCompression ¶
func SetCompression(path string, v Compression) error
func SnapshotSubVolume ¶
Types ¶
type BalanceProgress ¶
type BalanceProgress struct { Expected uint64 // estimated # of chunks that will be relocated to fulfill the request Considered uint64 // # of chunks we have considered so far Completed uint64 // # of chunks relocated so far }
Report balance progress to userspace.
btrfs_balance_progress
type BalanceState ¶
type BalanceState uint64
const ( BalanceStateRunning BalanceState = (1 << 0) BalanceStatePauseReq BalanceState = (1 << 1) BalanceStateCancelReq BalanceState = (1 << 2) )
type Compression ¶
type Compression string
func GetCompression ¶
func GetCompression(path string) (Compression, error)
type DevStats ¶
type DevStats struct { WriteErrs uint64 ReadErrs uint64 FlushErrs uint64 // Checksum error, bytenr error or contents is illegal: this is an // indication that the block was damaged during read or write, or written to // wrong location or read from wrong location. CorruptionErrs uint64 // An indication that blocks have not been written. GenerationErrs uint64 Unknown []uint64 }
type ErrNotBtrfs ¶
type ErrNotBtrfs struct {
Path string
}
func (ErrNotBtrfs) Error ¶
func (e ErrNotBtrfs) Error() string
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
func (*FS) Balance ¶
func (f *FS) Balance(flags BalanceFlags) (BalanceProgress, error)
func (*FS) CreateSubVolume ¶
func (*FS) DeleteSubVolume ¶
func (*FS) GetFeatures ¶
func (f *FS) GetFeatures() (out FSFeatureFlags, err error)
func (*FS) GetFlags ¶
func (f *FS) GetFlags() (SubvolFlags, error)
func (*FS) GetSupportedFeatures ¶
func (f *FS) GetSupportedFeatures() (out FSFeatureFlags, err error)
func (*FS) ListSubvolumes ¶
func (f *FS) ListSubvolumes(filter func(SubvolInfo) bool) ([]SubvolInfo, error)
func (*FS) ResizeToMax ¶
func (*FS) SetFlags ¶
func (f *FS) SetFlags(flags SubvolFlags) error
func (*FS) SnapshotSubVolume ¶
func (*FS) SubVolumeID ¶
func (*FS) SubvolumeByPath ¶
func (f *FS) SubvolumeByPath(path string) (*SubvolInfo, error)
func (*FS) SubvolumeByReceivedUUID ¶
func (f *FS) SubvolumeByReceivedUUID(uuid UUID) (*SubvolInfo, error)
func (*FS) SubvolumeByUUID ¶
func (f *FS) SubvolumeByUUID(uuid UUID) (*SubvolInfo, error)
type FSFeatureFlags ¶
type FSFeatureFlags struct { Compatible FeatureFlags CompatibleRO FeatureFlags Incompatible IncompatFeatures }
type FeatureFlags ¶
type FeatureFlags uint64
type IncompatFeatures ¶
type IncompatFeatures uint64
func (IncompatFeatures) String ¶
func (f IncompatFeatures) String() string
type SubvolFlags ¶
type SubvolFlags uint64
func GetFlags ¶
func GetFlags(path string) (SubvolFlags, error)
func (SubvolFlags) ReadOnly ¶
func (f SubvolFlags) ReadOnly() bool
func (SubvolFlags) String ¶
func (f SubvolFlags) String() string
type SubvolInfo ¶
type UsageInfo ¶
type UsageInfo struct { Total uint64 TotalUnused uint64 TotalUsed uint64 TotalChunks uint64 FreeEstimated uint64 FreeMin uint64 LogicalDataChunks uint64 RawDataChunks uint64 RawDataUsed uint64 LogicalMetaChunks uint64 RawMetaChunks uint64 RawMetaUsed uint64 SystemUsed uint64 SystemChunks uint64 DataRatio float64 MetadataRatio float64 GlobalReserve uint64 GlobalReserveUsed uint64 }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.