device

package
v3.0.0-rc72 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ModeBlock uint = syscall.S_IFBLK
	ModeChar  uint = syscall.S_IFCHR
)
View Source
const TailWipeSize int64 = 1024 * 1024

TailWipeSize is the end of a device a provision zeroes on a device it made on reused space: it holds the internal metadata of drbd 8 and 9, a md 0.90 superblock, the zfs labels and the backup gpt.

Variables

This section is empty.

Functions

func RemoveHolders

func RemoveHolders(ctx context.Context, head T) error

func WithLogger

func WithLogger(log *plog.Logger) funcopt.O

Types

type L

type L []T

func (L) Contains

func (t L) Contains(dev T) (bool, error)

func (L) HolderEndpoints

func (t L) HolderEndpoints() (L, error)

func (L) SCSIPaths

func (t L) SCSIPaths() (L, error)

type T

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

func New

func New(path string, opts ...funcopt.O) T

func (T) ConfigureMultipath

func (t T) ConfigureMultipath(ctx context.Context, verbosity int) error

func (T) Delete

func (t T) Delete() error

func (T) Driver

func (t T) Driver() (interface{}, error)

func (T) FlushBufs

func (t T) FlushBufs(ctx context.Context) error

FlushBufs drops the buffers of the device and of the devices it rests on, as the paths of a multipath device.

A write through a device, as a signature wiped or a superblock zeroed, does not reach the buffers of the devices below it, and blkid reads those: it goes on reporting what was erased, under the name of every path, until they are dropped.

func (T) Holders

func (t T) Holders() (L, error)

func (T) Host

func (t T) Host() (string, error)

func (T) IsMultipath

func (t T) IsMultipath() (bool, error)

func (T) IsReadOnly

func (t T) IsReadOnly() (bool, error)

func (T) IsReadWrite

func (t T) IsReadWrite() (bool, error)

func (T) IsReady

func (t T) IsReady(ctx context.Context) (bool, error)

func (T) IsReservable

func (t T) IsReservable() (bool, error)

func (T) IsSCSI

func (t T) IsSCSI() (bool, error)

func (T) Major

func (t T) Major() (uint32, error)

func (T) MajorMinor

func (t T) MajorMinor() (uint32, uint32, error)

func (T) MajorMinorStr

func (t T) MajorMinorStr() (string, error)

func (T) MarshalJSON

func (t T) MarshalJSON() ([]byte, error)

MarshalJSON marshals the data as a quoted json string

func (T) Minor

func (t T) Minor() (uint32, error)

func (T) MknodBlock

func (t T) MknodBlock(major, minor uint32) error

func (T) Model

func (t T) Model() (string, error)

func (T) MultipathParent

func (t T) MultipathParent() (*T, error)

func (T) Path

func (t T) Path() string

func (T) PromoteRW

func (t T) PromoteRW(ctx context.Context) error

func (T) RefreshMultipath

func (t T) RefreshMultipath(ctx context.Context) error

func (T) Remove

func (t T) Remove(ctx context.Context) error

func (T) RemoveHolders

func (t T) RemoveHolders(ctx context.Context) error

func (T) RemoveMultipath

func (t T) RemoveMultipath(ctx context.Context) error

func (T) Rescan

func (t T) Rescan() error

func (T) SCSIPaths

func (t T) SCSIPaths() (L, error)

func (T) SetReadOnly

func (t T) SetReadOnly(ctx context.Context) error

func (T) SetReadWrite

func (t T) SetReadWrite(ctx context.Context) error

func (T) Size

func (t T) Size() (int64, error)

Size is the bytes the device holds.

Seeking to the end of a block device answers its capacity, which saves an ioctl constant and works the same on a regular file.

func (T) SlaveHosts

func (t T) SlaveHosts() ([]string, error)

func (T) Slaves

func (t T) Slaves() (L, error)

func (T) Stat

func (t T) Stat() (unix.Stat_t, error)

func (T) String

func (t T) String() string

func (*T) UnmarshalJSON

func (t *T) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to value

func (T) Vendor

func (t T) Vendor() (string, error)

func (T) Version

func (t T) Version() (string, error)

func (T) WWID

func (t T) WWID() (string, error)

func (T) WaitReady

func (t T) WaitReady(ctx context.Context) error

func (T) Wipe

func (t T) Wipe(ctx context.Context) error

func (T) ZeroTail

func (t T) ZeroTail(n int64) error

ZeroTail writes zeroes over the last n bytes of the device, over all of it when it holds less. The end of a device is where the internal metadata of drbd, a md 0.90 superblock, the zfs labels and the backup gpt are kept, and wipefs misses those its libblkid is too old to know.

Jump to

Keyboard shortcuts

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