MCPcopy Create free account
hub / github.com/prometheus/procfs / SysBlockDeviceSize

Method SysBlockDeviceSize

blockdevice/stats.go:487–493  ·  view source on GitHub ↗

SysBlockDeviceSize returns the size of the block device from /sys/block/ /size in bytes by multiplying the value by the Linux sector length of 512.

(device string)

Source from the content-addressed store, hash-verified

485// SysBlockDeviceSize returns the size of the block device from /sys/block/<device>/size
486// in bytes by multiplying the value by the Linux sector length of 512.
487func (fs FS) SysBlockDeviceSize(device string) (uint64, error) {
488 size, err := parsers.ReadUintFromFile(fs.sys.Path(sysBlockPath, device, sysBlockSize))
489 if err != nil {
490 return 0, err
491 }
492 return procfs.SectorSize * size, nil
493}
494
495// SysBlockDeviceRotational returns the rotational value for the block device
496// from /sys/block/<device>/queue/rotational.

Callers 1

TestSysBlockDeviceSizeFunction · 0.95

Calls 2

ReadUintFromFileFunction · 0.92
PathMethod · 0.45

Tested by 1

TestSysBlockDeviceSizeFunction · 0.76