btrfs

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2022 License: LGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package btrfs contains low-level bindings to the Btrfs filesystem. Most of the types and ioctl constants are generated from the Btrfs kernel headers.

Index

Constants

View Source
const (
	IOC_NONE  = 0x0
	IOC_WRITE = 0x1
	IOC_READ  = 0x2

	IOC_NRBITS   = 8
	IOC_TYPEBITS = 8

	IOC_SIZEBITS = 14
	IOC_DIRBITS  = 2

	IOC_NRSHIFT   = 0
	IOC_TYPESHIFT = IOC_NRSHIFT + IOC_NRBITS
	IOC_SIZESHIFT = IOC_TYPESHIFT + IOC_TYPEBITS
	IOC_DIRSHIFT  = IOC_SIZESHIFT + IOC_SIZEBITS

	IOC_NRMASK   = ((1 << IOC_NRBITS) - 1)
	IOC_TYPEMASK = ((1 << IOC_TYPEBITS) - 1)
	IOC_SIZEMASK = ((1 << IOC_SIZEBITS) - 1)
	IOC_DIRMASK  = ((1 << IOC_DIRBITS) - 1)
)

Generic ioctl constants

View Source
const (
	SubvolReadOnly = 0x2

	NoFileData       = 0x1
	OmitStreamHeader = 0x2
	OmitEndCommand   = 0x3
	SendVersion      = 0x8
	SendCompressed   = 0x10

	RootTreeObjectID       ObjectID = 0x1
	ExtentTreeObjectID     ObjectID = 0x2
	ChunkTreeObjectID      ObjectID = 0x3
	DevTreeObjectID        ObjectID = 0x4
	FSTreeObjectID         ObjectID = 0x5
	RootTreeDirObjectID    ObjectID = 0x6
	CSumTreeObjectID       ObjectID = 0x7
	QuotaTreeObjectID      ObjectID = 0x8
	UUIDTreeObjectID       ObjectID = 0x9
	FreeSpaceTreeObjectID  ObjectID = 0xa
	BlockGroupTreeObjectID ObjectID = 0xb
	DevStatsObjectID       ObjectID = 0x0
	BalanceObjectID        ObjectID = 0xfffffffffffffffc
	OrphanObjectID         ObjectID = 0xfffffffffffffffb
	TreeLogObjectID        ObjectID = 0xfffffffffffffffa
	TreeLogFixupObjectID   ObjectID = 0xfffffffffffffff9
	TreeRelocObjectID      ObjectID = 0xfffffffffffffff8
	DataRelocTreeObjectID  ObjectID = 0xfffffffffffffff7
	ExtentCSumObjectID     ObjectID = 0xfffffffffffffff6
	FreeSpaceObjectID      ObjectID = 0xfffffffffffffff5
	FreeInoObjectID        ObjectID = 0xfffffffffffffff4
	MultipleObjectIDs      ObjectID = 0xffffffffffffff01

	FirstFreeObjectID ObjectID = 0x100
	LastFreeObjectID  ObjectID = 0xffffffffffffff00
	DevItemsObjectID  ObjectID = 0x1

	DeviceItemKey  SearchKey = 0xd8
	DirItemKey     SearchKey = 0x54
	InodeRefKey    SearchKey = 0xc
	InodeItemKey   SearchKey = 0x1
	RootItemKey    SearchKey = 0x84
	RootRefKey     SearchKey = 0x9c
	RootBackrefKey SearchKey = 0x90

	CompressionNone   CompressionType = 0x0
	CompressionZLib   CompressionType = 0x1
	CompressionZSTD   CompressionType = 0x2
	CompressionLZO4k  CompressionType = 0x3
	CompressionLZO8k  CompressionType = 0x4
	CompressionLZO16k CompressionType = 0x5
	CompressionLZO32k CompressionType = 0x6
	CompressionLZO64k CompressionType = 0x7
)
View Source
const (
	BTRFS_IOCTL_MAGIC uintptr = 0x94
)

