btrfs

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: Apache-2.0 Imports: 11 Imported by: 107

README

go-btrfs

PkgGoDev Build Status Go Report Card

Native Go bindings for btrfs.

Status

These are in the early stages. We will try to maintain stability, but please vendor if you are relying on these directly.

Contribute

This package may not cover all the use cases for btrfs. If something you need is missing, please don't hesitate to submit a PR.

Note that due to struct alignment issues, this isn't yet fully native. Preferably, this could be resolved, so contributions in this direction are greatly appreciated.

Applying License Header to New Files

If you submit a contribution that adds a new file, please add the license header. You can do so manually or use the ltag tool:

$ go get github.com/kunalkushwaha/ltag
$ ltag -t ./license-templates

The above will add the appropriate licenses to Go files. New templates will need to be added if other kinds of files are added. Please consult the documentation at https://github.com/kunalkushwaha/ltag

Project details

btrfs is a containerd sub-project, licensed under the Apache 2.0 license. As a containerd sub-project, you will find the:

information in our containerd/project repository.

Documentation

Overview

Package btrfs provides bindings for working with btrfs partitions from Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSubvolume

func IsSubvolume(path string) error

IsSubvolume returns nil if the path is a valid subvolume. An error is returned if the path does not exist or the path is not a valid subvolume.

func SubvolCreate

func SubvolCreate(path string) error

SubvolCreate creates a subvolume at the provided path.

func SubvolDelete

func SubvolDelete(path string) error

SubvolDelete deletes the subvolumes under the given path.

func SubvolID

func SubvolID(path string) (uint64, error)

SubvolID returns the subvolume ID for the provided path

func SubvolSnapshot

func SubvolSnapshot(dst, src string, readonly bool) error

SubvolSnapshot creates a snapshot in dst from src. If readonly is true, the snapshot will be readonly.

Types

type Info

type Info struct {
	ID         uint64 // subvolume id
	ParentID   uint64 // aka ref_tree
	TopLevelID uint64 // not actually clear what this is, not set for now.
	Offset     uint64 // key offset for root
	DirID      uint64

	Generation         uint64
	OriginalGeneration uint64

	UUID         string
	ParentUUID   string
	ReceivedUUID string

	Name string
	Path string // absolute path of subvolume
	Root string // path of root mount point

	Readonly bool // true if the snaps hot is readonly, extracted from flags
}

Info describes metadata about a btrfs subvolume.

func SubvolInfo

func SubvolInfo(path string) (info Info, err error)

SubvolInfo returns information about the subvolume at the provided path.

func SubvolList

func SubvolList(path string) ([]Info, error)

SubvolList will return the information for all subvolumes corresponding to the provided path.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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