From 841d35546bfbdc84aefcdd6781555de78281050f Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Thu, 25 Nov 2021 12:13:00 +0100 Subject: [PATCH] Lint comments (#422) * Add `godot` linter to validate comments. * Clenup a bunch of comments. * Replace deprecated golint with revive. Signed-off-by: SuperQ --- .golangci.yml | 10 +++++++++- arp.go | 16 ++++++++-------- bcache/bcache.go | 2 +- bcache/get.go | 4 ++-- blockdevice/stats.go | 16 ++++++++-------- btrfs/get.go | 4 ++-- cpuinfo.go | 4 ++-- internal/fs/fs.go | 2 +- iscsi/get.go | 17 ++++++++--------- iscsi/iscsi.go | 30 ++++++++++++++---------------- loadavg.go | 2 +- net_conntrackstat.go | 12 ++++++------ net_ip_socket.go | 2 +- net_protocols.go | 4 ++-- net_softnet.go | 8 ++++---- netstat.go | 4 ++-- nfs/nfs.go | 10 ++++++---- nfs/parse_nfs.go | 2 +- nfs/parse_nfsd.go | 2 +- proc.go | 4 ++-- proc_cgroup.go | 6 +++--- proc_environ.go | 2 +- proc_fdinfo.go | 3 +-- proc_limits.go | 2 +- proc_maps.go | 10 +++++----- proc_psi.go | 14 ++++++++------ proc_psi_test.go | 2 +- proc_smaps.go | 22 +++++++++++----------- proc_stat.go | 2 +- proc_status.go | 32 ++++++++++++++++---------------- schedstat.go | 6 +++--- schedstat_test.go | 2 +- slab.go | 2 +- stat.go | 10 +++++----- sysfs/class_fibrechannel.go | 2 +- sysfs/class_infiniband.go | 4 ++-- sysfs/class_powercap.go | 14 +++++++------- sysfs/class_scsitape.go | 2 +- sysfs/clocksource.go | 4 ++-- sysfs/net_class.go | 2 +- sysfs/system_cpu.go | 16 ++++++++-------- sysfs/vulnerability.go | 2 +- vm.go | 2 +- xfs/parse.go | 14 +++++++------- 44 files changed, 170 insertions(+), 162 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 0aa09edac..a197699a1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,4 +1,12 @@ --- linters: enable: - - golint + - godot + - revive + +linter-settings: + godot: + capital: true + exclude: + # Ignore "See: URL" + - 'See:' diff --git a/arp.go b/arp.go index d4537821a..1f2616a96 100644 --- a/arp.go +++ b/arp.go @@ -21,19 +21,19 @@ import ( "strings" ) -// Learned from include/uapi/linux/if_arp.h +// Learned from include/uapi/linux/if_arp.h. const ( - // completed entry (ha valid) + // completed entry (ha valid). ATFComplete = 0x02 - // permanent entry + // permanent entry. ATFPermanent = 0x04 - // Publish entry + // Publish entry. ATFPublish = 0x08 - // Has requested trailers + // Has requested trailers. ATFUseTrailers = 0x10 - // Obsoleted: Want to use a netmask (only for proxy entries) + // Obsoleted: Want to use a netmask (only for proxy entries). ATFNetmask = 0x20 - // Don't answer this addresses + // Don't answer this addresses. ATFDontPublish = 0x40 ) @@ -110,7 +110,7 @@ func parseARPEntry(columns []string) (ARPEntry, error) { return entry, nil } -// IsComplete returns true if ARP entry is marked with complete flag +// IsComplete returns true if ARP entry is marked with complete flag. func (entry *ARPEntry) IsComplete() bool { return entry.Flags&ATFComplete != 0 } diff --git a/bcache/bcache.go b/bcache/bcache.go index 1176a558a..5ba7e767c 100644 --- a/bcache/bcache.go +++ b/bcache/bcache.go @@ -29,7 +29,7 @@ type Stats struct { } // BcacheStats contains statistics tied to a bcache ID. -type BcacheStats struct { // nolint:golint +type BcacheStats struct { // nolint:revive AverageKeySize uint64 BtreeCacheSize uint64 CacheAvailablePercent uint64 diff --git a/bcache/get.go b/bcache/get.go index b1b9da7a8..26638e9ee 100644 --- a/bcache/get.go +++ b/bcache/get.go @@ -51,8 +51,8 @@ func NewFS(mountPoint string) (FS, error) { return FS{&fs}, nil } -// Stats is a wrapper around stats() -// It returns full available statistics +// Stats is a wrapper around stats(). +// It returns full available statistics. func (fs FS) Stats() ([]*Stats, error) { return fs.stats(true) } diff --git a/blockdevice/stats.go b/blockdevice/stats.go index 52139d3e8..56911fbec 100644 --- a/blockdevice/stats.go +++ b/blockdevice/stats.go @@ -25,17 +25,17 @@ import ( "github.com/prometheus/procfs/internal/fs" ) -// Info contains identifying information for a block device such as a disk drive +// Info contains identifying information for a block device such as a disk drive. type Info struct { MajorNumber uint32 MinorNumber uint32 DeviceName string } -// IOStats models the iostats data described in the kernel documentation -// https://www.kernel.org/doc/Documentation/iostats.txt, -// https://www.kernel.org/doc/Documentation/block/stat.txt, -// and https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats +// IOStats models the iostats data described in the kernel documentation. +// - https://www.kernel.org/doc/Documentation/iostats.txt, +// - https://www.kernel.org/doc/Documentation/block/stat.txt +// - https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats type IOStats struct { // ReadIOs is the number of reads completed successfully. ReadIOs uint64 @@ -76,7 +76,7 @@ type IOStats struct { TimeSpentFlushing uint64 } -// Diskstats combines the device Info and IOStats +// Diskstats combines the device Info and IOStats. type Diskstats struct { Info IOStats @@ -220,7 +220,7 @@ func NewFS(procMountPoint string, sysMountPoint string) (FS, error) { } // ProcDiskstats reads the diskstats file and returns -// an array of Diskstats (one per line/device) +// an array of Diskstats (one per line/device). func (fs FS) ProcDiskstats() ([]Diskstats, error) { file, err := os.Open(fs.proc.Path(procDiskstatsPath)) if err != nil { @@ -266,7 +266,7 @@ func (fs FS) ProcDiskstats() ([]Diskstats, error) { return diskstats, scanner.Err() } -// SysBlockDevices lists the device names from /sys/block/ +// SysBlockDevices lists the device names from /sys/block/. func (fs FS) SysBlockDevices() ([]string, error) { deviceDirs, err := ioutil.ReadDir(fs.sys.Path(sysBlockPath)) if err != nil { diff --git a/btrfs/get.go b/btrfs/get.go index fa70daa51..cb28959e1 100644 --- a/btrfs/get.go +++ b/btrfs/get.go @@ -80,7 +80,7 @@ func (fs FS) Stats() ([]*Stats, error) { return stats, nil } -// GetStats collects all Btrfs statistics from sysfs +// GetStats collects all Btrfs statistics from sysfs. func GetStats(uuidPath string) (*Stats, error) { r := &reader{path: uuidPath} s := r.readFilesystemStats() @@ -162,7 +162,7 @@ func (r *reader) readAllocationStats(d string) (a *AllocationStats) { return } -// readLayouts reads all Btrfs layout statistics for the current path +// readLayouts reads all Btrfs layout statistics for the current path. func (r *reader) readLayouts() map[string]*LayoutUsage { files, err := ioutil.ReadDir(r.path) if err != nil { diff --git a/cpuinfo.go b/cpuinfo.go index 5623b24a1..0c09336d8 100644 --- a/cpuinfo.go +++ b/cpuinfo.go @@ -27,7 +27,7 @@ import ( "github.com/prometheus/procfs/internal/util" ) -// CPUInfo contains general information about a system CPU found in /proc/cpuinfo +// CPUInfo contains general information about a system CPU found in /proc/cpuinfo. type CPUInfo struct { Processor uint VendorID string @@ -469,7 +469,7 @@ func parseCPUInfoDummy(_ []byte) ([]CPUInfo, error) { // nolint:unused,deadcode } // firstNonEmptyLine advances the scanner to the first non-empty line -// and returns the contents of that line +// and returns the contents of that line. func firstNonEmptyLine(scanner *bufio.Scanner) string { for scanner.Scan() { line := scanner.Text() diff --git a/internal/fs/fs.go b/internal/fs/fs.go index 0040753b1..3c18c7610 100644 --- a/internal/fs/fs.go +++ b/internal/fs/fs.go @@ -26,7 +26,7 @@ const ( // DefaultSysMountPoint is the common mount point of the sys filesystem. DefaultSysMountPoint = "/sys" - // DefaultConfigfsMountPoint is the common mount point of the configfs + // DefaultConfigfsMountPoint is the common mount point of the configfs. DefaultConfigfsMountPoint = "/sys/kernel/config" ) diff --git a/iscsi/get.go b/iscsi/get.go index 14d7062f6..347edd993 100644 --- a/iscsi/get.go +++ b/iscsi/get.go @@ -26,8 +26,8 @@ import ( "github.com/prometheus/procfs/internal/util" ) -// GetStats is the main iscsi status information func -// building the path and prepare info for enable iscsi +// GetStats is the main iscsi status information func for +// building the path and prepare info for enable iscsi. func GetStats(iqnPath string) (*Stats, error) { var istats Stats @@ -58,8 +58,7 @@ func GetStats(iqnPath string) (*Stats, error) { return &istats, nil } -// isPathEnable is a utility function -// check if the file "enable" contain enable message +// isPathEnable checks if the file "enable" contain enable message. func isPathEnable(path string) (bool, error) { enableReadout, err := ioutil.ReadFile(filepath.Join(path, "enable")) if err != nil { @@ -104,7 +103,7 @@ func getLunLinkTarget(lunPath string) (lunObject LUN, err error) { } // ReadWriteOPS read and return the stat of read and write in megabytes, -// and total commands that send to the target +// and total commands that send to the target. func ReadWriteOPS(iqnPath string, tpgt string, lun string) (readmb uint64, writemb uint64, iops uint64, err error) { @@ -133,7 +132,7 @@ func ReadWriteOPS(iqnPath string, tpgt string, lun string) (readmb uint64, } // GetFileioUdev is getting the actual info to build up -// the FILEIO data and match with the enable target +// the FILEIO data and match with the enable target. func (fs FS) GetFileioUdev(fileioNumber string, objectName string) (*FILEIO, error) { fileio := FILEIO{ Name: "fileio_" + fileioNumber, @@ -155,7 +154,7 @@ func (fs FS) GetFileioUdev(fileioNumber string, objectName string) (*FILEIO, err } // GetIblockUdev is getting the actual info to build up -// the IBLOCK data and match with the enable target +// the IBLOCK data and match with the enable target. func (fs FS) GetIblockUdev(iblockNumber string, objectName string) (*IBLOCK, error) { iblock := IBLOCK{ Name: "iblock_" + iblockNumber, @@ -177,7 +176,7 @@ func (fs FS) GetIblockUdev(iblockNumber string, objectName string) (*IBLOCK, err } // GetRBDMatch is getting the actual info to build up -// the RBD data and match with the enable target +// the RBD data and match with the enable target. func (fs FS) GetRBDMatch(rbdNumber string, poolImage string) (*RBD, error) { rbd := RBD{ Name: "rbd_" + rbdNumber, @@ -222,7 +221,7 @@ func (fs FS) GetRBDMatch(rbdNumber string, poolImage string) (*RBD, error) { return nil, nil } -// GetRDMCPPath is getting the actual info to build up RDMCP data +// GetRDMCPPath is getting the actual info to build up RDMCP data. func (fs FS) GetRDMCPPath(rdmcpNumber string, objectName string) (*RDMCP, error) { rdmcp := RDMCP{ Name: "rd_mcp_" + rdmcpNumber, diff --git a/iscsi/iscsi.go b/iscsi/iscsi.go index 7bef01409..4ab7e36c3 100644 --- a/iscsi/iscsi.go +++ b/iscsi/iscsi.go @@ -23,21 +23,19 @@ import ( // iscsi target started with /sys/kernel/config/target/iscsi/iqn* // configfs + target/iscsi/iqn* -// iqnGlob is representing all the possible IQN +// iqnGlob is representing all the possible IQN. const iqnGlob = "target/iscsi/iqn*" // targetCore static path /sys/kernel/config/target/core for node_exporter -// reading runtime status +// reading runtime status. const targetCore = "target/core" // devicePath static path /sys/devices/rbd/[0-9]* for rbd devices to -// read at runtime status +// read at runtime status. const devicePath = "devices/rbd" // FS represents the pseudo-filesystem configfs, which provides an interface to -// iscsi kernel data structures in -// sysfs as /sys -// configfs as /sys/kernel/config +// iscsi kernel data structures in sysfs as /sys and configfs as /sys/kernel/config. type FS struct { sysfs *fs.FS configfs *fs.FS @@ -46,7 +44,7 @@ type FS struct { // NewFS returns a new configfs mounted under the given mount point. It will // error and return empty FS if the mount point can't be read. For the ease of // use, an empty string parameter configfsMountPoint will call internal fs for -// the default sys path as /sys/kernel/config +// the default sys path as /sys/kernel/config. func NewFS(sysfsPath string, configfsMountPoint string) (FS, error) { if strings.TrimSpace(sysfsPath) == "" { sysfsPath = fs.DefaultSysMountPoint @@ -65,12 +63,12 @@ func NewFS(sysfsPath string, configfsMountPoint string) (FS, error) { return FS{&sysfs, &configfs}, nil } -// helper function to get configfs path +// Path is a helper function to get configfs path. func (fs FS) Path(p ...string) string { return fs.configfs.Path(p...) } -// ISCSIStats getting iscsi runtime information +// ISCSIStats getting iscsi runtime information. func (fs FS) ISCSIStats() ([]*Stats, error) { matches, err := filepath.Glob(fs.configfs.Path(iqnGlob)) if err != nil { @@ -90,7 +88,7 @@ func (fs FS) ISCSIStats() ([]*Stats, error) { return stats, nil } -// TPGT struct for sys target portal group tag info +// TPGT struct for sys target portal group tag info. type TPGT struct { Name string // name of the tpgt group TpgtPath string // file path of tpgt @@ -98,7 +96,7 @@ type TPGT struct { Luns []LUN // the Luns that tpgt has } -// LUN struct for sys logical unit number info +// LUN struct for sys logical unit number info. type LUN struct { Name string // name of the lun LunPath string // file path of the lun @@ -107,7 +105,7 @@ type LUN struct { TypeNumber string // place holder for number of the device } -// FILEIO struct for backstore info +// FILEIO struct for backstore info. type FILEIO struct { Name string // name of the fileio Fnumber string // number related to the backstore @@ -115,7 +113,7 @@ type FILEIO struct { Filename string // link to the actual file being export } -// IBLOCK struct for backstore info +// IBLOCK struct for backstore info. type IBLOCK struct { Name string // name of the iblock Bnumber string // number related to the backstore @@ -123,7 +121,7 @@ type IBLOCK struct { Iblock string // link to the actual block being export } -// RBD struct for backstore info +// RBD struct for backstore info. type RBD struct { Name string // name of the rbd Rnumber string // number related to the backstore @@ -131,13 +129,13 @@ type RBD struct { Image string // place holder for the rbd image } -// RDMCP struct for backstore info +// RDMCP struct for backstore info. type RDMCP struct { Name string // name of the rdm_cp ObjectName string // place holder for object name } -// Stats struct for all targets info +// Stats struct for all targets info. type Stats struct { Name string Tpgt []TPGT diff --git a/loadavg.go b/loadavg.go index 0cce190ec..0096cafbd 100644 --- a/loadavg.go +++ b/loadavg.go @@ -21,7 +21,7 @@ import ( "github.com/prometheus/procfs/internal/util" ) -// LoadAvg represents an entry in /proc/loadavg +// LoadAvg represents an entry in /proc/loadavg. type LoadAvg struct { Load1 float64 Load5 float64 diff --git a/net_conntrackstat.go b/net_conntrackstat.go index 9964a3600..8300daca0 100644 --- a/net_conntrackstat.go +++ b/net_conntrackstat.go @@ -25,7 +25,7 @@ import ( ) // A ConntrackStatEntry represents one line from net/stat/nf_conntrack -// and contains netfilter conntrack statistics at one CPU core +// and contains netfilter conntrack statistics at one CPU core. type ConntrackStatEntry struct { Entries uint64 Found uint64 @@ -38,12 +38,12 @@ type ConntrackStatEntry struct { SearchRestart uint64 } -// ConntrackStat retrieves netfilter's conntrack statistics, split by CPU cores +// ConntrackStat retrieves netfilter's conntrack statistics, split by CPU cores. func (fs FS) ConntrackStat() ([]ConntrackStatEntry, error) { return readConntrackStat(fs.proc.Path("net", "stat", "nf_conntrack")) } -// Parses a slice of ConntrackStatEntries from the given filepath +// Parses a slice of ConntrackStatEntries from the given filepath. func readConntrackStat(path string) ([]ConntrackStatEntry, error) { // This file is small and can be read with one syscall. b, err := util.ReadFileNoStat(path) @@ -61,7 +61,7 @@ func readConntrackStat(path string) ([]ConntrackStatEntry, error) { return stat, nil } -// Reads the contents of a conntrack statistics file and parses a slice of ConntrackStatEntries +// Reads the contents of a conntrack statistics file and parses a slice of ConntrackStatEntries. func parseConntrackStat(r io.Reader) ([]ConntrackStatEntry, error) { var entries []ConntrackStatEntry @@ -79,7 +79,7 @@ func parseConntrackStat(r io.Reader) ([]ConntrackStatEntry, error) { return entries, nil } -// Parses a ConntrackStatEntry from given array of fields +// Parses a ConntrackStatEntry from given array of fields. func parseConntrackStatEntry(fields []string) (*ConntrackStatEntry, error) { if len(fields) != 17 { return nil, fmt.Errorf("invalid conntrackstat entry, missing fields") @@ -143,7 +143,7 @@ func parseConntrackStatEntry(fields []string) (*ConntrackStatEntry, error) { return entry, nil } -// Parses a uint64 from given hex in string +// Parses a uint64 from given hex in string. func parseConntrackStatField(field string) (uint64, error) { val, err := strconv.ParseUint(field, 16, 64) if err != nil { diff --git a/net_ip_socket.go b/net_ip_socket.go index 8c9ee3de8..7fd57d7f4 100644 --- a/net_ip_socket.go +++ b/net_ip_socket.go @@ -34,7 +34,7 @@ const ( readLimit = 4294967296 // Byte -> 4 GiB ) -// this contains generic data structures for both udp and tcp sockets +// This contains generic data structures for both udp and tcp sockets. type ( // NetIPSocket represents the contents of /proc/net/{t,u}dp{,6} file without the header. NetIPSocket []*netIPSocketLine diff --git a/net_protocols.go b/net_protocols.go index 8c6de3791..374b6f73f 100644 --- a/net_protocols.go +++ b/net_protocols.go @@ -23,7 +23,7 @@ import ( "github.com/prometheus/procfs/internal/util" ) -// NetProtocolStats stores the contents from /proc/net/protocols +// NetProtocolStats stores the contents from /proc/net/protocols. type NetProtocolStats map[string]NetProtocolStatLine // NetProtocolStatLine contains a single line parsed from /proc/net/protocols. We @@ -41,7 +41,7 @@ type NetProtocolStatLine struct { Capabilities NetProtocolCapabilities } -// NetProtocolCapabilities contains a list of capabilities for each protocol +// NetProtocolCapabilities contains a list of capabilities for each protocol. type NetProtocolCapabilities struct { Close bool // 8 Connect bool // 9 diff --git a/net_softnet.go b/net_softnet.go index 46f12c61d..a94f86dc4 100644 --- a/net_softnet.go +++ b/net_softnet.go @@ -30,13 +30,13 @@ import ( // * Linux 4.17 https://elixir.bootlin.com/linux/v4.17/source/net/core/net-procfs.c#L162 // and https://elixir.bootlin.com/linux/v4.17/source/include/linux/netdevice.h#L2810. -// SoftnetStat contains a single row of data from /proc/net/softnet_stat +// SoftnetStat contains a single row of data from /proc/net/softnet_stat. type SoftnetStat struct { - // Number of processed packets + // Number of processed packets. Processed uint32 - // Number of dropped packets + // Number of dropped packets. Dropped uint32 - // Number of times processing packets ran out of quota + // Number of times processing packets ran out of quota. TimeSqueezed uint32 } diff --git a/netstat.go b/netstat.go index 12e2318bf..dcea9c5a6 100644 --- a/netstat.go +++ b/netstat.go @@ -21,13 +21,13 @@ import ( "strings" ) -// NetStat contains statistics for all the counters from one file +// NetStat contains statistics for all the counters from one file. type NetStat struct { Stats map[string][]uint64 Filename string } -// NetStat retrieves stats from /proc/net/stat/ +// NetStat retrieves stats from `/proc/net/stat/`. func (fs FS) NetStat() ([]NetStat, error) { statFiles, err := filepath.Glob(fs.proc.Path("net/stat/*")) if err != nil { diff --git a/nfs/nfs.go b/nfs/nfs.go index 96e69ca56..6bf1b80c6 100644 --- a/nfs/nfs.go +++ b/nfs/nfs.go @@ -199,10 +199,12 @@ type ServerV4Stats struct { } // V4Ops models the "proc4ops" line: NFSv4 operations -// Variable list, see: -// v4.0 https://tools.ietf.org/html/rfc3010 (38 operations) -// v4.1 https://tools.ietf.org/html/rfc5661 (58 operations) -// v4.2 https://tools.ietf.org/html/draft-ietf-nfsv4-minorversion2-41 (71 operations) +// Variable list. +// See: +// - v4.0 https://tools.ietf.org/html/rfc3010 (38 operations) +// - v4.1 https://tools.ietf.org/html/rfc5661 (58 operations) +// - v4.2 https://tools.ietf.org/html/draft-ietf-nfsv4-minorversion2-41 (71 operations) +//nolint:godot type V4Ops struct { //Values uint64 // Variable depending on v4.x sub-version. TODO: Will this always at least include the fields in this struct? Op0Unused uint64 diff --git a/nfs/parse_nfs.go b/nfs/parse_nfs.go index 5de06b960..02bd5a95e 100644 --- a/nfs/parse_nfs.go +++ b/nfs/parse_nfs.go @@ -22,7 +22,7 @@ import ( "github.com/prometheus/procfs/internal/util" ) -// ParseClientRPCStats returns stats read from /proc/net/rpc/nfs +// ParseClientRPCStats returns stats read from /proc/net/rpc/nfs. func ParseClientRPCStats(r io.Reader) (*ClientRPCStats, error) { stats := &ClientRPCStats{} diff --git a/nfs/parse_nfsd.go b/nfs/parse_nfsd.go index 55c18f370..857ae3b96 100644 --- a/nfs/parse_nfsd.go +++ b/nfs/parse_nfsd.go @@ -22,7 +22,7 @@ import ( "github.com/prometheus/procfs/internal/util" ) -// ParseServerRPCStats returns stats read from /proc/net/rpc/nfsd +// ParseServerRPCStats returns stats read from /proc/net/rpc/nfsd. func ParseServerRPCStats(r io.Reader) (*ServerRPCStats, error) { stats := &ServerRPCStats{} diff --git a/proc.go b/proc.go index 28f696803..5b3e1e4a9 100644 --- a/proc.go +++ b/proc.go @@ -82,7 +82,7 @@ func (fs FS) Self() (Proc, error) { // NewProc returns a process for the given pid. // -// Deprecated: use fs.Proc() instead +// Deprecated: Use fs.Proc() instead. func (fs FS) NewProc(pid int) (Proc, error) { return fs.Proc(pid) } @@ -185,7 +185,7 @@ func (p Proc) Cwd() (string, error) { return wd, err } -// RootDir returns the absolute path to the process's root directory (as set by chroot) +// RootDir returns the absolute path to the process's root directory (as set by chroot). func (p Proc) RootDir() (string, error) { rdir, err := os.Readlink(p.path("root")) if os.IsNotExist(err) { diff --git a/proc_cgroup.go b/proc_cgroup.go index be45b7987..cca03327c 100644 --- a/proc_cgroup.go +++ b/proc_cgroup.go @@ -45,7 +45,7 @@ type Cgroup struct { } // parseCgroupString parses each line of the /proc/[pid]/cgroup file -// Line format is hierarchyID:[controller1,controller2]:path +// Line format is hierarchyID:[controller1,controller2]:path. func parseCgroupString(cgroupStr string) (*Cgroup, error) { var err error @@ -69,7 +69,7 @@ func parseCgroupString(cgroupStr string) (*Cgroup, error) { return cgroup, nil } -// parseCgroups reads each line of the /proc/[pid]/cgroup file +// parseCgroups reads each line of the /proc/[pid]/cgroup file. func parseCgroups(data []byte) ([]Cgroup, error) { var cgroups []Cgroup scanner := bufio.NewScanner(bytes.NewReader(data)) @@ -88,7 +88,7 @@ func parseCgroups(data []byte) ([]Cgroup, error) { // Cgroups reads from /proc//cgroups and returns a []*Cgroup struct locating this PID in each process // control hierarchy running on this system. On every system (v1 and v2), all hierarchies contain all processes, -// so the len of the returned struct is equal to the number of active hierarchies on this system +// so the len of the returned struct is equal to the number of active hierarchies on this system. func (p Proc) Cgroups() ([]Cgroup, error) { data, err := util.ReadFileNoStat(p.path("cgroup")) if err != nil { diff --git a/proc_environ.go b/proc_environ.go index 6134b3580..57a89895d 100644 --- a/proc_environ.go +++ b/proc_environ.go @@ -19,7 +19,7 @@ import ( "github.com/prometheus/procfs/internal/util" ) -// Environ reads process environments from /proc//environ +// Environ reads process environments from `/proc//environ`. func (p Proc) Environ() ([]string, error) { environments := make([]string, 0) diff --git a/proc_fdinfo.go b/proc_fdinfo.go index cf63227f0..1bbdd4a8e 100644 --- a/proc_fdinfo.go +++ b/proc_fdinfo.go @@ -22,7 +22,6 @@ import ( "github.com/prometheus/procfs/internal/util" ) -// Regexp variables var ( rPos = regexp.MustCompile(`^pos:\s+(\d+)$`) rFlags = regexp.MustCompile(`^flags:\s+(\d+)$`) @@ -122,7 +121,7 @@ func (p ProcFDInfos) Len() int { return len(p) } func (p ProcFDInfos) Swap(i, j int) { p[i], p[j] = p[j], p[i] } func (p ProcFDInfos) Less(i, j int) bool { return p[i].FD < p[j].FD } -// InotifyWatchLen returns the total number of inotify watches +// InotifyWatchLen returns the total number of inotify watches. func (p ProcFDInfos) InotifyWatchLen() (int, error) { length := 0 for _, f := range p { diff --git a/proc_limits.go b/proc_limits.go index dd20f198a..7a1388185 100644 --- a/proc_limits.go +++ b/proc_limits.go @@ -79,7 +79,7 @@ var ( // NewLimits returns the current soft limits of the process. // -// Deprecated: use p.Limits() instead +// Deprecated: Use p.Limits() instead. func (p Proc) NewLimits() (ProcLimits, error) { return p.Limits() } diff --git a/proc_maps.go b/proc_maps.go index 8425e3082..ddc13b391 100644 --- a/proc_maps.go +++ b/proc_maps.go @@ -26,7 +26,7 @@ import ( "golang.org/x/sys/unix" ) -// ProcMapPermissions contains permission settings read from /proc/[pid]/maps +// ProcMapPermissions contains permission settings read from `/proc/[pid]/maps`. type ProcMapPermissions struct { // mapping has the [R]ead flag set Read bool @@ -40,8 +40,8 @@ type ProcMapPermissions struct { Private bool } -// ProcMap contains the process memory-mappings of the process, -// read from /proc/[pid]/maps +// ProcMap contains the process memory-mappings of the process +// read from `/proc/[pid]/maps`. type ProcMap struct { // The start address of current mapping. StartAddr uintptr @@ -80,7 +80,7 @@ func parseDevice(s string) (uint64, error) { return unix.Mkdev(uint32(major), uint32(minor)), nil } -// parseAddress just converts a hex-string to a uintptr +// parseAddress converts a hex-string to a uintptr. func parseAddress(s string) (uintptr, error) { a, err := strconv.ParseUint(s, 16, 0) if err != nil { @@ -90,7 +90,7 @@ func parseAddress(s string) (uintptr, error) { return uintptr(a), nil } -// parseAddresses parses the start-end address +// parseAddresses parses the start-end address. func parseAddresses(s string) (uintptr, uintptr, error) { toks := strings.Split(s, "-") if len(toks) < 2 { diff --git a/proc_psi.go b/proc_psi.go index dc6c14f0a..a68fe1529 100644 --- a/proc_psi.go +++ b/proc_psi.go @@ -35,9 +35,10 @@ import ( const lineFormat = "avg10=%f avg60=%f avg300=%f total=%d" -// PSILine is a single line of values as returned by /proc/pressure/* -// The Avg entries are averages over n seconds, as a percentage -// The Total line is in microseconds +// PSILine is a single line of values as returned by `/proc/pressure/*`. +// +// The Avg entries are averages over n seconds, as a percentage. +// The Total line is in microseconds. type PSILine struct { Avg10 float64 Avg60 float64 @@ -46,8 +47,9 @@ type PSILine struct { } // PSIStats represent pressure stall information from /proc/pressure/* -// Some indicates the share of time in which at least some tasks are stalled -// Full indicates the share of time in which all non-idle tasks are stalled simultaneously +// +// "Some" indicates the share of time in which at least some tasks are stalled. +// "Full" indicates the share of time in which all non-idle tasks are stalled simultaneously. type PSIStats struct { Some *PSILine Full *PSILine @@ -65,7 +67,7 @@ func (fs FS) PSIStatsForResource(resource string) (PSIStats, error) { return parsePSIStats(resource, bytes.NewReader(data)) } -// parsePSIStats parses the specified file for pressure stall information +// parsePSIStats parses the specified file for pressure stall information. func parsePSIStats(resource string, r io.Reader) (PSIStats, error) { psiStats := PSIStats{} diff --git a/proc_psi_test.go b/proc_psi_test.go index f7a1b6984..3903a18b1 100644 --- a/proc_psi_test.go +++ b/proc_psi_test.go @@ -107,7 +107,7 @@ func TestPSIStats(t *testing.T) { } } -// TestParsePSIStats tests the edge cases that we won't run into when running TestPSIStats +// TestParsePSIStats tests the edge cases that we won't run into when running TestPSIStats. func TestParsePSIStats(t *testing.T) { t.Run("unknown measurement type", func(t *testing.T) { raw := "nonesense haha test=fake" diff --git a/proc_smaps.go b/proc_smaps.go index a576a720a..664b9f184 100644 --- a/proc_smaps.go +++ b/proc_smaps.go @@ -28,30 +28,30 @@ import ( ) var ( - // match the header line before each mapped zone in /proc/pid/smaps + // match the header line before each mapped zone in `/proc/pid/smaps`. procSMapsHeaderLine = regexp.MustCompile(`^[a-f0-9].*$`) ) type ProcSMapsRollup struct { - // Amount of the mapping that is currently resident in RAM + // Amount of the mapping that is currently resident in RAM. Rss uint64 - // Process's proportional share of this mapping + // Process's proportional share of this mapping. Pss uint64 - // Size in bytes of clean shared pages + // Size in bytes of clean shared pages. SharedClean uint64 - // Size in bytes of dirty shared pages + // Size in bytes of dirty shared pages. SharedDirty uint64 - // Size in bytes of clean private pages + // Size in bytes of clean private pages. PrivateClean uint64 - // Size in bytes of dirty private pages + // Size in bytes of dirty private pages. PrivateDirty uint64 - // Amount of memory currently marked as referenced or accessed + // Amount of memory currently marked as referenced or accessed. Referenced uint64 - // Amount of memory that does not belong to any file + // Amount of memory that does not belong to any file. Anonymous uint64 - // Amount would-be-anonymous memory currently on swap + // Amount would-be-anonymous memory currently on swap. Swap uint64 - // Process's proportional memory on swap + // Process's proportional memory on swap. SwapPss uint64 } diff --git a/proc_stat.go b/proc_stat.go index ad03d85ef..06c556ef9 100644 --- a/proc_stat.go +++ b/proc_stat.go @@ -115,7 +115,7 @@ type ProcStat struct { // NewStat returns the current status information of the process. // -// Deprecated: use p.Stat() instead +// Deprecated: Use p.Stat() instead. func (p Proc) NewStat() (ProcStat, error) { return p.Stat() } diff --git a/proc_status.go b/proc_status.go index 6edd8333b..594022ded 100644 --- a/proc_status.go +++ b/proc_status.go @@ -33,37 +33,37 @@ type ProcStatus struct { TGID int // Peak virtual memory size. - VmPeak uint64 // nolint:golint + VmPeak uint64 // nolint:revive // Virtual memory size. - VmSize uint64 // nolint:golint + VmSize uint64 // nolint:revive // Locked memory size. - VmLck uint64 // nolint:golint + VmLck uint64 // nolint:revive // Pinned memory size. - VmPin uint64 // nolint:golint + VmPin uint64 // nolint:revive // Peak resident set size. - VmHWM uint64 // nolint:golint + VmHWM uint64 // nolint:revive // Resident set size (sum of RssAnnon RssFile and RssShmem). - VmRSS uint64 // nolint:golint + VmRSS uint64 // nolint:revive // Size of resident anonymous memory. - RssAnon uint64 // nolint:golint + RssAnon uint64 // nolint:revive // Size of resident file mappings. - RssFile uint64 // nolint:golint + RssFile uint64 // nolint:revive // Size of resident shared memory. - RssShmem uint64 // nolint:golint + RssShmem uint64 // nolint:revive // Size of data segments. - VmData uint64 // nolint:golint + VmData uint64 // nolint:revive // Size of stack segments. - VmStk uint64 // nolint:golint + VmStk uint64 // nolint:revive // Size of text segments. - VmExe uint64 // nolint:golint + VmExe uint64 // nolint:revive // Shared library code size. - VmLib uint64 // nolint:golint + VmLib uint64 // nolint:revive // Page table entries size. - VmPTE uint64 // nolint:golint + VmPTE uint64 // nolint:revive // Size of second-level page tables. - VmPMD uint64 // nolint:golint + VmPMD uint64 // nolint:revive // Swapped-out virtual memory size by anonymous private. - VmSwap uint64 // nolint:golint + VmSwap uint64 // nolint:revive // Size of hugetlb memory portions HugetlbPages uint64 diff --git a/schedstat.go b/schedstat.go index 28228164e..5f7f32dc8 100644 --- a/schedstat.go +++ b/schedstat.go @@ -40,7 +40,7 @@ type Schedstat struct { CPUs []*SchedstatCPU } -// SchedstatCPU contains the values from one "cpu" line +// SchedstatCPU contains the values from one "cpu" line. type SchedstatCPU struct { CPUNum string @@ -49,14 +49,14 @@ type SchedstatCPU struct { RunTimeslices uint64 } -// ProcSchedstat contains the values from /proc//schedstat +// ProcSchedstat contains the values from `/proc//schedstat`. type ProcSchedstat struct { RunningNanoseconds uint64 WaitingNanoseconds uint64 RunTimeslices uint64 } -// Schedstat reads data from /proc/schedstat +// Schedstat reads data from `/proc/schedstat`. func (fs FS) Schedstat() (*Schedstat, error) { file, err := os.Open(fs.proc.Path("schedstat")) if err != nil { diff --git a/schedstat_test.go b/schedstat_test.go index c6bee611b..80185dc9e 100644 --- a/schedstat_test.go +++ b/schedstat_test.go @@ -97,7 +97,7 @@ func TestProcSchedstatErrors(t *testing.T) { } } -// schedstat can have a 2nd line: it should be ignored +// schedstat can have a 2nd line: it should be ignored. func TestProcSchedstatMultipleLines(t *testing.T) { schedstat, err := parseProcSchedstat("123 456 789\n10 11\n") if err != nil { diff --git a/slab.go b/slab.go index 7896fd724..bc9aaf5c2 100644 --- a/slab.go +++ b/slab.go @@ -137,7 +137,7 @@ func parseSlabInfo21(r *bytes.Reader) (SlabInfo, error) { return s, nil } -// SlabInfo reads data from /proc/slabinfo +// SlabInfo reads data from `/proc/slabinfo`. func (fs FS) SlabInfo() (SlabInfo, error) { // TODO: Consider passing options to allow for parsing different // slabinfo versions. However, slabinfo 2.1 has been stable since diff --git a/stat.go b/stat.go index 6d8727541..33f97caa0 100644 --- a/stat.go +++ b/stat.go @@ -41,7 +41,7 @@ type CPUStat struct { // SoftIRQStat represent the softirq statistics as exported in the procfs stat file. // A nice introduction can be found at https://0xax.gitbooks.io/linux-insides/content/interrupts/interrupts-9.html -// It is possible to get per-cpu stats by reading /proc/softirqs +// It is possible to get per-cpu stats by reading `/proc/softirqs`. type SoftIRQStat struct { Hi uint64 Timer uint64 @@ -145,7 +145,7 @@ func parseSoftIRQStat(line string) (SoftIRQStat, uint64, error) { // NewStat returns information about current cpu/process statistics. // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt // -// Deprecated: use fs.Stat() instead +// Deprecated: Use fs.Stat() instead. func NewStat() (Stat, error) { fs, err := NewFS(fs.DefaultProcMountPoint) if err != nil { @@ -155,15 +155,15 @@ func NewStat() (Stat, error) { } // NewStat returns information about current cpu/process statistics. -// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt +// See: https://www.kernel.org/doc/Documentation/filesystems/proc.txt // -// Deprecated: use fs.Stat() instead +// Deprecated: Use fs.Stat() instead. func (fs FS) NewStat() (Stat, error) { return fs.Stat() } // Stat returns information about current cpu/process statistics. -// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt +// See: https://www.kernel.org/doc/Documentation/filesystems/proc.txt func (fs FS) Stat() (Stat, error) { fileName := fs.proc.Path("stat") data, err := util.ReadFileNoStat(fileName) diff --git a/sysfs/class_fibrechannel.go b/sysfs/class_fibrechannel.go index 96584e74e..a0c49eb8d 100644 --- a/sysfs/class_fibrechannel.go +++ b/sysfs/class_fibrechannel.go @@ -83,7 +83,7 @@ func (fs FS) FibreChannelClass() (FibreChannelClass, error) { return fcc, nil } -// Parse a single FC host +// Parse a single FC host. func (fs FS) parseFibreChannelHost(name string) (*FibreChannelHost, error) { path := fs.sys.Path(fibrechannelClassPath, name) host := FibreChannelHost{Name: name} diff --git a/sysfs/class_infiniband.go b/sysfs/class_infiniband.go index 7adebe888..7b7a86ffa 100644 --- a/sysfs/class_infiniband.go +++ b/sysfs/class_infiniband.go @@ -164,7 +164,7 @@ func (fs FS) parseInfiniBandDevice(name string) (*InfiniBandDevice, error) { return &device, nil } -// Parse InfiniBand state. Expected format: ": " +// Parse InfiniBand state. Expected format: ": ". func parseState(s string) (uint, string, error) { parts := strings.Split(s, ":") if len(parts) != 2 { @@ -179,7 +179,7 @@ func parseState(s string) (uint, string, error) { return id, name, nil } -// Parse rate (example: "100 Gb/sec (4X EDR)") and return it as bytes/second +// Parse rate (example: "100 Gb/sec (4X EDR)") and return it as bytes/second. func parseRate(s string) (uint64, error) { parts := strings.SplitAfterN(s, " ", 2) if len(parts) != 2 { diff --git a/sysfs/class_powercap.go b/sysfs/class_powercap.go index 208e80907..f0321909f 100644 --- a/sysfs/class_powercap.go +++ b/sysfs/class_powercap.go @@ -25,7 +25,7 @@ import ( "github.com/prometheus/procfs/internal/util" ) -// RaplZone stores the information for one RAPL power zone +// RaplZone stores the information for one RAPL power zone. type RaplZone struct { Name string // name of RAPL zone from file "name" Index int // index (different value for duplicate names) @@ -33,9 +33,9 @@ type RaplZone struct { MaxMicrojoules uint64 // max RAPL microjoule value } -// GetRaplZones returns a slice of RaplZones -// When RAPL files are not present, returns nil with error -// https://www.kernel.org/doc/Documentation/power/powercap/powercap.txt +// GetRaplZones returns a slice of RaplZones. When RAPL files are not present, +// returns nil with error. +// - https://www.kernel.org/doc/Documentation/power/powercap/powercap.txt func GetRaplZones(fs FS) ([]RaplZone, error) { raplDir := fs.sys.Path("class/powercap") @@ -46,15 +46,15 @@ func GetRaplZones(fs FS) ([]RaplZone, error) { var zones []RaplZone - // count name usages to avoid duplicates (label them with an index) + // Count name usages to avoid duplicates (label them with an index). countNameUsages := make(map[string]int) - // loop through directory files searching for file "name" from subdirs + // Loop through directory files searching for file "name" from subdirs. for _, f := range files { nameFile := filepath.Join(raplDir, f.Name(), "/name") nameBytes, err := ioutil.ReadFile(nameFile) if err == nil { - // add new rapl zone since name file was found + // Add new rapl zone since name file was found. name := strings.TrimSpace(string(nameBytes)) // get a pair of index and final name diff --git a/sysfs/class_scsitape.go b/sysfs/class_scsitape.go index d227c10fa..371b4ae97 100644 --- a/sysfs/class_scsitape.go +++ b/sysfs/class_scsitape.go @@ -75,7 +75,7 @@ func (fs FS) SCSITapeClass() (SCSITapeClass, error) { return stc, nil } -// Parse a single scsi_tape +// Parse a single scsi_tape. func (fs FS) parseSCSITape(name string) (*SCSITape, error) { path := fs.sys.Path(scsiTapeClassPath, name) tape := SCSITape{Name: name} diff --git a/sysfs/clocksource.go b/sysfs/clocksource.go index b857f750d..ac507396d 100644 --- a/sysfs/clocksource.go +++ b/sysfs/clocksource.go @@ -22,7 +22,7 @@ import ( "github.com/prometheus/procfs/internal/util" ) -// ClockSource contains metrics related to the clock source +// ClockSource contains metrics related to the clock source. type ClockSource struct { Name string Available []string @@ -30,7 +30,7 @@ type ClockSource struct { } // ClockSources returns clocksource information including current and available clocksources -// read from '/sys/devices/system/clocksource' +// read from '/sys/devices/system/clocksource'. func (fs FS) ClockSources() ([]ClockSource, error) { clocksourcePaths, err := filepath.Glob(fs.sys.Path("devices/system/clocksource/clocksource[0-9]*")) diff --git a/sysfs/net_class.go b/sysfs/net_class.go index c1fed2bc0..6dff98e69 100644 --- a/sysfs/net_class.go +++ b/sysfs/net_class.go @@ -82,7 +82,7 @@ func (fs FS) NetClassDevices() ([]string, error) { return res, nil } -// NetClassByIface returns info for a single net interfaces (iface) +// NetClassByIface returns info for a single net interfaces (iface). func (fs FS) NetClassByIface(devicePath string) (*NetClassIface, error) { path := fs.sys.Path(netclassPath) diff --git a/sysfs/system_cpu.go b/sysfs/system_cpu.go index a4e616765..40fc94b43 100644 --- a/sysfs/system_cpu.go +++ b/sysfs/system_cpu.go @@ -25,15 +25,15 @@ import ( "github.com/prometheus/procfs/internal/util" ) -// CPU represents a path to a CPU located in /sys/devices/system/cpu/cpu[0-9]* +// CPU represents a path to a CPU located in `/sys/devices/system/cpu/cpu[0-9]*`. type CPU string -// Number returns the ID number of the given CPU +// Number returns the ID number of the given CPU. func (c CPU) Number() string { return strings.TrimPrefix(filepath.Base(string(c)), "cpu") } -// CPUTopology contains data located in /sys/devices/system/cpu/cpu[0-9]*/topology +// CPUTopology contains data located in `/sys/devices/system/cpu/cpu[0-9]*/topology`. type CPUTopology struct { CoreID string CoreSiblingsList string @@ -41,13 +41,13 @@ type CPUTopology struct { ThreadSiblingsList string } -// CPUThermalThrottle contains data from /sys/devices/system/cpu/cpu[0-9]*/thermal_throttle +// CPUThermalThrottle contains data from `/sys/devices/system/cpu/cpu[0-9]*/thermal_throttle`. type CPUThermalThrottle struct { CoreThrottleCount uint64 PackageThrottleCount uint64 } -// SystemCPUCpufreqStats contains stats from devices/system/cpu/cpu[0-9]*/cpufreq/... +// SystemCPUCpufreqStats contains stats from `/sys/devices/system/cpu/cpu[0-9]*/cpufreq/...`. type SystemCPUCpufreqStats struct { Name string CpuinfoCurrentFrequency *uint64 @@ -64,7 +64,7 @@ type SystemCPUCpufreqStats struct { SetSpeed string } -// CPUs returns a slice of all CPUs in /sys/devices/system/cpu +// CPUs returns a slice of all CPUs in `/sys/devices/system/cpu`. func (fs FS) CPUs() ([]CPU, error) { cpuPaths, err := filepath.Glob(fs.sys.Path("devices/system/cpu/cpu[0-9]*")) if err != nil { @@ -77,7 +77,7 @@ func (fs FS) CPUs() ([]CPU, error) { return cpus, nil } -// Topology gets the topology information for a single CPU from /sys/devices/system/cpu/cpuN/topology +// Topology gets the topology information for a single CPU from `/sys/devices/system/cpu/cpuN/topology`. func (c CPU) Topology() (*CPUTopology, error) { cpuTopologyPath := filepath.Join(string(c), "topology") if _, err := os.Stat(cpuTopologyPath); err != nil { @@ -112,7 +112,7 @@ func parseCPUTopology(cpuPath string) (*CPUTopology, error) { return &t, nil } -// ThermalThrottle gets the cpu throttle count information for a single CPU from /sys/devices/system/cpu/cpuN/thermal_throttle +// ThermalThrottle gets the cpu throttle count information for a single CPU from `/sys/devices/system/cpu/cpuN/thermal_throttle`. func (c CPU) ThermalThrottle() (*CPUThermalThrottle, error) { cpuPath := filepath.Join(string(c), "thermal_throttle") if _, err := os.Stat(cpuPath); err != nil { diff --git a/sysfs/vulnerability.go b/sysfs/vulnerability.go index 9e2d9cdbd..477135fa1 100644 --- a/sysfs/vulnerability.go +++ b/sysfs/vulnerability.go @@ -55,7 +55,7 @@ func (fs FS) CPUVulnerabilities() ([]Vulnerability, error) { return vulnerabilities, nil } -// Vulnerability represents a single vulnerability extracted from /sys/devices/system/cpu/vulnerabilities/ +// Vulnerability represents a single vulnerability extracted from /sys/devices/system/cpu/vulnerabilities/. type Vulnerability struct { CodeName string State string diff --git a/vm.go b/vm.go index cb1389141..f53f98ed6 100644 --- a/vm.go +++ b/vm.go @@ -29,7 +29,7 @@ import ( // https://www.kernel.org/doc/Documentation/sysctl/vm.txt // Each setting is exposed as a single file. // Each file contains one line with a single numerical value, except lowmem_reserve_ratio which holds an array -// and numa_zonelist_order (deprecated) which is a string +// and numa_zonelist_order (deprecated) which is a string. type VM struct { AdminReserveKbytes *int64 // /proc/sys/vm/admin_reserve_kbytes BlockDump *int64 // /proc/sys/vm/block_dump diff --git a/xfs/parse.go b/xfs/parse.go index 260501e69..bb5e8faa6 100644 --- a/xfs/parse.go +++ b/xfs/parse.go @@ -247,7 +247,7 @@ func logOperationStats(us []uint32) (LogOperationStats, error) { }, nil } -// push_ail +// pushAilStats handles push_ail stats. func pushAilStats(us []uint32) (PushAilStats, error) { if l := len(us); l != 10 { return PushAilStats{}, fmt.Errorf("incorrect number of values for XFS push ail stats: %d", l) @@ -267,7 +267,7 @@ func pushAilStats(us []uint32) (PushAilStats, error) { }, nil } -// xstrat +// xStratStats handles xstrat stats. func xStratStats(us []uint32) (XstratStats, error) { if l := len(us); l != 2 { return XstratStats{}, fmt.Errorf("incorrect number of values for XFS xstrat stats: %d", l) @@ -279,7 +279,7 @@ func xStratStats(us []uint32) (XstratStats, error) { }, nil } -// rw +// readWriteStats handles rw stats. func readWriteStats(us []uint32) (ReadWriteStats, error) { if l := len(us); l != 2 { return ReadWriteStats{}, fmt.Errorf("incorrect number of values for XFS read write stats: %d", l) @@ -417,7 +417,7 @@ func debugStats(us []uint32) (DebugStats, error) { }, nil } -// abtb2 +// btreeAllocBlocks2Stats handles abtb2 stats. func btreeAllocBlocks2Stats(us []uint32) (BtreeAllocBlocks2Stats, error) { if l := len(us); l != 15 { return BtreeAllocBlocks2Stats{}, fmt.Errorf("incorrect number of values for abtb2 stats: %d", 1) @@ -442,7 +442,7 @@ func btreeAllocBlocks2Stats(us []uint32) (BtreeAllocBlocks2Stats, error) { }, nil } -// abtc2 +// btreeAllocContig2Stats handles abtc2 stats. func btreeAllocContig2Stats(us []uint32) (BtreeAllocContig2Stats, error) { if l := len(us); l != 15 { return BtreeAllocContig2Stats{}, fmt.Errorf("incorrect number of values for abtc2 stats: %d", 1) @@ -467,7 +467,7 @@ func btreeAllocContig2Stats(us []uint32) (BtreeAllocContig2Stats, error) { }, nil } -// bmbt2 +// btreeBlockMap2Stats handles bmbt2 stats. func btreeBlockMap2Stats(us []uint32) (BtreeBlockMap2Stats, error) { if l := len(us); l != 15 { return BtreeBlockMap2Stats{}, fmt.Errorf("incorrect number of values for bmbt2 stats: %d", 1) @@ -492,7 +492,7 @@ func btreeBlockMap2Stats(us []uint32) (BtreeBlockMap2Stats, error) { }, nil } -// ibt2 +// btreeInode2Stats handles ibt2 stats. func btreeInode2Stats(us []uint32) (BtreeInode2Stats, error) { if l := len(us); l != 15 { return BtreeInode2Stats{}, fmt.Errorf("incorrect number of values for ibt2 stats: %d", 1)