package disk

import "github.com/shirou/gopsutil/disk"

Index

Constants

const (
	MntWait    = 1
	MfsNameLen = 15 /* length of fs type name, not inc. nul */
	MNameLen   = 90 /* length of buffer for returned name */

	MFSTYPENAMELEN = 16 /* length of fs type name including null */
	MAXPATHLEN     = 1024
	MNAMELEN       = MAXPATHLEN

	SYS_GETFSSTAT64 = 347
)
const (
	MntReadOnly     = 0x00000001 /* read only filesystem */
	MntSynchronous  = 0x00000002 /* filesystem written synchronously */
	MntNoExec       = 0x00000004 /* can't exec from filesystem */
	MntNoSuid       = 0x00000008 /* don't honor setuid bits on fs */
	MntUnion        = 0x00000020 /* union with underlying filesystem */
	MntAsync        = 0x00000040 /* filesystem written asynchronously */
	MntSuidDir      = 0x00100000 /* special handling of SUID on dirs */
	MntSoftDep      = 0x00200000 /* soft updates being done */
	MntNoSymFollow  = 0x00400000 /* do not follow symlinks */
	MntGEOMJournal  = 0x02000000 /* GEOM journal support enabled */
	MntMultilabel   = 0x04000000 /* MAC support for individual objects */
	MntACLs         = 0x08000000 /* ACL support enabled */
	MntNoATime      = 0x10000000 /* disable update of file access time */
	MntClusterRead  = 0x40000000 /* disable cluster read */
	MntClusterWrite = 0x80000000 /* disable cluster write */
	MntNFS4ACLs     = 0x00000010
)

sys/mount.h

Functions

func Getfsstat

func Getfsstat(buf []Statfs, flags int) (n int, err error)

func GetfsstatWithContext

func GetfsstatWithContext(ctx context.Context, buf []Statfs, flags int) (n int, err error)

func IOCounters

func IOCounters(names ...string) (map[string]IOCountersStat, error)

func IOCountersWithContext

func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOCountersStat, error)

Types

type Fsid

type Fsid struct {
	// contains filtered or unexported fields
} /* file system id type */

type IOCountersStat

type IOCountersStat struct {
	ReadCount        uint64 `json:"readCount"`
	MergedReadCount  uint64 `json:"mergedReadCount"`
	WriteCount       uint64 `json:"writeCount"`
	MergedWriteCount uint64 `json:"mergedWriteCount"`
	ReadBytes        uint64 `json:"readBytes"`
	WriteBytes       uint64 `json:"writeBytes"`
	ReadTime         uint64 `json:"readTime"`
	WriteTime        uint64 `json:"writeTime"`
	IopsInProgress   uint64 `json:"iopsInProgress"`
	IoTime           uint64 `json:"ioTime"`
	WeightedIO       uint64 `json:"weightedIO"`
	Name             string `json:"name"`
	SerialNumber     string `json:"serialNumber"`
	Label            string `json:"label"`
}

func (IOCountersStat) String

func (d IOCountersStat) String() string

type PartitionStat

type PartitionStat struct {
	Device     string `json:"device"`
	Mountpoint string `json:"mountpoint"`
	Fstype     string `json:"fstype"`
	Opts       string `json:"opts"`
}

func Partitions

func Partitions(all bool) ([]PartitionStat, error)

func PartitionsWithContext

func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error)

func (PartitionStat) String

func (d PartitionStat) String() string

type Statfs

type Statfs struct {
	Bsize       uint32
	Iosize      int32
	Blocks      uint64
	Bfree       uint64
	Bavail      uint64
	Files       uint64
	Ffree       uint64
	Fsid        Fsid
	Owner       uint32
	Type        uint32
	Flags       uint32
	Fssubtype   uint32
	Fstypename  [16]int8
	Mntonname   [1024]int8
	Mntfromname [1024]int8
	Reserved    [8]uint32
}

type UsageStat

type UsageStat struct {
	Path              string  `json:"path"`
	Fstype            string  `json:"fstype"`
	Total             uint64  `json:"total"`
	Free              uint64  `json:"free"`
	Used              uint64  `json:"used"`
	UsedPercent       float64 `json:"usedPercent"`
	InodesTotal       uint64  `json:"inodesTotal"`
	InodesUsed        uint64  `json:"inodesUsed"`
	InodesFree        uint64  `json:"inodesFree"`
	InodesUsedPercent float64 `json:"inodesUsedPercent"`
}

func Usage

func Usage(path string) (*UsageStat, error)

Usage returns a file system usage. path is a filessytem path such as "/", not device file path like "/dev/vda1". If you want to use a return value of disk.Partitions, use "Mountpoint" not "Device".

func UsageWithContext

func UsageWithContext(ctx context.Context, path string) (*UsageStat, error)

func (UsageStat) String

func (d UsageStat) String() string

Source Files

disk.go disk_darwin.go disk_darwin_amd64.go disk_darwin_cgo.go disk_unix.go

Version
v2.18.10+incompatible
Published
Oct 23, 2018
Platform
darwin/amd64
Imports
10 packages
Last checked
19 hours ago

Tools for package owners.