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

Method SysBlockDeviceMapperInfo

blockdevice/stats.go:444–470  ·  view source on GitHub ↗
(device string)

Source from the content-addressed store, hash-verified

442}
443
444func (fs FS) SysBlockDeviceMapperInfo(device string) (DeviceMapperInfo, error) {
445 info := DeviceMapperInfo{}
446 // Files with uint64 fields
447 for file, p := range map[string]*uint64{
448 "rq_based_seq_io_merge_deadline": &info.RqBasedSeqIOMergeDeadline,
449 "suspended": &info.Suspended,
450 "use_blk_mq": &info.UseBlkMQ,
451 } {
452 val, err := parsers.ReadUintFromFile(fs.sys.Path(sysBlockPath, device, sysBlockDM, file))
453 if err != nil {
454 return DeviceMapperInfo{}, err
455 }
456 *p = val
457 }
458 // Files with string fields
459 for file, p := range map[string]*string{
460 "name": &info.Name,
461 "uuid": &info.UUID,
462 } {
463 val, err := parsers.SysReadFile(fs.sys.Path(sysBlockPath, device, sysBlockDM, file))
464 if err != nil {
465 return DeviceMapperInfo{}, err
466 }
467 *p = val
468 }
469 return info, nil
470}
471
472func (fs FS) SysBlockDeviceUnderlyingDevices(device string) (UnderlyingDeviceInfo, error) {
473 underlyingDir, err := os.Open(fs.sys.Path(sysBlockPath, device, sysUnderlyingDev))

Callers 1

TestBlockDmInfoFunction · 0.95

Calls 3

ReadUintFromFileFunction · 0.92
SysReadFileFunction · 0.92
PathMethod · 0.45

Tested by 1

TestBlockDmInfoFunction · 0.76