BTRFS ioctl constants

View Source
const BTRFS_SUPER_MAGIC = 0x9123683E

Variables

View Source
var (
	ErrInvalidUUID = errors.New("invalid UUID")
	ErrNotFound    = errors.New("not found")
)
View Source
var (
	ErrEncryptionNotSupported = errors.New("encryption not supported")
)
View Source
var (
	// ErrRootMountNotFound is returned when a root mount cannot be found for a given path.
	ErrRootMountNotFound = fmt.Errorf("could not find root mount for path")
)
View Source
var ErrStopTreeIteration = fmt.Errorf("stop tree iteration")
View Source
var ErrStopWalk = fmt.Errorf("stop btrfs walk")

ErrStopWalk is an error that can be returned by the TreeIterFunc to stop the tree walk.

Functions

func Clone

func Clone(src string, dest string, srcOffset uint64, destOffset uint64, size uint64) error

Clone clones a range of bytes from a source file to a destination file.

func CreateSnapshot

func CreateSnapshot(source string, opts ...SnapshotOption) error

CreateSnapshot creates a snapshot of the given subvolume with the given options.

func CreateSubvolume

func CreateSubvolume(path string) error

CreateSubvolume creates a subvolume at the given path.

func DeleteSnapshot

func DeleteSnapshot(path string) error

DeleteSnapshot deletes the given snapshot.

func DeleteSubvolume

func DeleteSubvolume(path string, force bool) error

DeleteSubvolume deletes the subvolume at the given path. If the subvolume is read-only then it will be made read-write before deletion.

func EnableVerity

func EnableVerity(path string, algorithm uint32, blockSize uint32, salt []byte, sig []byte) error

EnableVerity enables fs-verity on a path.

func EncodedWrite

func EncodedWrite(path string, op *EncodedWriteOp) error

EncodedWrite writes encoded data to a file via ioctl.

func FindDeviceForMount added in v0.0.6

func FindDeviceForMount(mount string) (string, error)

FindDeviceForMount returns the device for the given mount. In most circumstances this is analogous (but more expensive than) to calling FindRootMount.

func IsBtrfs added in v0.0.4

func IsBtrfs(path string) (bool, error)

IsBtrfs returns true if the given path is a btrfs mount.

func IsSubvolume

func IsSubvolume(path string) (bool, error)

IsSubvolume returns true if the given path is a subvolume.

func IsSubvolumeReadOnly

func IsSubvolumeReadOnly(path string) (bool, error)

IsSubvolumeReadOnly returns true if the subvolume at the given path is read-only.

func Send

func Send(source string, opts ...SendOption) error

Send will send the snapshot at source with the given options. Source must be a path to a read-only snapshot.

func SetReceivedSubvolume

func SetReceivedSubvolume(path string, uuid uuid.UUID, ctransid uint64) error

SetReceivedSubvolume sets the received UUID and ctransid for a subvolume. This method is intended for use by receive operations.

func SetSubvolumeReadOnly

func SetSubvolumeReadOnly(path string, readonly bool) error

SetSubvolumeReadOnly sets the read-only status of the subvolume at the given path to readonly.

func SyncFilesystem

func SyncFilesystem(path string) error

SyncFilesystem runs an I/O sync on the filesystem at the given path. If the path is not a BTRFS filesystem, an error will be returned.

func UUIDTreeLookupID

func UUIDTreeLookupID(path string, uuid uuid.UUID, typ LookupType) (id uint64, err error)

UUIDTreeLookupID looks up the subvolume ID for the given UUID.

func WalkBtrfsTree

func WalkBtrfsTree(path string, params SearchParams, fn TreeIterFunc) error

WalkBtrfsTree walks the Btrfs tree at the given path with the given search arguments. The TreeIterFunc is called for each item found in the tree.

Types

type BtrfsDevItem added in v0.0.6

