raw

package
v3.0.0-beta11 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExist = errors.New("the raw device is already bound")
)

Functions

func DriverMajor

func DriverMajor() int

func IsCapable

func IsCapable() bool

func WithLogger

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

Types

type Bind

type Bind struct {
	Index     int
	BDevMajor int
	BDevMinor int
}

Bind hold a raw bind detail

func (Bind) BDevPath

func (b Bind) BDevPath() string

BDevPath returns block device path associated with a bind entry

func (Bind) CDevPath

func (b Bind) CDevPath() string

CDevPath returns raw device path for a bind entry

type Binds

type Binds []Bind

Binds is a list of Bind

func (Binds) BDev

func (bl Binds) BDev(major, minor int) *Bind

BDev returns pointer to bind entry that match 'major' and 'minor' or returns nil

func (Binds) FromBDevPath

func (bl Binds) FromBDevPath(s string) *Bind

FromBDevPath returns pointer to the bind entry that match block dev path 's' or returns nil

func (Binds) FromCDevPath

func (bl Binds) FromCDevPath(s string) *Bind

FromCDevPath returns pointer to bind entry matching raw dev path 's' or returns nil

func (Binds) HasBDevMajorMinor

func (bl Binds) HasBDevMajorMinor(major, minor int) bool

HasBDevMajorMinor returns true if a raw device is bound to block device 'major' and 'minor'

func (Binds) HasBDevPath

func (bl Binds) HasBDevPath(s string) bool

HasBDevPath returns true if a raw device is bound to block device 's'

func (Binds) HasCDevPath

func (bl Binds) HasCDevPath(s string) bool

HasCDevPath returns true if

func (Binds) HasIndex

func (bl Binds) HasIndex(i int) bool

func (Binds) Index

func (bl Binds) Index(i int) *Bind

type T

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

T holds the actions for raw device

func New

func New(opts ...funcopt.O) *T

func (T) Bind

func (t T) Bind(bDevPath string) (int, error)

Bind create a new raw device for block dev 'bDevPath'

it returns device minor of created raw device

func (T) Find

func (t T) Find(path string) (*Bind, error)

Find returns bind entry handled by raw if current raw devices handle block device 'path'

func (T) HasBlockDev

func (t T) HasBlockDev(path string) (bool, error)

HasBlockDev returns true if current raw devices handle block device 'path'

func (T) QueryAll

func (t T) QueryAll() (Binds, error)

QueryAll returns list of current binds

func (T) Unbind

func (t T) Unbind(cDevPath string) error

Unbind unbinds raw device 'cDevPath'

func (T) UnbindBDevPath

func (t T) UnbindBDevPath(bDevPath string) error

UnbindBDevPath unbind raw device associated with block device path 'bDevPath'

It return nil if succeed or if no raw device for block 'bDevPath'

func (T) UnbindMinor

func (t T) UnbindMinor(minor int) error

UnbindMinor unbind raw device with 'minor'

Jump to

Keyboard shortcuts

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