|
|
@ -16,7 +16,7 @@ func init() {
|
|
|
|
FSType = map[int]string{0: "jfs2", 1: "namefs", 2: "nfs", 3: "jfs", 5: "cdrom", 6: "proc",
|
|
|
|
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",
|
|
|
|
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",
|
|
|
|
33: "veritas-fs", 34: "udfs", 35: "nfs4", 36: "nfs4-pseudo", 37: "smbfs", 38: "mcr-pseudofs",
|
|
|
|
39: "ahafs", 40: "sterm-nfs", 41: "asmfs" }
|
|
|
|
39: "ahafs", 40: "sterm-nfs", 41: "asmfs"}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
|
|
|
|
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
|
|
|
@ -28,7 +28,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
|
|
|
|
|
|
|
|
|
|
|
|
for _, fs := range f {
|
|
|
|
for _, fs := range f {
|
|
|
|
fstyp, exists := FSType[fs.FSType]
|
|
|
|
fstyp, exists := FSType[fs.FSType]
|
|
|
|
if ! exists {
|
|
|
|
if !exists {
|
|
|
|
fstyp = "unknown"
|
|
|
|
fstyp = "unknown"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
info := PartitionStat{
|
|
|
|
info := PartitionStat{
|
|
|
@ -36,7 +36,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
|
|
|
|
Mountpoint: fs.MountPoint,
|
|
|
|
Mountpoint: fs.MountPoint,
|
|
|
|
Fstype: fstyp,
|
|
|
|
Fstype: fstyp,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ret = append(ret,info)
|
|
|
|
ret = append(ret, info)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return ret, err
|
|
|
|
return ret, err
|
|
|
@ -56,7 +56,7 @@ func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
|
|
|
|
for _, fs := range f {
|
|
|
|
for _, fs := range f {
|
|
|
|
if path == fs.MountPoint {
|
|
|
|
if path == fs.MountPoint {
|
|
|
|
fstyp, exists := FSType[fs.FSType]
|
|
|
|
fstyp, exists := FSType[fs.FSType]
|
|
|
|
if ! exists {
|
|
|
|
if !exists {
|
|
|
|
fstyp = "unknown"
|
|
|
|
fstyp = "unknown"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
info := UsageStat{
|
|
|
|
info := UsageStat{
|
|
|
@ -64,7 +64,7 @@ func UsageWithContext(ctx context.Context, path string) (*UsageStat, error) {
|
|
|
|
Fstype: fstyp,
|
|
|
|
Fstype: fstyp,
|
|
|
|
Total: uint64(fs.TotalBlocks) * blocksize,
|
|
|
|
Total: uint64(fs.TotalBlocks) * blocksize,
|
|
|
|
Free: uint64(fs.FreeBlocks) * blocksize,
|
|
|
|
Free: uint64(fs.FreeBlocks) * blocksize,
|
|
|
|
Used: uint64(fs.TotalBlocks - fs.FreeBlocks) * blocksize,
|
|
|
|
Used: uint64(fs.TotalBlocks-fs.FreeBlocks) * blocksize,
|
|
|
|
InodesTotal: uint64(fs.TotalInodes),
|
|
|
|
InodesTotal: uint64(fs.TotalInodes),
|
|
|
|
InodesFree: uint64(fs.FreeInodes),
|
|
|
|
InodesFree: uint64(fs.FreeInodes),
|
|
|
|
InodesUsed: uint64(fs.TotalInodes - fs.FreeInodes),
|
|
|
|
InodesUsed: uint64(fs.TotalInodes - fs.FreeInodes),
|
|
|
|