type BtrfsDevItem struct {
	Devid       uint64
	Total_bytes uint64
	Bytes_used  uint64
	Io_align    uint32
	Io_width    uint32
	Sector_size uint32
	Dev_group   uint32
	Seek_speed  uint8
	Bandwidth   uint8
	Uuid        [16]uint8
	Fsid        [16]uint8
}

type BtrfsDirItem

type BtrfsDirItem struct {
	Location BtrfsDiskKey
	Type     uint8
}

type BtrfsDiskKey

type BtrfsDiskKey struct {
	Objectid uint64
	Type     uint8
	Offset   uint64
}

type BtrfsInodeItem

type BtrfsInodeItem struct {
	Generation uint64
	Transid    uint64
	Size       uint64
	Nbytes     uint64
	Group      uint64
	Nlink      uint32
	Uid        uint32
	Gid        uint32
	Mode       uint32
	Rdev       uint64
	Flags      uint64
	Sequence   uint64
	Reserved   [4]uint64
	Atime      BtrfsTimespec
	Ctime      BtrfsTimespec
	Mtime      BtrfsTimespec
	Otime      BtrfsTimespec
}

type BtrfsInodeRef

type BtrfsInodeRef struct {
	Index uint64
	Len   uint16
}

type BtrfsMount added in v0.0.6

type BtrfsMount struct {
	Path    string
	Device  string
	Options []string
}

BtrfsMount represents a mounted Btrfs filesystem.

func FindMountForDevice added in v0.0.6

func FindMountForDevice(device string) (*BtrfsMount, error)

FindMountForDevice returns the mount for the given device.

func FindRootMount

func FindRootMount(path string) (*BtrfsMount, error)

FindRootMount returns the root btrfs mount for the given path.

func ListBtrfsMounts added in v0.0.5

func ListBtrfsMounts() ([]*BtrfsMount, error)

ListBtrfsMounts returns a list of all btrfs mounts on the system.

func (*BtrfsMount) DeviceInfo added in v0.0.6

func (b *BtrfsMount) DeviceInfo() (*DeviceInfo, error)

func (*BtrfsMount) DeviceStats added in v0.0.6

func (b *BtrfsMount) DeviceStats() (*DeviceStats, error)

func (*BtrfsMount) String added in v0.0.6

func (b *BtrfsMount) String() string

type BtrfsRootItem

type BtrfsRootItem struct {
	Inode          BtrfsInodeItem
	Generation     uint64
	Root_dirid     uint64
	Bytenr         uint64
	Byte_limit     uint64
	Bytes_used     uint64
	Last_snapshot  uint64
	Flags          uint64
	Refs           uint32
	DropProgress   BtrfsDiskKey
	Drop_level     uint8
	Level          uint8
	GenerationV2   uint64
	Uuid           [16]uint8
	Parent_uuid    [16]uint8
	Received_uuid  [16]uint8
	Ctransid       uint64
	Otransid       uint64
	Stransid       uint64
	Rtransid       uint64
	Ctime          BtrfsTimespec
	Otime          BtrfsTimespec
	Stime          BtrfsTimespec
	Rtime          BtrfsTimespec
	Global_tree_id uint64
	Reserved       [7]uint64
}

type BtrfsRootItem_V0

type BtrfsRootItem_V0 struct {
	Inode        BtrfsInodeItem
	Generation   uint64
	RootDirID    uint64
	ByteNR       uint64
	ByteLimit    uint64
	BytesUsed    uint64
	LastSnapshot uint64
	Flags        uint64
	Refs         uint32
	DropProgress BtrfsDiskKey
	DropLevel    uint8
	Level        uint8
}

type BtrfsRootRef

type BtrfsRootRef struct {
	Dirid    uint64
	Sequence uint64
	Len      uint16
}

type BtrfsTimespec

type BtrfsTimespec struct {
	Sec  uint64
	Nsec uint32
}

func (BtrfsTimespec) Time added in v0.0.5

func (b BtrfsTimespec) Time() time.Time

type CompressionType

type CompressionType uint32

func (CompressionType) String

