filesystems

package
v3.0.0-rc49 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImplemented = errors.New("not implemented")
)

Functions

func CanFSCK

func CanFSCK(fs any) error

func DevicesFSCK

func DevicesFSCK(ctx context.Context, fs any, dl subDeviceLister) error

func DevicesFormated

func DevicesFormated(ctx context.Context, fs any, dl subDeviceLister) (bool, error)

func HasFSCK

func HasFSCK(fs any) bool

func IsCapable

func IsCapable(ctx context.Context, t string) bool

func Types

func Types() []string

Types

type BTRFS

type BTRFS struct{ T }

func NewBTRFS

func NewBTRFS() *BTRFS

func (BTRFS) Devices

func (t BTRFS) Devices(ctx context.Context, dev string) ([]string, error)

Devices returns the devices of the btrfs on dev.

func (BTRFS) Grow

func (t BTRFS) Grow(ctx context.Context, dev, mountPoint string) error

Grow takes the device dev of the filesystem mounted at mountPoint up to the size of the device: a btrfs grows a device at a time, and only while it is mounted.

func (BTRFS) IsCapable

func (t BTRFS) IsCapable() bool

func (BTRFS) IsFormated

func (t BTRFS) IsFormated(ctx context.Context, dev string) (bool, error)

IsFormated reports whether the device holds a btrfs, which "btrfs filesystem show" lists the devices of.

func (BTRFS) MKFS

func (t BTRFS) MKFS(ctx context.Context, dev string, args []string) error

MKFS formats the device. The label the syncs find the filesystem by on every node is given in the mkfs options, as -L <label>.

func (BTRFS) ProvisionMountOptions

func (t BTRFS) ProvisionMountOptions(ctx context.Context, dev, mountOptions string) error

ProvisionMountOptions creates the subvolume the mount options name, as subvol=data, which the mount of the filesystem needs to exist.

type CanFSCKer

type CanFSCKer interface {
	CanFSCK() error
}

type DeviceLister

type DeviceLister interface {
	Devices(ctx context.Context, dev string) ([]string, error)
}

DeviceLister is implemented by a filesystem that can span several devices, to tell the devices of the one on dev.

type Ext2

type Ext2 struct{ T }

func NewExt2

func NewExt2() *Ext2

func (Ext2) CanFSCK

func (t Ext2) CanFSCK() error

func (Ext2) FSCK

func (t Ext2) FSCK(ctx context.Context, s string) error

func (Ext2) Grow

func (t Ext2) Grow(ctx context.Context, dev, mountPoint string) error

func (Ext2) IsFormated

func (t Ext2) IsFormated(ctx context.Context, s string) (bool, error)

func (Ext2) MKFS

func (t Ext2) MKFS(ctx context.Context, s string, args []string) error

type Ext3

type Ext3 struct{ T }

func NewExt3

func NewExt3() *Ext3

func (Ext3) CanFSCK

func (t Ext3) CanFSCK() error

func (Ext3) FSCK

func (t Ext3) FSCK(ctx context.Context, s string) error

func (Ext3) Grow

func (t Ext3) Grow(ctx context.Context, dev, mountPoint string) error

func (Ext3) IsFormated

func (t Ext3) IsFormated(ctx context.Context, s string) (bool, error)

func (Ext3) MKFS

func (t Ext3) MKFS(ctx context.Context, s string, args []string) error

type Ext4

type Ext4 struct{ T }

func NewExt4

func NewExt4() *Ext4

func (Ext4) CanFSCK

func (t Ext4) CanFSCK() error

func (Ext4) FSCK

func (t Ext4) FSCK(ctx context.Context, s string) error

func (Ext4) Grow

func (t Ext4) Grow(ctx context.Context, dev, mountPoint string) error

func (Ext4) IsFormated

func (t Ext4) IsFormated(ctx context.Context, s string) (bool, error)

func (Ext4) MKFS

