device

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNestedMountpointsPaths

func GetNestedMountpointsPaths(path string, mounts Devices) []string

GetNestedMountpointsPaths returns paths of nested mount points

Types

type ByName

type ByName Devices

ByName sorts devices by device name

func (ByName) Len

func (f ByName) Len() int

func (ByName) Less

func (f ByName) Less(i, j int) bool

func (ByName) Swap

func (f ByName) Swap(i, j int)

type ByUsedSize

type ByUsedSize Devices

ByUsedSize sorts devices by used size

func (ByUsedSize) Len

func (f ByUsedSize) Len() int

func (ByUsedSize) Less

func (f ByUsedSize) Less(i, j int) bool

func (ByUsedSize) Swap

func (f ByUsedSize) Swap(i, j int)

type Device

type Device struct {
	Name       string
	MountPoint string
	Fstype     string
	Size       int64
	Free       int64
}

Device struct

func (Device) GetUsage

func (d Device) GetUsage() int64

GetUsage returns used size of device

type Devices

type Devices []*Device

Devices if slice of Device items

type DevicesInfoGetter

type DevicesInfoGetter interface {
	GetMounts() (Devices, error)
	GetDevicesInfo() (Devices, error)
}

DevicesInfoGetter is type for GetDevicesInfo function

var Getter DevicesInfoGetter = LinuxDevicesInfoGetter{MountsPath: "/proc/mounts"}

Getter is current instance of DevicesInfoGetter

type LinuxDevicesInfoGetter

type LinuxDevicesInfoGetter struct {
	MountsPath string
}

LinuxDevicesInfoGetter returns info for Linux devices

func (LinuxDevicesInfoGetter) GetDevicesInfo

func (t LinuxDevicesInfoGetter) GetDevicesInfo() (devices Devices, err error)

GetDevicesInfo returns result of GetMounts with usage info about mounted devices (by calling Statfs syscall)

func (LinuxDevicesInfoGetter) GetMounts

func (t LinuxDevicesInfoGetter) GetMounts() (devices Devices, err error)

GetMounts returns all mounted filesystems from /proc/mounts

Jump to

Keyboard shortcuts

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