func (i CompressionType) String() string

type DeviceInfo

type DeviceInfo struct {
	DeviceID   uint64
	UUID       uuid.UUID
	BytesUsed  uint64
	TotalBytes uint64
	Path       string
}

func GetDeviceInfo

func GetDeviceInfo(path string) (*DeviceInfo, error)

GetDeviceInfo returns information about the device at the given path or device.

type DeviceStats added in v0.0.6

type DeviceStats struct {
	WriteIOErrors    uint64
	ReadIOErrors     uint64
	FlushIOErrors    uint64
	CorruptionErrors uint64
	GenerationErrors uint64
}

func GetDeviceStats added in v0.0.6

func GetDeviceStats(path string) (*DeviceStats, error)

GetDeviceStats returns statistics about the device at the given path or device.

type EncodedWriteOp

type EncodedWriteOp struct {
	Offset              uint64
	Data                []byte
	UnencodedFileLength uint64
	UnencodedLength     uint64
	UnencodedOffset     uint64
	Compression         CompressionType
	Encryption          uint32 // Not supported yet
}

EncodedWriteOp is an operation to write encoded data to a file.

func (*EncodedWriteOp) Decompress

func (e *EncodedWriteOp) Decompress() ([]byte, error)

Decompress decompresses the data in the EncodedWriteOp.

type FilesystemInfo

type FilesystemInfo struct {
	MaxID        uint64
	NumDevices   uint64
	FSID         uuid.UUID
	NodeSize     uint32
	SectorSize   uint32
	CloneAlign   uint32
	CsumType     uint16
	CsumSize     uint16
	Flags        uint64
	Generate     uint64
	MetadataUUID uuid.UUID
}

func GetFilesystemInfo

func GetFilesystemInfo(path string) (*FilesystemInfo, error)

GetFilesystemInfo returns metadata about the filesystem at the given path. If the path is not a BTRFS filesystem, an error will be returned.

type IoctlCmd

type IoctlCmd uintptr

IoctlCmd is a type cast of uintptr to make it more clear that it is an ioctl.

const (
	FS_IOC_ENABLE_VERITY        IoctlCmd = 0x40806685
	FS_IOC_MEASURE_VERITY       IoctlCmd = 0xc0046686
	FS_IOC_READ_VERITY_METADATA IoctlCmd = 0xc0286687
)

Fsverity ioctl commands

