file

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 6 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFromPath

func CreateFromPath(pathName string, size int64) (backend.Storage, error)

Create a backend.Storage from a path to an image file. Should pass a path to a file /tmp/foo.img The provided file must not exist at the time you call CreateFromPath()

func New

func New(f fs.File, readOnly bool) backend.Storage

Create a backend.Storage from provided fs.File. Will not store any path.

func OpenFromPath

func OpenFromPath(pathName string, readOnly bool) (backend.Storage, error)

Create a backend.Storage from a path to a device Should pass a path to a block device e.g. /dev/sda or a path to a file /tmp/foo.img The provided device/file must exist at the time you call OpenFromPath()

func OpenFromPathWithExclusive added in v1.9.4

func OpenFromPathWithExclusive(pathName string, readOnly, exclusive bool) (backend.Storage, error)

OpenFromPathWithExclusive is like OpenFromPath but lets the caller choose whether a writable open uses O_EXCL. The exclusive flag is ignored for a read-only open. Callers that shell out to filesystem utilities (e.g. e2fsck/resize2fs) on the child partitions of a whole disk must open the disk non-exclusively: holding the parent disk O_EXCL makes the kernel reject O_EXCL opens of its partitions ("device is in use"). The returned backend records the path, unlike New.

Types

This section is empty.

Jump to

Keyboard shortcuts

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