func (t Ext4) MKFS(ctx context.Context, s string, args []string) error

type FSCKer

type FSCKer interface {
	FSCK(context.Context, string) error
}

type Grower

type Grower interface {
	Grow(ctx context.Context, dev, mountPoint string) error
}

Grower is implemented by a filesystem that can be made larger in place, to fill the device it sits on. The device is enlarged first, so the filesystem is only ever asked to take up what is already there.

type I

type I interface {
	String() string
	Type() string
	IsZero() bool
	IsNetworked() bool
	IsReadOnly() bool
	IsVirtual() bool
	IsFileBacked() bool
	IsMultiDevice() bool
	Mount(context.Context, string, string, string) error
	Umount(context.Context, string) error
	KillUsers(context.Context, string) error
	Log() *plog.Logger
	SetLog(*plog.Logger)
}

func FromType

func FromType(s string) I

type IsCapabler

type IsCapabler interface {
	IsCapable() bool
}

type IsFormateder

type IsFormateder interface {
	IsFormated(context.Context, string) (bool, error)
}

type MKFSer

type MKFSer interface {
	MKFS(context.Context, string, []string) error
}

type MountOptionsProvisioner

type MountOptionsProvisioner interface {
	ProvisionMountOptions(ctx context.Context, dev, mountOptions string) error
}

MountOptionsProvisioner is implemented by a filesystem whose mount options name a part of it to create when it is provisioned, as the subvolume of a btrfs.

type SelfSizer

type SelfSizer interface {
	SetSize(ctx context.Context, mountPoint string, size int64) error
}

SelfSizer is implemented by a filesystem that holds its own size rather than taking the size of a device under it. A tmpfs is told how large to be, and has nothing below it to enlarge first, so it is resized in one step and in either direction.

type T

type T struct {
	// contains filtered or unexported fields
}

func (T) IsFileBacked

func (t T) IsFileBacked() bool

func (T) IsMultiDevice

func (t T) IsMultiDevice() bool

func (T) IsNetworked

func (t T) IsNetworked() bool

func (T) IsReadOnly

func (t T) IsReadOnly() bool

func (T) IsVirtual

func (t T) IsVirtual() bool

func (T) IsZero

func (t T) IsZero() bool

func (T) KillUsers

func (t T) KillUsers(ctx context.Context, mnt string) error

func (T) Log

func (t T) Log() *plog.Logger

func (T) Mount

func (t T) Mount(ctx context.Context, dev string, mnt string, options string) error

func (*T) SetLog

func (t *T) SetLog(log *plog.Logger)

func (T) String

func (t T) String() string

func (T) Type

func (t T) Type() string

func (T) Umount

func (t T) Umount(ctx context.Context, mnt string) error

type TMPFS

type TMPFS struct{ T }

func NewTMPFS

func NewTMPFS() *TMPFS

func (TMPFS) SetSize

func (t TMPFS) SetSize(ctx context.Context, mountPoint string, size int64) error

SetSize changes how large the filesystem may grow.

A tmpfs holds its own size: there is no device under it to enlarge first, and no filesystem structure to rewrite, so one remount does it in either direction. Made smaller than what it already holds it keeps the pages and reports itself full, which the kernel allows and a caller asked for.

type XFS

type XFS struct{ T }

func NewXFS

func NewXFS() *XFS

func (XFS) Grow

func (t XFS) Grow(ctx context.Context, dev, mountPoint string) error

Grow takes the filesystem up to the size of the device it sits on. xfs_growfs works on the mount point, and only while it is mounted.

func (XFS) IsCapable

func (t XFS) IsCapable() bool

func (XFS) IsFormated

func (t XFS) IsFormated(ctx context.Context, s string) (bool, error)

func (XFS) MKFS

func (t XFS) MKFS(ctx context.Context, devpath string, args []string) error

Jump to

Keyboard shortcuts

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