const (
	BTRFS_IOC_SNAP_CREATE         IoctlCmd = 0x50009401
	BTRFS_IOC_DEFRAG              IoctlCmd = 0x50009402
	BTRFS_IOC_RESIZE              IoctlCmd = 0x50009403
	BTRFS_IOC_SCAN_DEV            IoctlCmd = 0x50009404
	BTRFS_IOC_FORGET_DEV          IoctlCmd = 0x50009405
	BTRFS_IOC_TRANS_START         IoctlCmd = 0x9406
	BTRFS_IOC_TRANS_END           IoctlCmd = 0x9407
	BTRFS_IOC_SYNC                IoctlCmd = 0x9408
	BTRFS_IOC_CLONE               IoctlCmd = 0x40049409
	BTRFS_IOC_ADD_DEV             IoctlCmd = 0x5000940a
	BTRFS_IOC_RM_DEV              IoctlCmd = 0x5000940b
	BTRFS_IOC_BALANCE             IoctlCmd = 0x5000940c
	BTRFS_IOC_CLONE_RANGE         IoctlCmd = 0x4020940d
	BTRFS_IOC_SUBVOL_CREATE       IoctlCmd = 0x5000940e
	BTRFS_IOC_SNAP_DESTROY        IoctlCmd = 0x5000940f
	BTRFS_IOC_DEFRAG_RANGE        IoctlCmd = 0x40309410
	BTRFS_IOC_TREE_SEARCH         IoctlCmd = 0xd0009411
	BTRFS_IOC_TREE_SEARCH_V2      IoctlCmd = 0xc0709411
	BTRFS_IOC_INO_LOOKUP          IoctlCmd = 0xd0009412
	BTRFS_IOC_DEFAULT_SUBVOL      IoctlCmd = 0x40089413
	BTRFS_IOC_SPACE_INFO          IoctlCmd = 0xc0109414
	BTRFS_IOC_START_SYNC          IoctlCmd = 0x80089418
	BTRFS_IOC_WAIT_SYNC           IoctlCmd = 0x40089416
	BTRFS_IOC_SNAP_CREATE_V2      IoctlCmd = 0x50009417
	BTRFS_IOC_SUBVOL_CREATE_V2    IoctlCmd = 0x50009418
	BTRFS_IOC_SUBVOL_GETFLAGS     IoctlCmd = 0x80089419
	BTRFS_IOC_SUBVOL_SETFLAGS     IoctlCmd = 0x4008941a
	BTRFS_IOC_SCRUB               IoctlCmd = 0xc400941b
	BTRFS_IOC_SCRUB_CANCEL        IoctlCmd = 0x941c
	BTRFS_IOC_SCRUB_PROGRESS      IoctlCmd = 0xc400941d
	BTRFS_IOC_DEV_INFO            IoctlCmd = 0xd000941e
	BTRFS_IOC_FS_INFO             IoctlCmd = 0x8400941f
	BTRFS_IOC_BALANCE_V2          IoctlCmd = 0xc4009420
	BTRFS_IOC_BALANCE_CTL         IoctlCmd = 0x40049421
	BTRFS_IOC_BALANCE_PROGRESS    IoctlCmd = 0x84009422
	BTRFS_IOC_INO_PATHS           IoctlCmd = 0xc0389423
	BTRFS_IOC_LOGICAL_INO         IoctlCmd = 0xc0389424
	BTRFS_IOC_SET_RECEIVED_SUBVOL IoctlCmd = 0xc0c89425
	BTRFS_IOC_SEND                IoctlCmd = 0x40489426
	BTRFS_IOC_DEVICES_READY       IoctlCmd = 0x90009427
	BTRFS_IOC_QUOTA_CTL           IoctlCmd = 0xc0109428
	BTRFS_IOC_QGROUP_ASSIGN       IoctlCmd = 0x40189429
	BTRFS_IOC_QGROUP_CREATE       IoctlCmd = 0x4010942a
	BTRFS_IOC_QGROUP_LIMIT        IoctlCmd = 0x8030942b
	BTRFS_IOC_QUOTA_RESCAN        IoctlCmd = 0x4040942c
	BTRFS_IOC_QUOTA_RESCAN_STATUS IoctlCmd = 0x8040942d
	BTRFS_IOC_QUOTA_RESCAN_WAIT   IoctlCmd = 0x942e
	BTRFS_IOC_GET_DEV_STATS       IoctlCmd = 0xc4089434
	BTRFS_IOC_DEV_REPLACE         IoctlCmd = 0xca289435
	BTRFS_IOC_FILE_EXTENT_SAME    IoctlCmd = 0xc0189436
	BTRFS_IOC_RM_DEV_V2           IoctlCmd = 0x5000943a
	BTRFS_IOC_LOGICAL_INO_V2      IoctlCmd = 0xc038943b
	BTRFS_IOC_GET_SUBVOL_INFO     IoctlCmd = 0x81f8943c
	BTRFS_IOC_GET_SUBVOL_ROOTREF  IoctlCmd = 0xd000943d
	BTRFS_IOC_INO_LOOKUP_USER     IoctlCmd = 0xd000943e
	BTRFS_IOC_SNAP_DESTROY_V2     IoctlCmd = 0x5000943f
	BTRFS_IOC_ENCODED_READ        IoctlCmd = 0x80809440
	BTRFS_IOC_ENCODED_WRITE       IoctlCmd = 0x40809440
)

BTRFS ioctl commands

func (IoctlCmd) Size

func (c IoctlCmd) Size() uintptr

