|
|
|
@ -8,8 +8,8 @@ import (
|
|
|
|
|
"regexp"
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
"golang.org/x/sys/unix"
|
|
|
|
|
"github.com/shirou/gopsutil/v3/internal/common"
|
|
|
|
|
"golang.org/x/sys/unix"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var whiteSpaces = regexp.MustCompile(`\s+`)
|
|
|
|
@ -17,11 +17,11 @@ var startBlank = regexp.MustCompile(`^\s+`)
|
|
|
|
|
|
|
|
|
|
var ignoreFSType = map[string]bool{"procfs": true}
|
|
|
|
|
var FSType = map[int]string{
|
|
|
|
|
0: "jfs2", 1: "namefs", 2: "nfs", 3: "jfs", 5: "cdrom", 6: "proc",
|
|
|
|
|
16: "special-fs", 17: "cache-fs", 18: "nfs3", 19: "automount-fs", 20: "pool-fs", 32: "vxfs",
|
|
|
|
|
33: "veritas-fs", 34: "udfs", 35: "nfs4", 36: "nfs4-pseudo", 37: "smbfs", 38: "mcr-pseudofs",
|
|
|
|
|
39: "ahafs", 40: "sterm-nfs", 41: "asmfs",
|
|
|
|
|
}
|
|
|
|
|
0: "jfs2", 1: "namefs", 2: "nfs", 3: "jfs", 5: "cdrom", 6: "proc",
|
|
|
|
|
16: "special-fs", 17: "cache-fs", 18: "nfs3", 19: "automount-fs", 20: "pool-fs", 32: "vxfs",
|
|
|
|
|
33: "veritas-fs", 34: "udfs", 35: "nfs4", 36: "nfs4-pseudo", 37: "smbfs", 38: "mcr-pseudofs",
|
|
|
|
|
39: "ahafs", 40: "sterm-nfs", 41: "asmfs",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
|
|
|
|
|
var ret []PartitionStat
|
|
|
|
@ -42,7 +42,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
|
|
|
|
|
start := 0
|
|
|
|
|
finished := false
|
|
|
|
|
for pos, ch := range lines[1] {
|
|
|
|
|
if ch == ' ' && ! finished {
|
|
|
|
|
if ch == ' ' && !finished {
|
|
|
|
|
name := strings.TrimSpace(lines[0][start:pos])
|
|
|
|
|
colidx[name] = idx
|
|
|
|
|
finished = true
|
|
|
|
|