func (IoctlCmd) String

func (i IoctlCmd) String() string

type LookupType

type LookupType uint8
const (
	LookupUUIDKeySubvol         LookupType = 251
	LookupUUIDKeyReceivedSubvol LookupType = 252
)

type ObjectID

type ObjectID uint64

func (ObjectID) IntString

func (o ObjectID) IntString() string

func (ObjectID) String

func (i ObjectID) String() string

type RBNode

type RBNode struct {
	RBLeft  *RBNode
	RBRight *RBNode
	Info    *RootInfo
}

RBNode represents a node in the Btrfs tree.

type RBRoot

type RBRoot struct {
	RBNode *RBNode
}

RBRoot represents the root of the Btrfs tree.

func BuildRBTree

func BuildRBTree(path string) (*RBRoot, error)

BuildRBTree builds a red-black tree from the subvolume root tree. Colors are currently not assigned as they are not needed for the current implementation.

func (*RBRoot) FilterFromRoot added in v0.0.5

func (r *RBRoot) FilterFromRoot(rootID ObjectID) *RBRoot

func (*RBRoot) InOrderIterate

func (r *RBRoot) InOrderIterate(f RBTreeIterFunc) error

func (*RBRoot) InsertRoot

func (r *RBRoot) InsertRoot(info *RootInfo)

func (*RBRoot) LookupRoot

func (r *RBRoot) LookupRoot(rootID ObjectID) *RootInfo

func (*RBRoot) PostOrderIterate

func (r *RBRoot) PostOrderIterate(f RBTreeIterFunc) error

func (*RBRoot) PreOrderIterate

func (r *RBRoot) PreOrderIterate(f RBTreeIterFunc) error

func (*RBRoot) UpdateRoot

func (r *RBRoot) UpdateRoot(info *RootInfo) bool

type RBTreeIterFunc

type RBTreeIterFunc func(info *RootInfo, lastErr error) error

RBTreeIterFunc is the function signature for the RBTreeIterFunc. Lasterr is the last error returned by the function. If the function returns an ErrStopTreeIteration error, the iteration will stop and the error will be returned by RBTree.Iterate.

type RootInfo

type RootInfo struct {
	RBNode *RBNode

	RootID             ObjectID
	RootOffset         uint64
	Flags              uint64
	RefTree            ObjectID
	DirID              uint64
	TopID              uint64
	Generation         uint64
	OriginalGeneration uint64
	CreationTime       time.Time
	SendTime           time.Time
	ReceiveTime        time.Time
	UUID               uuid.UUID
	ParentUUID         uuid.UUID
	ReceivedUUID       uuid.UUID
	Path               string
	Name               string

	// Only populated by resolving the path while building a tree.
	FullPath string
	Deleted  bool

	// Only populated during SubvolumeSearch with SearchWithSnapshots
	Snapshots []*RootInfo

	// The underlying item and reference that built this info
	Item *BtrfsRootItem
	Ref  *BtrfsRootRef
}

RootInfo represents the information about a Btrfs root. RBNode contains a reference to the node in the tree.

func SubvolumeSearch

func SubvolumeSearch(opts ...SearchOption) (*RootInfo, error)

SubvolumeSearch searches for a subvolume using the given options.

type SearchArgs

type SearchArgs struct {
	Key SearchParams
	Buf [3992]int8
}

type SearchHeader

type SearchHeader struct {
	Transid  uint64
	Objectid uint64
	Offset   uint64
	Type     uint32
	Len      uint32
}

func (*SearchHeader) ItemType

func (s *SearchHeader) ItemType() SearchKey

type SearchKey

type SearchKey uint32

func (SearchKey) String

func (i SearchKey) String() string

type SearchOption

type SearchOption func(*searchContext) error

func SearchWithPath

func SearchWithPath(path string) SearchOption

SearchWithPath searches for a subvolume starting from the given path. Implies SearchWithRootMount and root detection with FindRootMount.

func SearchWithReceivedUUID

func SearchWithReceivedUUID(uuid uuid.UUID) SearchOption

SearchWithReceivedUUID searches for a subvolume with the given received UUID.

func SearchWithRootID

func SearchWithRootID(id uint64) SearchOption

SearchWithRootID searches for a subvolume starting from the given root ID.

func SearchWithRootMount

func SearchWithRootMount(path string) SearchOption

SearchWithRootMount searches for a subvolume starting from the given root mount point. If not provided, the search will start from the root of the filesystem. You can use the FindRootMount function to find the root mount point of a given path.

func SearchWithSnapshots

func SearchWithSnapshots() SearchOption

SearchWithSnapshots searches for snapshots of the given subvolume and populates the results with them.

func SearchWithUUID

func SearchWithUUID(uuid uuid.UUID) SearchOption

SearchWithUUID searches for a subvolume with the given UUID.

type SearchParams

type SearchParams struct {
	Tree_id      uint64
	Min_objectid uint64
	Max_objectid uint64
	Min_offset   uint64
	Max_offset   uint64
	Min_transid  uint64
	Max_transid  uint64
	Min_type     uint32
	Max_type     uint32
	Nr_items     uint32
	Unused       uint32
	Unused1      uint64
	Unused2      uint64
	Unused3      uint64
	Unused4      uint64
}

type SendOption

type SendOption func(*sendCtx) error

func SendCompressedData

func SendCompressedData() SendOption

SendCompressedData

func SendToFile

func SendToFile(f *os.File) SendOption

SendToFile will send a send stream to the given os.File.

func SendToPath

func SendToPath(path string) SendOption

SendToPath will send a send stream to the given path as a file.

func SendToPipe added in v0.0.4

func SendToPipe() (SendOption, *os.File, error)

SendToPipe creates and returns an option and pipe to read the stream from.

func SendWithCloneSources

func SendWithCloneSources(sources ...string) SendOption

SendWithCloneSources will use the given snapshots as clone sources for an incremental send.

func SendWithLogger

func SendWithLogger(logger *log.Logger, verbosity int) SendOption

SendWithLogger will log the send operation to the given logger.

func SendWithParentRoot

func SendWithParentRoot(root string) SendOption

SendWithParentRoot will send an incremental send from the given parent root.

func SendWithoutData

func SendWithoutData() SendOption

SendWithoutData will send a send stream without any data. This is useful for getting a list of files that have changed.

type SnapshotOption

type SnapshotOption func(*volumeArgsV2) error

func WithReadOnlySnapshot

func WithReadOnlySnapshot() SnapshotOption

WithReadOnlySnapshot sets the snapshot to be read-only.

func WithSnapshotName

func WithSnapshotName(name string) SnapshotOption

WithSnapshotName sets the name of the snapshot to be created.

func WithSnapshotPath

func WithSnapshotPath(path string) SnapshotOption

WithSnapshotPath sets an absolute path for the snapshot to be created.

type TreeItem

type TreeItem struct {
	Data []byte
	Name string
}

func (TreeItem) DevItem added in v0.0.6

func (t TreeItem) DevItem() (BtrfsDevItem, error)

func (TreeItem) DirItem

func (t TreeItem) DirItem() (BtrfsDirItem, error)

func (TreeItem) InodeItem

func (t TreeItem) InodeItem() (BtrfsInodeItem, error)

func (TreeItem) InodeRef

func (t TreeItem) InodeRef() (BtrfsInodeRef, error)

func (TreeItem) RootItem

func (t TreeItem) RootItem() (BtrfsRootItem, error)

func (TreeItem) RootRef

func (t TreeItem) RootRef() (BtrfsRootRef, string, error)

type TreeIterFunc

type TreeIterFunc func(hdr SearchHeader, item TreeItem, lastErr error) error

TreeIterFunc is a function that is called for each item found in the tree. If the function returns any error it is passed as lastErr to the next call of the function. If the error wraps the ErrStopWalk error, the iteration is stopped.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL