From 6acd75f31dccf7a7374391c098bc64bc76d0256a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 06:33:43 +0200 Subject: [PATCH 01/69] Bump golang.org/x/sys from 0.21.0 to 0.22.0 (#656) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.21.0 to 0.22.0. - [Commits](https://github.com/golang/sys/compare/v0.21.0...v0.22.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8b7c4f47..00efa9b6 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.20 require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.7.0 - golang.org/x/sys v0.21.0 + golang.org/x/sys v0.22.0 ) diff --git a/go.sum b/go.sum index 535a646e..35019176 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 09209a4d52330dff700b57d52b8c3787000186c9 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Fri, 2 Aug 2024 06:34:03 +0200 Subject: [PATCH 02/69] Update common Prometheus files (#652) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 4 ++-- Makefile.common | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 8de7af63..83ae3906 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Install Go uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 with: @@ -36,4 +36,4 @@ jobs: uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1 with: args: --verbose - version: v1.59.0 + version: v1.59.1 diff --git a/Makefile.common b/Makefile.common index 16172923..e3da72ab 100644 --- a/Makefile.common +++ b/Makefile.common @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.59.0 +GOLANGCI_LINT_VERSION ?= v1.59.1 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) From b4e04cdd63a9187e85c99eb17825435f0d0084a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 08:07:56 +0200 Subject: [PATCH 03/69] Bump golang.org/x/sys from 0.22.0 to 0.24.0 (#661) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.22.0 to 0.24.0. - [Commits](https://github.com/golang/sys/compare/v0.22.0...v0.24.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 00efa9b6..9d58eaf2 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.20 require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.7.0 - golang.org/x/sys v0.22.0 + golang.org/x/sys v0.24.0 ) diff --git a/go.sum b/go.sum index 35019176..6a09bb7b 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 1808690d14ff4feb1e430cf5e6ed4f4ae6ccd617 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 08:12:11 +0200 Subject: [PATCH 04/69] Bump golang.org/x/sync from 0.7.0 to 0.8.0 (#660) Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.7.0 to 0.8.0. - [Commits](https://github.com/golang/sync/compare/v0.7.0...v0.8.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 9d58eaf2..6279cd78 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.20 require ( github.com/google/go-cmp v0.6.0 - golang.org/x/sync v0.7.0 + golang.org/x/sync v0.8.0 golang.org/x/sys v0.24.0 ) diff --git a/go.sum b/go.sum index 6a09bb7b..8df1b749 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 65f78fc3bd6bbc9c98faebc6c918e8c4e8372641 Mon Sep 17 00:00:00 2001 From: Muhammad Shahzeb Date: Fri, 6 Sep 2024 21:35:40 +0500 Subject: [PATCH 05/69] Add Disk IO stats and ext4 FS stats (#651) Adds function to return disk stats from: * /sys/block//device/ioerr_cnt: number of SCSI commands that completed with an error * /sys/block//device/iodone_cnt: number of completed or rejected SCSI commands Add function to return stats for ext4 filesystem * /sys/fs/ext4//errors_count: number of ext4 errors * /sys/fs/ext4//warning_count: number of ext4 warning log messages * /sys/fs/ext4//msg_count: number of other ext4 log messages Signed-off-by: Muhammad Shahzeb --- blockdevice/stats.go | 28 +++++++++++ ext4/ext4.go | 103 +++++++++++++++++++++++++++++++++++++++++ internal/util/parse.go | 14 ++++++ 3 files changed, 145 insertions(+) create mode 100644 ext4/ext4.go diff --git a/blockdevice/stats.go b/blockdevice/stats.go index 22533002..75b68845 100644 --- a/blockdevice/stats.go +++ b/blockdevice/stats.go @@ -178,6 +178,11 @@ type BlockQueueStats struct { WriteZeroesMaxBytes uint64 } +type IODeviceStats struct { + IODoneCount uint64 + IOErrCount uint64 +} + // DeviceMapperInfo models the devicemapper files that are located in the sysfs tree for each block device // and described in the kernel documentation: // https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-block-dm @@ -209,6 +214,7 @@ const ( sysBlockQueue = "queue" sysBlockDM = "dm" sysUnderlyingDev = "slaves" + sysDevicePath = "device" ) // FS represents the pseudo-filesystems proc and sys, which provides an @@ -474,3 +480,25 @@ func (fs FS) SysBlockDeviceUnderlyingDevices(device string) (UnderlyingDeviceInf return UnderlyingDeviceInfo{DeviceNames: underlying}, nil } + +// SysBlockDeviceIO returns stats for the block device io counters +// IO done count: /sys/block//device/iodone_cnt +// IO error count: /sys/block//device/ioerr_cnt. +func (fs FS) SysBlockDeviceIOStat(device string) (IODeviceStats, error) { + var ( + ioDeviceStats IODeviceStats + err error + ) + for file, p := range map[string]*uint64{ + "iodone_cnt": &ioDeviceStats.IODoneCount, + "ioerr_cnt": &ioDeviceStats.IOErrCount, + } { + var val uint64 + val, err = util.ReadHexFromFile(fs.sys.Path(sysBlockPath, device, sysDevicePath, file)) + if err != nil { + return IODeviceStats{}, err + } + *p = val + } + return ioDeviceStats, nil +} diff --git a/ext4/ext4.go b/ext4/ext4.go new file mode 100644 index 00000000..b7f83a58 --- /dev/null +++ b/ext4/ext4.go @@ -0,0 +1,103 @@ +// Copyright 2019 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package btrfs provides access to statistics exposed by ext4 filesystems. +package ext4 + +import ( + "path/filepath" + "strings" + + "github.com/prometheus/procfs/internal/fs" + "github.com/prometheus/procfs/internal/util" +) + +const ( + sysFSPath = "fs" + sysFSExt4Path = "ext4" +) + +// Stats contains statistics for a single Btrfs filesystem. +// See Linux fs/btrfs/sysfs.c for more information. +type Stats struct { + Name string + + Errors uint64 + Warnings uint64 + Messages uint64 +} + +// FS represents the pseudo-filesystems proc and sys, which provides an +// interface to kernel data structures. +type FS struct { + proc *fs.FS + sys *fs.FS +} + +// NewDefaultFS returns a new blockdevice fs using the default mountPoints for proc and sys. +// It will error if either of these mount points can't be read. +func NewDefaultFS() (FS, error) { + return NewFS(fs.DefaultProcMountPoint, fs.DefaultSysMountPoint) +} + +// NewFS returns a new XFS handle using the given proc and sys mountPoints. It will error +// if either of the mounts point can't be read. +func NewFS(procMountPoint string, sysMountPoint string) (FS, error) { + if strings.TrimSpace(procMountPoint) == "" { + procMountPoint = fs.DefaultProcMountPoint + } + procfs, err := fs.NewFS(procMountPoint) + if err != nil { + return FS{}, err + } + if strings.TrimSpace(sysMountPoint) == "" { + sysMountPoint = fs.DefaultSysMountPoint + } + sysfs, err := fs.NewFS(sysMountPoint) + if err != nil { + return FS{}, err + } + return FS{&procfs, &sysfs}, nil +} + +// ProcStat returns stats for the filesystem. +func (fs FS) ProcStat() ([]*Stats, error) { + matches, err := filepath.Glob(fs.sys.Path("fs/ext4/*")) + if err != nil { + return nil, err + } + + stats := make([]*Stats, 0, len(matches)) + for _, m := range matches { + s := &Stats{} + + // "*" used in glob above indicates the name of the filesystem. + name := filepath.Base(m) + s.Name = name + for file, p := range map[string]*uint64{ + "errors_count": &s.Errors, + "warning_count": &s.Warnings, + "msg_count": &s.Messages, + } { + var val uint64 + val, err = util.ReadUintFromFile(fs.sys.Path(sysFSPath, sysFSExt4Path, name, file)) + if err == nil { + *p = val + } + } + + stats = append(stats, s) + } + + return stats, nil +} diff --git a/internal/util/parse.go b/internal/util/parse.go index 14272dc7..5a7d2df0 100644 --- a/internal/util/parse.go +++ b/internal/util/parse.go @@ -14,6 +14,7 @@ package util import ( + "errors" "os" "strconv" "strings" @@ -110,3 +111,16 @@ func ParseBool(b string) *bool { } return &truth } + +// ReadHexFromFile reads a file and attempts to parse a uint64 from a hexadecimal format 0xXX. +func ReadHexFromFile(path string) (uint64, error) { + data, err := os.ReadFile(path) + if err != nil { + return 0, err + } + hexString := strings.TrimSpace(string(data)) + if !strings.HasPrefix(hexString, "0x") { + return 0, errors.New("invalid format: hex string does not start with '0x'") + } + return strconv.ParseUint(hexString[2:], 16, 64) +} From 31d6315af879bf47bdcd25f95e126925bca965bc Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Fri, 6 Sep 2024 18:36:15 +0200 Subject: [PATCH 06/69] Update common Prometheus files (#657) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 83ae3906..937f2e21 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -33,7 +33,7 @@ jobs: run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' - name: Lint - uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1 + uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 with: args: --verbose version: v1.59.1 From a49c6d20a05fcee86662df0e79e5e8c59aa6197a Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Sat, 7 Sep 2024 06:42:20 +0200 Subject: [PATCH 07/69] Update common Prometheus files (#662) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 6 +++--- Makefile.common | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 937f2e21..a15cfc97 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -26,9 +26,9 @@ jobs: - name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Install Go - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: 1.22.x + go-version: 1.23.x - name: Install snmp_exporter/generator dependencies run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' @@ -36,4 +36,4 @@ jobs: uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 with: args: --verbose - version: v1.59.1 + version: v1.60.2 diff --git a/Makefile.common b/Makefile.common index e3da72ab..34d65bb5 100644 --- a/Makefile.common +++ b/Makefile.common @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.59.1 +GOLANGCI_LINT_VERSION ?= v1.60.2 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) From 3b2db06802124921acac90898393b2a15056b143 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Mon, 23 Sep 2024 01:47:08 +0200 Subject: [PATCH 08/69] Update common Prometheus files (#666) Signed-off-by: prombot --- Makefile.common | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile.common b/Makefile.common index 34d65bb5..cbb5d863 100644 --- a/Makefile.common +++ b/Makefile.common @@ -275,3 +275,9 @@ $(1)_precheck: exit 1; \ fi endef + +govulncheck: install-govulncheck + govulncheck ./... + +install-govulncheck: + command -v govulncheck > /dev/null || go install golang.org/x/vuln/cmd/govulncheck@latest From fc5df4e22f269d6a28e16820f9b029d155798d21 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Mon, 23 Sep 2024 11:13:15 -0700 Subject: [PATCH 09/69] Forbid print statements (#668) Enable `forbidigo` to make sure print statements are not used in this library. This avoids injecting random log output into upstream user's log formatting. Signed-off-by: SuperQ --- .golangci.yml | 5 +++++ proc_smaps.go | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index d7476d56..e07e8211 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,6 +2,7 @@ linters: enable: - errcheck + - forbidigo - godot - gofmt - goimports @@ -15,6 +16,10 @@ linters: - unused linter-settings: + forbidigo: + forbid: + - p: ^fmt\.Print.*$ + msg: Do not commit print statements. godot: capital: true exclude: diff --git a/proc_smaps.go b/proc_smaps.go index 09060e82..07e7e650 100644 --- a/proc_smaps.go +++ b/proc_smaps.go @@ -19,7 +19,6 @@ package procfs import ( "bufio" "errors" - "fmt" "os" "regexp" "strconv" @@ -117,7 +116,6 @@ func (p Proc) procSMapsRollupManual() (ProcSMapsRollup, error) { func (s *ProcSMapsRollup) parseLine(line string) error { kv := strings.SplitN(line, ":", 2) if len(kv) != 2 { - fmt.Println(line) return errors.New("invalid net/dev line, missing colon") } From 54b2b569290aad467dfbb973dbb1ac619c8ae2aa Mon Sep 17 00:00:00 2001 From: SuperQ Date: Mon, 23 Sep 2024 02:14:09 +0200 Subject: [PATCH 10/69] Update supported Go versions * Update to Go 1.21 - 1.23. * Bump modules. Signed-off-by: SuperQ --- .circleci/config.yml | 6 +++--- go.mod | 4 ++-- go.sum | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 684eb154..8a00ef62 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ version: 2.1 jobs: lint: docker: - - image: cimg/go:1.22 + - image: cimg/go:1.23 steps: - checkout - run: make check_license @@ -46,9 +46,9 @@ workflows: matrix: parameters: go_version: - - "1.20" - "1.21" - "1.22" + - "1.23" - test: name: test-windows os: windows @@ -56,6 +56,6 @@ workflows: matrix: parameters: go_version: - - "1.20" - "1.21" - "1.22" + - "1.23" diff --git a/go.mod b/go.mod index 6279cd78..83f0c358 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ module github.com/prometheus/procfs -go 1.20 +go 1.21 require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.8.0 - golang.org/x/sys v0.24.0 + golang.org/x/sys v0.25.0 ) diff --git a/go.sum b/go.sum index 8df1b749..f04865b6 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 93a635a52a6fee400a98ae7438ccb8fd5169338e Mon Sep 17 00:00:00 2001 From: Miciah Masters Date: Tue, 29 Oct 2024 16:13:44 -0400 Subject: [PATCH 11/69] =?UTF-8?q?NetIPSocketSummary:=20Fix=20typo=20in=20g?= =?UTF-8?q?odoc:=20UPD=E2=86=92UDP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change "UPD" to "UDP" in the godoc for the Drops field. Follow-up to commit 9fdfbe8443465c0da56ca44ff5b1d16250e6a396. Signed-off-by: Miciah Masters --- net_ip_socket.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net_ip_socket.go b/net_ip_socket.go index b70f1fc7..0dc3c30f 100644 --- a/net_ip_socket.go +++ b/net_ip_socket.go @@ -50,7 +50,7 @@ type ( // UsedSockets shows the total number of parsed lines representing the // number of used sockets. UsedSockets uint64 - // Drops shows the total number of dropped packets of all UPD sockets. + // Drops shows the total number of dropped packets of all UDP sockets. Drops *uint64 } From 9c0d20a1ae50a490b82c0bb9694d79cb6752dac8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 20:32:01 +0000 Subject: [PATCH 12/69] Bump golang.org/x/sys from 0.25.0 to 0.26.0 Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.25.0 to 0.26.0. - [Commits](https://github.com/golang/sys/compare/v0.25.0...v0.26.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 83f0c358..f1337ebe 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.21 require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.8.0 - golang.org/x/sys v0.25.0 + golang.org/x/sys v0.26.0 ) diff --git a/go.sum b/go.sum index f04865b6..2149e39b 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 969849f4953c8e5d6c913b4ce677aa92df77c538 Mon Sep 17 00:00:00 2001 From: Finn Snape <145353420+fs185143@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:48:12 +0000 Subject: [PATCH 13/69] feat(blockdevice): added sysblockdevicesize method and test (#658) * added blockdevice size method + test + data --------- Signed-off-by: fs185143 Signed-off-by: Finn Snape <145353420+fs185143@users.noreply.github.com> --- blockdevice/stats.go | 12 ++++++++++++ blockdevice/stats_test.go | 19 +++++++++++++++++++ btrfs/get.go | 8 ++------ fs.go | 10 ++++++++-- testdata/fixtures.ttar | 5 +++++ 5 files changed, 46 insertions(+), 8 deletions(-) diff --git a/blockdevice/stats.go b/blockdevice/stats.go index 75b68845..1bee6d64 100644 --- a/blockdevice/stats.go +++ b/blockdevice/stats.go @@ -21,6 +21,7 @@ import ( "os" "strings" + "github.com/prometheus/procfs" "github.com/prometheus/procfs/internal/fs" "github.com/prometheus/procfs/internal/util" ) @@ -214,6 +215,7 @@ const ( sysBlockQueue = "queue" sysBlockDM = "dm" sysUnderlyingDev = "slaves" + sysBlockSize = "size" sysDevicePath = "device" ) @@ -481,6 +483,16 @@ func (fs FS) SysBlockDeviceUnderlyingDevices(device string) (UnderlyingDeviceInf } +// 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. +func (fs FS) SysBlockDeviceSize(device string) (uint64, error) { + size, err := util.ReadUintFromFile(fs.sys.Path(sysBlockPath, device, sysBlockSize)) + if err != nil { + return 0, err + } + return procfs.SectorSize * size, nil +} + // SysBlockDeviceIO returns stats for the block device io counters // IO done count: /sys/block//device/iodone_cnt // IO error count: /sys/block//device/ioerr_cnt. diff --git a/blockdevice/stats_test.go b/blockdevice/stats_test.go index c065c294..0bd6016b 100644 --- a/blockdevice/stats_test.go +++ b/blockdevice/stats_test.go @@ -219,3 +219,22 @@ func TestSysBlockDeviceUnderlyingDevices(t *testing.T) { t.Errorf("Incorrect BlockQueueStat, expected: \n%+v, got: \n%+v", underlying0Expected, underlying0) } } + +func TestSysBlockDeviceSize(t *testing.T) { + blockdevice, err := NewFS("testdata/fixtures/proc", "testdata/fixtures/sys") + if err != nil { + t.Fatalf("failed to access blockdevice fs: %v", err) + } + devices, err := blockdevice.SysBlockDevices() + if err != nil { + t.Fatal(err) + } + size7, err := blockdevice.SysBlockDeviceSize(devices[7]) + if err != nil { + t.Fatal(err) + } + size7Expected := uint64(1920383410176) + if size7 != size7Expected { + t.Errorf("Incorrect BlockDeviceSize, expected: \n%+v, got: \n%+v", size7Expected, size7) + } +} diff --git a/btrfs/get.go b/btrfs/get.go index db0046b6..4fce6212 100644 --- a/btrfs/get.go +++ b/btrfs/get.go @@ -22,15 +22,11 @@ import ( "strconv" "strings" + "github.com/prometheus/procfs" "github.com/prometheus/procfs/internal/fs" "github.com/prometheus/procfs/internal/util" ) -// SectorSize contains the Linux sector size. -// > Linux always considers sectors to be 512 bytes long independently -// > of the devices real block size. -const SectorSize = 512 - // FS represents the pseudo-filesystem sys, which provides an interface to // kernel data structures. type FS struct { @@ -213,7 +209,7 @@ func (r *reader) readDeviceInfo(d string) map[string]*Device { info := make(map[string]*Device, len(devs)) for _, n := range devs { info[n] = &Device{ - Size: SectorSize * r.readValue("devices/"+n+"/size"), + Size: procfs.SectorSize * r.readValue("devices/"+n+"/size"), } } diff --git a/fs.go b/fs.go index 4980c875..9bdaccc7 100644 --- a/fs.go +++ b/fs.go @@ -24,8 +24,14 @@ type FS struct { isReal bool } -// DefaultMountPoint is the common mount point of the proc filesystem. -const DefaultMountPoint = fs.DefaultProcMountPoint +const ( + // DefaultMountPoint is the common mount point of the proc filesystem. + DefaultMountPoint = fs.DefaultProcMountPoint + + // SectorSize represents the size of a sector in bytes. + // It is specific to Linux block I/O operations. + SectorSize = 512 +) // NewDefaultFS returns a new proc FS mounted under the default proc mountPoint. // It will error if the mount point directory can't be read or is a file. diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index f2bd5e56..07137af8 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -4335,6 +4335,11 @@ Lines: 1 none Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/block/sda/size +Lines: 1 +3750748848EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/sda/stat Lines: 1 9652963 396792 759304206 412943 8422549 6731723 286915323 13947418 0 5658367 19174573 1 2 3 12 From c0a6b978d6b581b354593c9b27577c90665bd51d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2024 20:11:33 +0000 Subject: [PATCH 14/69] Bump golang.org/x/sync from 0.8.0 to 0.9.0 Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.8.0 to 0.9.0. - [Commits](https://github.com/golang/sync/compare/v0.8.0...v0.9.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f1337ebe..f0f076b0 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.21 require ( github.com/google/go-cmp v0.6.0 - golang.org/x/sync v0.8.0 + golang.org/x/sync v0.9.0 golang.org/x/sys v0.26.0 ) diff --git a/go.sum b/go.sum index 2149e39b..5e6aa650 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 82ce1c1d1e89853a5c8363978b26f8a6e804cb19 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:49:13 +0100 Subject: [PATCH 15/69] Bump golang.org/x/sys from 0.26.0 to 0.28.0 (#688) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.26.0 to 0.28.0. - [Commits](https://github.com/golang/sys/compare/v0.26.0...v0.28.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f0f076b0..89c02f9c 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.21 require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.9.0 - golang.org/x/sys v0.26.0 + golang.org/x/sys v0.28.0 ) diff --git a/go.sum b/go.sum index 5e6aa650..0bd13908 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 24ab3d8d880d820115eef19f7b0c2c38fffd6a25 Mon Sep 17 00:00:00 2001 From: dasturiasArista Date: Sat, 21 Dec 2024 11:45:11 -0800 Subject: [PATCH 16/69] feat: Read PCIE AER counters class/net (#686) * feat: Read PCIE AER counters class/net Linux provides AER counters in the path /sys/class/net//device/ This is split amoung 3 different files: aer_dev_correctable aer_dev_fatal aer_dev_nonfatal --------- Signed-off-by: Diego Asturias --- sysfs/net_class_aer.go | 255 ++++++++++++++++++++++++++++++++++++ sysfs/net_class_aer_test.go | 111 ++++++++++++++++ testdata/fixtures.ttar | 59 +++++++++ 3 files changed, 425 insertions(+) create mode 100644 sysfs/net_class_aer.go create mode 100644 sysfs/net_class_aer_test.go diff --git a/sysfs/net_class_aer.go b/sysfs/net_class_aer.go new file mode 100644 index 00000000..c99539c6 --- /dev/null +++ b/sysfs/net_class_aer.go @@ -0,0 +1,255 @@ +// Copyright 2024 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package sysfs + +import ( + "fmt" + "path/filepath" + "strconv" + "strings" + + "github.com/prometheus/procfs/internal/util" +) + +// CorrectableAerCounters contains values from /sys/class/net//device/aer_dev_correctable +// for single interface (iface). +type CorrectableAerCounters struct { + RxErr uint64 + BadTLP uint64 + BadDLLP uint64 + Rollover uint64 + Timeout uint64 + NonFatalErr uint64 + CorrIntErr uint64 + HeaderOF uint64 +} + +// UncorrectableAerCounters contains values from /sys/class/net//device/aer_dev_[non]fatal +// for single interface (iface). +type UncorrectableAerCounters struct { + Undefined uint64 + DLP uint64 + SDES uint64 + TLP uint64 + FCP uint64 + CmpltTO uint64 + CmpltAbrt uint64 + UnxCmplt uint64 + RxOF uint64 + MalfTLP uint64 + ECRC uint64 + UnsupReq uint64 + ACSViol uint64 + UncorrIntErr uint64 + BlockedTLP uint64 + AtomicOpBlocked uint64 + TLPBlockedErr uint64 + PoisonTLPBlocked uint64 +} + +// AerCounters contains AER counters from files in /sys/class/net//device +// for single interface (iface). +type AerCounters struct { + Name string // Interface name + Correctable CorrectableAerCounters + Fatal UncorrectableAerCounters + NonFatal UncorrectableAerCounters +} + +// AllAerCounters is collection of AER counters for every interface (iface) in /sys/class/net. +// The map keys are interface (iface) names. +type AllAerCounters map[string]AerCounters + +// AerCounters returns info for a single net interfaces (iface). +func (fs FS) AerCountersByIface(devicePath string) (*AerCounters, error) { + _, err := fs.NetClassByIface(devicePath) + if err != nil { + return nil, err + } + + path := fs.sys.Path(netclassPath) + counters, err := parseAerCounters(filepath.Join(path, devicePath)) + if err != nil { + return nil, err + } + counters.Name = devicePath + + return counters, nil +} + +// AerCounters returns AER counters for all net interfaces (iface) read from /sys/class/net//device. +func (fs FS) AerCounters() (AllAerCounters, error) { + devices, err := fs.NetClassDevices() + if err != nil { + return nil, err + } + + path := fs.sys.Path(netclassPath) + allAerCounters := AllAerCounters{} + for _, devicePath := range devices { + counters, err := parseAerCounters(filepath.Join(path, devicePath)) + if err != nil { + return nil, err + } + counters.Name = devicePath + allAerCounters[devicePath] = *counters + } + + return allAerCounters, nil +} + +// parseAerCounters scans predefined files in /sys/class/net//device +// directory and gets their contents. +func parseAerCounters(devicePath string) (*AerCounters, error) { + counters := AerCounters{} + err := parseCorrectableAerCounters(devicePath, &counters.Correctable) + if err != nil { + return nil, err + } + err = parseUncorrectableAerCounters(devicePath, "fatal", &counters.Fatal) + if err != nil { + return nil, err + } + err = parseUncorrectableAerCounters(devicePath, "nonfatal", &counters.NonFatal) + if err != nil { + return nil, err + } + return &counters, nil +} + +// parseCorrectableAerCounters parses correctable error counters in +// /sys/class/net//device/aer_dev_correctable. +func parseCorrectableAerCounters(devicePath string, counters *CorrectableAerCounters) error { + path := filepath.Join(devicePath, "device", "aer_dev_correctable") + value, err := util.SysReadFile(path) + if err != nil { + if canIgnoreError(err) { + return nil + } + return fmt.Errorf("failed to read file %q: %w", path, err) + } + + for _, line := range strings.Split(string(value), "\n") { + if line == "" { + continue + } + fields := strings.Fields(line) + if len(fields) != 2 { + return fmt.Errorf("unexpected number of fields: %v", fields) + } + counterName := fields[0] + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + return fmt.Errorf("error parsing value for %s: %v", counterName, err) + } + + switch counterName { + case "RxErr": + counters.RxErr = value + case "BadTLP": + counters.BadTLP = value + case "BadDLLP": + counters.BadDLLP = value + case "Rollover": + counters.Rollover = value + case "Timeout": + counters.Timeout = value + case "NonFatalErr": + counters.NonFatalErr = value + case "CorrIntErr": + counters.CorrIntErr = value + case "HeaderOF": + counters.HeaderOF = value + default: + continue + } + } + + return nil +} + +// parseUncorrectableAerCounters parses uncorrectable error counters in +// /sys/class/net//device/aer_dev_[non]fatal. +func parseUncorrectableAerCounters(devicePath string, counterType string, + counters *UncorrectableAerCounters) error { + path := filepath.Join(devicePath, "device", "aer_dev_"+counterType) + value, err := util.ReadFileNoStat(path) + if err != nil { + if canIgnoreError(err) { + return nil + } + return fmt.Errorf("failed to read file %q: %w", path, err) + } + + for _, line := range strings.Split(string(value), "\n") { + if line == "" { + continue + } + fields := strings.Fields(line) + if len(fields) != 2 { + return fmt.Errorf("unexpected number of fields: %v", fields) + } + counterName := fields[0] + value, err := strconv.ParseUint(fields[1], 10, 64) + if err != nil { + return fmt.Errorf("error parsing value for %s: %v", counterName, err) + } + + switch counterName { + case "Undefined": + counters.Undefined = value + case "DLP": + counters.DLP = value + case "SDES": + counters.SDES = value + case "TLP": + counters.TLP = value + case "FCP": + counters.FCP = value + case "CmpltTO": + counters.CmpltTO = value + case "CmpltAbrt": + counters.CmpltAbrt = value + case "UnxCmplt": + counters.UnxCmplt = value + case "RxOF": + counters.RxOF = value + case "MalfTLP": + counters.MalfTLP = value + case "ECRC": + counters.ECRC = value + case "UnsupReq": + counters.UnsupReq = value + case "ACSViol": + counters.ACSViol = value + case "UncorrIntErr": + counters.UncorrIntErr = value + case "BlockedTLP": + counters.BlockedTLP = value + case "AtomicOpBlocked": + counters.AtomicOpBlocked = value + case "TLPBlockedErr": + counters.TLPBlockedErr = value + case "PoisonTLPBlocked": + counters.PoisonTLPBlocked = value + default: + continue + } + } + + return nil +} diff --git a/sysfs/net_class_aer_test.go b/sysfs/net_class_aer_test.go new file mode 100644 index 00000000..2d75265a --- /dev/null +++ b/sysfs/net_class_aer_test.go @@ -0,0 +1,111 @@ +// Copyright 2024 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package sysfs + +import ( + "reflect" + "testing" +) + +func TestAerCountersByIface(t *testing.T) { + fs, err := NewFS(sysTestFixtures) + if err != nil { + t.Fatal(err) + } + + _, err = fs.AerCountersByIface("non-existent") + if err == nil { + t.Fatal("expected error, have none") + } + + device, err := fs.AerCountersByIface("eth0") + if err != nil { + t.Fatal(err) + } + + if device.Name != "eth0" { + t.Errorf("Found unexpected device, want %s, have %s", "eth0", device.Name) + } +} + +func TestAerCounters(t *testing.T) { + fs, err := NewFS(sysTestFixtures) + if err != nil { + t.Fatal(err) + } + + ac, _ := fs.AerCounters() + aerCounters := AllAerCounters{ + "eth0": AerCounters{ + Name: "eth0", + Correctable: CorrectableAerCounters{ + RxErr: 1, + BadTLP: 2, + BadDLLP: 3, + Rollover: 4, + Timeout: 5, + NonFatalErr: 6, + CorrIntErr: 7, + HeaderOF: 8, + }, + Fatal: UncorrectableAerCounters{ + Undefined: 10, + DLP: 11, + SDES: 12, + TLP: 13, + FCP: 14, + CmpltTO: 15, + CmpltAbrt: 16, + UnxCmplt: 17, + RxOF: 18, + MalfTLP: 19, + ECRC: 20, + UnsupReq: 21, + ACSViol: 22, + UncorrIntErr: 23, + BlockedTLP: 24, + AtomicOpBlocked: 25, + TLPBlockedErr: 26, + PoisonTLPBlocked: 27, + }, + NonFatal: UncorrectableAerCounters{ + Undefined: 30, + DLP: 31, + SDES: 32, + TLP: 33, + FCP: 34, + CmpltTO: 35, + CmpltAbrt: 36, + UnxCmplt: 37, + RxOF: 38, + MalfTLP: 39, + ECRC: 40, + UnsupReq: 41, + ACSViol: 42, + UncorrIntErr: 43, + BlockedTLP: 44, + AtomicOpBlocked: 45, + TLPBlockedErr: 46, + PoisonTLPBlocked: 47, + }, + }, + } + + if !reflect.DeepEqual(aerCounters, ac) { + t.Errorf("Result not correct: want %v, have %v", aerCounters, ac) + } +} diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index 07137af8..dfbcd345 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -13267,6 +13267,65 @@ Mode: 644 Directory: fixtures/sys/devices/pci0000:00/0000:00:1f.6 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/aer_dev_correctable +Lines: 9 +RxErr 1 +BadTLP 2 +BadDLLP 3 +Rollover 4 +Timeout 5 +NonFatalErr 6 +CorrIntErr 7 +HeaderOF 8 +TOTAL_ERR_COR 9 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/aer_dev_fatal +Lines: 19 +Undefined 10 +DLP 11 +SDES 12 +TLP 13 +FCP 14 +CmpltTO 15 +CmpltAbrt 16 +UnxCmplt 17 +RxOF 18 +MalfTLP 19 +ECRC 20 +UnsupReq 21 +ACSViol 22 +UncorrIntErr 23 +BlockedTLP 24 +AtomicOpBlocked 25 +TLPBlockedErr 26 +PoisonTLPBlocked 27 +TOTAL_ERR_FATAL 28 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/aer_dev_nonfatal +Lines: 19 +Undefined 30 +DLP 31 +SDES 32 +TLP 33 +FCP 34 +CmpltTO 35 +CmpltAbrt 36 +UnxCmplt 37 +RxOF 38 +MalfTLP 39 +ECRC 40 +UnsupReq 41 +ACSViol 42 +UncorrIntErr 43 +BlockedTLP 44 +AtomicOpBlocked 45 +TLPBlockedErr 46 +PoisonTLPBlocked 47 +TOTAL_ERR_FATAL 48 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/pci0000:00/0000:00:1f.6/ari_enabled Lines: 1 0 From a05af62118b593bd9f202a3390394e50e861c039 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 21:14:11 +0100 Subject: [PATCH 17/69] Bump golang.org/x/sync from 0.9.0 to 0.10.0 (#690) Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.9.0 to 0.10.0. - [Commits](https://github.com/golang/sync/compare/v0.9.0...v0.10.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 89c02f9c..8b757df1 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.21 require ( github.com/google/go-cmp v0.6.0 - golang.org/x/sync v0.9.0 + golang.org/x/sync v0.10.0 golang.org/x/sys v0.28.0 ) diff --git a/go.sum b/go.sum index 0bd13908..acccf6ae 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= -golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 21839df93c273a9b057eadd7d943df1718bfdb52 Mon Sep 17 00:00:00 2001 From: Juerg Ritter Date: Mon, 8 Mar 2021 20:20:11 +0100 Subject: [PATCH 18/69] enhancement: Implement classes to read drm subsystem Signed-off-by: Juerg Ritter --- sysfs/class_drm_amdgpu_test.go | 10 ++ sysfs/class_drm_card.go | 128 +++++++++++++ sysfs/class_drm_card_test.go | 65 +++++++ testdata/fixtures.ttar | 316 +++++++++++++++++++++++---------- 4 files changed, 429 insertions(+), 90 deletions(-) create mode 100644 sysfs/class_drm_card.go create mode 100644 sysfs/class_drm_card_test.go diff --git a/sysfs/class_drm_amdgpu_test.go b/sysfs/class_drm_amdgpu_test.go index c219ccd2..c44b3417 100644 --- a/sysfs/class_drm_amdgpu_test.go +++ b/sysfs/class_drm_amdgpu_test.go @@ -46,6 +46,16 @@ func TestClassDRMCardAMDGPUStats(t *testing.T) { PowerDPMForcePerformanceLevel: "manual", UniqueID: "0123456789abcdef", }, + { + Name: "card1", + GPUBusyPercent: 0, + MemoryGTTSize: 0, + MemoryGTTUsed: 0, + MemoryVisibleVRAMSize: 0, + MemoryVisibleVRAMUsed: 0, + MemoryVRAMSize: 0, + MemoryVRAMUsed: 0, + }, } if !reflect.DeepEqual(classDRMCardStats, drmTest) { diff --git a/sysfs/class_drm_card.go b/sysfs/class_drm_card.go new file mode 100644 index 00000000..314fd7d1 --- /dev/null +++ b/sysfs/class_drm_card.go @@ -0,0 +1,128 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package sysfs + +import ( + "fmt" + "path/filepath" + + "github.com/prometheus/procfs/internal/util" +) + +const drmClassPath = "class/drm" + +// DrmCard contains info from files in /sys/class/drm for a +// single DRM Card device. +type DrmCard struct { + Name string + Driver string + Ports map[string]DrmCardPort +} + +// DrmCardPort contains info from files in +// /sys/class/drm//- +// for a single port of one DrmCard device. +type DrmCardPort struct { + Name string + Status string + Dpms string + Enabled string +} + +// DrmCardClass is a collection of every Card device in +// /sys/class/drm. +// +// The map keys are the names of the InfiniBand devices. +type DrmCardClass map[string]DrmCard + +// DrmCardClass returns infos for all Drm devices read from +// /sys/class/drm. +func (fs FS) DrmCardClass() (DrmCardClass, error) { + + cards, err := filepath.Glob(fs.sys.Path("class/drm/card[0-9]")) + + if err != nil { + return nil, fmt.Errorf("failed to list DRM card ports at %q: %w", cards, err) + } + + drmCardClass := make(DrmCardClass, len(cards)) + for _, c := range cards { + card, err := fs.parseDrmCard(filepath.Base(c)) + if err != nil { + return nil, err + } + + drmCardClass[card.Name] = *card + } + + return drmCardClass, nil +} + +// Parse one DrmCard. +func (fs FS) parseDrmCard(name string) (*DrmCard, error) { + path := fs.sys.Path(drmClassPath, name) + card := DrmCard{Name: name} + + // Read the kernel module of the card + cardDriverPath, err := filepath.EvalSymlinks(filepath.Join(path, "device/driver")) + if err != nil { + return nil, fmt.Errorf("failed to read driver: %w", err) + } + card.Driver = filepath.Base(cardDriverPath) + + portsPath, err := filepath.Glob(filepath.Join(path, filepath.Base(path)+"-*-*")) + + if err != nil { + return nil, fmt.Errorf("failed to list DRM card ports at %q: %w", portsPath, err) + } + + card.Ports = make(map[string]DrmCardPort, len(portsPath)) + for _, d := range portsPath { + port, err := parseDrmCardPort(d) + if err != nil { + return nil, err + } + + card.Ports[port.Name] = *port + } + + return &card, nil +} + +func parseDrmCardPort(port string) (*DrmCardPort, error) { + portStatus, err := util.SysReadFile(filepath.Join(port, "status")) + if err != nil { + return nil, err + } + + drmCardPort := DrmCardPort{Name: filepath.Base(port), Status: portStatus} + + portDpms, err := util.SysReadFile(filepath.Join(port, "dpms")) + if err != nil { + return nil, err + } + + drmCardPort.Dpms = portDpms + + portEnabled, err := util.SysReadFile(filepath.Join(port, "enabled")) + if err != nil { + return nil, err + } + drmCardPort.Enabled = portEnabled + + return &drmCardPort, nil +} diff --git a/sysfs/class_drm_card_test.go b/sysfs/class_drm_card_test.go new file mode 100644 index 00000000..8f3a3711 --- /dev/null +++ b/sysfs/class_drm_card_test.go @@ -0,0 +1,65 @@ +// Copyright 2021 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package sysfs + +import ( + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestClassDRMCard(t *testing.T) { + fs, err := NewFS(sysTestFixtures) + if err != nil { + t.Fatal(err) + } + + got, err := fs.DrmCardClass() + if err != nil { + t.Fatal(err) + } + + want := DrmCardClass{ + "card0": DrmCard{ + Name: "card0", + Driver: "amdgpu", + Ports: map[string]DrmCardPort{}, + }, + "card1": DrmCard{ + Name: "card1", + Driver: "i915", + Ports: map[string]DrmCardPort{ + "card1-DP-1": { + Name: "card1-DP-1", + Dpms: "Off", + Enabled: "disabled", + Status: "disconnected", + }, + "card1-DP-5": { + Name: "card1-DP-5", + Dpms: "On", + Enabled: "enabled", + Status: "connected", + }, + }, + }, + } + + if diff := cmp.Diff(want, got); diff != "" { + t.Fatalf("unexpected DrmCard class (-want +got):\n%s", diff) + } +} diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index dfbcd345..f64f09e5 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -1,9 +1,9 @@ # Archive created by ttar -c -f testdata/fixtures.ttar -C testdata/ fixtures/ Directory: fixtures -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/26231 Mode: 755 @@ -327,7 +327,7 @@ UdpLite6RcvbufErrors 0 UdpLite6SndbufErrors 0 UdpLite6InCsumErrors 0 Mode: 644 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/26231/ns Mode: 755 @@ -688,7 +688,7 @@ Mode: 644 Path: fixtures/proc/26231/wchan Lines: 1 poll_schedule_timeoutEOF -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/26232 Mode: 755 @@ -768,7 +768,7 @@ Mode: 644 Path: fixtures/proc/26232/wchan Lines: 1 0EOF -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/26233 Mode: 755 @@ -2181,7 +2181,7 @@ Lines: 52 8 0 sdc 14202 71 579164 21861 2995 1589 180500 40875 0 11628 55200 0 0 0 0 127 182 8 1 sdc1 1027 0 13795 5021 2 0 4096 3 0 690 4579 0 0 0 0 0 0 8 2 sdc2 13126 71 561749 16802 2830 1589 176404 40620 0 10931 50449 0 0 0 0 0 0 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/fs Mode: 755 @@ -2361,7 +2361,7 @@ HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 91136 kB DirectMap2M: 16039936 kB -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/net Mode: 755 @@ -2371,7 +2371,7 @@ Lines: 3 IP address HW type Flags HW address Mask Device 192.168.224.1 0x1 0x2 00:50:56:c0:00:08 * ens33 192.168.224.2 0x1 0x0 00:00:00:00:00:00 * ens33 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/net/dev Lines: 6 @@ -3035,10 +3035,10 @@ Lines: 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/sys -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/sys/kernel -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/sys/kernel/random Mode: 755 @@ -3072,7 +3072,7 @@ kill_process kill_thread trap errno trace log allow Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/sys/vm -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/sys/vm/admin_reserve_kbytes Lines: 1 @@ -3559,10 +3559,10 @@ Directory: fixtures/sys Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/dm-0 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/dm-0/dm Mode: 755 @@ -3597,18 +3597,18 @@ Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/dm-0/slaves/sda Lines: 0 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/dm-0/stat Lines: 1 6447303 0 710266738 1529043 953216 0 31201176 4557464 0 796160 6088971 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md0 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md0/md -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/md0/md/array_state Lines: 1 @@ -3663,10 +3663,10 @@ Lines: 1 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md1 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md1/md -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/md1/md/array_state Lines: 1 @@ -3736,10 +3736,10 @@ Lines: 1 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md10 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md10/md -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/md10/md/array_state Lines: 1 @@ -3831,10 +3831,10 @@ Lines: 1 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md4 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md4/md -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/md4/md/array_state Lines: 1 @@ -3915,10 +3915,10 @@ Lines: 1 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md5 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md5/md -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/md5/md/array_state Lines: 1 @@ -3936,7 +3936,7 @@ Lines: 1 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md5/md/dev-sdaa -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/md5/md/dev-sdaa/state Lines: 1 @@ -4007,10 +4007,10 @@ Lines: 1 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md6 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/md6/md -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/md6/md/array_state Lines: 1 @@ -4102,7 +4102,7 @@ Lines: 1 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/sda -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/block/sda/queue Mode: 755 @@ -4343,13 +4343,28 @@ Mode: 644 Path: fixtures/sys/block/sda/stat Lines: 1 9652963 396792 759304206 412943 8422549 6731723 286915323 13947418 0 5658367 19174573 1 2 3 12 -Mode: 664 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/bus +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/bus/pci +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/bus/pci/drivers +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/bus/pci/drivers/amdgpu +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/bus/pci/drivers/i915 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/block -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/block/dm-0 SymlinkTo: ../../devices/virtual/block/dm-0 @@ -4370,10 +4385,10 @@ Path: fixtures/sys/class/block/dm-5 SymlinkTo: ../../devices/virtual/block/dm-5 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/dmi -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/dmi/id -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/dmi/id/bios_date Lines: 1 @@ -4603,6 +4618,9 @@ Lines: 1 44 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card0/device/driver +SymlinkTo: ../../../../bus/pci/drivers/amdgpu +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/drm/card0/device/driver_override Lines: 1 (null) @@ -4939,6 +4957,124 @@ Lines: 1 0x1002 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/drm/card1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/drm/card1/card1-DP-1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/card1-DP-1/connector_id +Lines: 1 +103 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/card1-DP-1/dpms +Lines: 1 +Off +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/card1-DP-1/edid +Lines: 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/card1-DP-1/enabled +Lines: 1 +disabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/card1-DP-1/modes +Lines: 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/card1-DP-1/status +Lines: 1 +disconnected +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/drm/card1/card1-DP-5 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/card1-DP-5/connector_id +Lines: 1 +135 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/card1-DP-5/dpms +Lines: 1 +On +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/card1-DP-5/edid +Lines: 5 +NULLBYTE������NULLBYTE"�V)�4 x*���UM�%PT!NULLBYTE�����@���NULLBYTE�@�NULLBYTE(<��p�#@0 6NULLBYTED!NULLBYTENULLBYTENULLBYTENULLBYTENULLBYTE�NULLBYTE<PNULLBYTE + NULLBYTENULLBYTENULLBYTE�NULLBYTEHP ZR2440w + NULLBYTENULLBYTENULLBYTE�NULLBYTECN4218016Q + ��L�e NULLBYTENULLBYTE# �NULLBYTENULLBYTE:�q8-@X,ENULLBYTED!NULLBYTENULLBYTE:��r8-@,E�D!NULLBYTENULLBYTENULLBYTErQ� n(UNULLBYTED!NULLBYTENULLBYTENULLBYTE�R� �(U@D!NULLBYTENULLBYTE� +Њ �->�NULLBYTED!NULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTE�EOF +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/card1-DP-5/enabled +Lines: 1 +enabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/card1-DP-5/modes +Lines: 27 +1920x1200 +1920x1080 +1920x1080 +1920x1080 +1920x1080 +1920x1080 +1600x1200 +1680x1050 +1280x1024 +1440x900 +1280x960 +1280x720 +1280x720 +1280x720 +1280x720 +1280x720 +1024x768 +800x600 +720x576 +720x480 +720x480 +720x480 +720x480 +720x480 +640x480 +640x480 +640x480 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/card1-DP-5/status +Lines: 1 +connected +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/drm/card1/device +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/device/driver +SymlinkTo: ../../../../bus/pci/drivers/i915 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/device/enable +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/drm/card1/device/uevent +Lines: 6 +DRIVER=i915 +PCI_CLASS=30000 +PCI_ID=8086:5917 +PCI_SUBSYS_ID=17AA:2258 +PCI_SLOT_NAME=0000:00:02.0 +MODALIAS=pci:v00008086d00005917sv000017AAsd00002258bc03sc00i00 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/fc_host Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -5309,7 +5445,7 @@ Mode: 755 Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/VL15_dropped Lines: 1 0 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/excessive_buffer_overrun_errors Lines: 1 @@ -5415,7 +5551,7 @@ Mode: 755 Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/VL15_dropped Lines: 1 0 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/excessive_buffer_overrun_errors Lines: 1 @@ -5788,7 +5924,7 @@ Lines: 1 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/net -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/net/eth0 Mode: 755 @@ -5923,30 +6059,30 @@ Lines: 1 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/nvme -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/nvme/nvme0 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/nvme/nvme0/firmware_rev Lines: 1 1B2QEXP7 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/nvme/nvme0/model Lines: 1 Samsung SSD 970 PRO 512GB -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/nvme/nvme0/serial Lines: 1 S680HF8N190894I -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/nvme/nvme0/state Lines: 1 live -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/power_supply Mode: 755 @@ -6153,7 +6289,7 @@ Lines: 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/sas_device -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/sas_device/end_device-11:0:0 SymlinkTo: ../../devices/pci0000:00/0000:00:03.0/0000:03:00.0/host11/port-11:0/expander-11:0/port-11:0:0/end_device-11:0:0/sas_device/end_device-11:0:0 @@ -6174,7 +6310,7 @@ Path: fixtures/sys/class/sas_device/expander-11:1 SymlinkTo: ../../devices/pci0000:00/0000:00:03.0/0000:03:00.0/host11/port-11:1/expander-11:1/sas_device/expander-11:1 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/sas_end_device -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/sas_end_device/end_device-11:0:0 SymlinkTo: ../../devices/pci0000:00/0000:00:03.0/0000:03:00.0/host11/port-11:0/expander-11:0/port-11:0:0/end_device-11:0:0/sas_device/end_device-11:0:0 @@ -6189,7 +6325,7 @@ Path: fixtures/sys/class/sas_end_device/end_device-11:2 SymlinkTo: ../../devices/pci0000:00/0000:00:03.0/0000:03:00.0/host11/port-11:2/end_device-11:2/sas_device/end_device-11:2 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/sas_expander -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/sas_expander/expander-11:0 SymlinkTo: ../../devices/pci0000:00/0000:00:03.0/0000:03:00.0/host11/port-11:0/expander-11:0/sas_expander/expander-11:0 @@ -6198,13 +6334,13 @@ Path: fixtures/sys/class/sas_expander/expander-11:1 SymlinkTo: ../../devices/pci0000:00/0000:00:03.0/0000:03:00.0/host11/port-11:1/expander-11:1/sas_expander/expander-11:1 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/sas_host -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/sas_host/host11 SymlinkTo: ../../devices/pci0000:00/0000:00:03.0/0000:03:00.0/host11/sas_host/host11 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/sas_phy -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/sas_phy/phy-11:0:2 SymlinkTo: ../../devices/pci0000:00/0000:00:03.0/0000:03:00.0/host11/port-11:0/expander-11:0/phy-11:0:2/sas_phy/phy-11:0:2 @@ -6243,7 +6379,7 @@ Path: fixtures/sys/class/sas_phy/phy-11:9 SymlinkTo: ../../devices/pci0000:00/0000:00:03.0/0000:03:00.0/host11/phy-11:9/sas_phy/phy-11:9 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/sas_port -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/sas_port/port-11:0 SymlinkTo: ../../devices/pci0000:00/0000:00:03.0/0000:03:00.0/host11/port-11:0/sas_port/port-11:0 @@ -6288,7 +6424,7 @@ Path: fixtures/sys/class/scsi_tape/st0m SymlinkTo: ../../devices/pci0000:00/0000:00:00.0/host0/port-0:0/end_device-0:0/target0:0:0/0:0:0:0/scsi_tape/st0m # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/thermal -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/thermal/cooling_device0 Mode: 755 @@ -6327,22 +6463,22 @@ intel_powerclamp Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/thermal/thermal_zone0 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/thermal/thermal_zone0/policy Lines: 1 step_wise -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/thermal/thermal_zone0/temp Lines: 1 49925 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/thermal/thermal_zone0/type Lines: 1 bcm2835_thermal -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/thermal/thermal_zone1 Mode: 755 @@ -6350,33 +6486,33 @@ Mode: 755 Path: fixtures/sys/class/thermal/thermal_zone1/mode Lines: 1 enabled -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/thermal/thermal_zone1/passive Lines: 1 0 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/thermal/thermal_zone1/policy Lines: 1 step_wise -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/thermal/thermal_zone1/temp Lines: 1 -44000 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/thermal/thermal_zone1/type Lines: 1 acpitz -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/watchdog -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/watchdog/watchdog0 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/watchdog/watchdog0/access_cs0 Lines: 1 @@ -6439,7 +6575,7 @@ Lines: 1 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/watchdog/watchdog1 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices Mode: 755 @@ -13478,13 +13614,13 @@ wrong-images Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/clocksource -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/clocksource/clocksource0 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/clocksource/clocksource0/available_clocksource Lines: 1 @@ -13497,10 +13633,10 @@ tsc Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/cpu -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/cpu/cpu0 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/cpu0/cpufreq SymlinkTo: ../cpufreq/policy0 @@ -13557,10 +13693,10 @@ Lines: 1 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/cpu/cpu1 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/cpu/cpu1/cpufreq -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq Lines: 1 @@ -13570,52 +13706,52 @@ Mode: 400 Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_max_freq Lines: 1 3300000 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_min_freq Lines: 1 1200000 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_transition_latency Lines: 1 4294967295 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/related_cpus Lines: 1 1 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors Lines: 1 performance powersave -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver Lines: 1 intel_pstate -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor Lines: 1 powersave -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq Lines: 1 3300000 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq Lines: 1 1200000 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/cpu1/cpufreq/scaling_setspeed Lines: 1 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/cpu/cpu1/cpufreq/stats Mode: 755 @@ -13681,13 +13817,13 @@ Lines: 1 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/cpu/cpu2 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/cpu/cpufreq -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/cpu/cpufreq/policy0 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/cpufreq/policy0/affected_cpus Lines: 1 @@ -13769,12 +13905,12 @@ Mode: 755 Path: fixtures/sys/devices/system/cpu/isolated Lines: 1 1,2-7,9 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/devices/system/cpu/offline Lines: 1 2 -Mode: 664 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/cpu/vulnerabilities Mode: 755 @@ -13825,7 +13961,7 @@ Not affected Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/node -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/node/node1 Mode: 755 @@ -13854,13 +13990,13 @@ nr_zone_unevictable 12 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/virtual -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/virtual/block -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/virtual/block/dm-0 -Mode: 775 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/fs Mode: 755 @@ -13877,7 +14013,7 @@ Lines: 1 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0 -Mode: 777 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/bdev0/dirty_data Lines: 1 @@ -14053,7 +14189,7 @@ Lines: 1 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache0 -Mode: 777 +Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/fs/bcache/deaddd54-c735-46d5-868e-f331c5fd7c74/cache0/io_errors Lines: 1 From 6185448354854e0e3b70995171fb6c3e10a8652c Mon Sep 17 00:00:00 2001 From: Juerg Ritter Date: Tue, 23 Jul 2024 20:26:37 +0200 Subject: [PATCH 19/69] refactor: Rename symbol names according to golang conventions Signed-off-by: Juerg Ritter --- sysfs/class_drm_amdgpu_test.go | 2 +- sysfs/class_drm_card.go | 46 +++++++++++++++++----------------- sysfs/class_drm_card_test.go | 20 +++++++-------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/sysfs/class_drm_amdgpu_test.go b/sysfs/class_drm_amdgpu_test.go index c44b3417..35620401 100644 --- a/sysfs/class_drm_amdgpu_test.go +++ b/sysfs/class_drm_amdgpu_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Prometheus Authors +// Copyright 2024 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at diff --git a/sysfs/class_drm_card.go b/sysfs/class_drm_card.go index 314fd7d1..8f0baeba 100644 --- a/sysfs/class_drm_card.go +++ b/sysfs/class_drm_card.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright 2024 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -25,33 +25,33 @@ import ( const drmClassPath = "class/drm" -// DrmCard contains info from files in /sys/class/drm for a +// DRMCard contains info from files in /sys/class/drm for a // single DRM Card device. -type DrmCard struct { +type DRMCard struct { Name string Driver string - Ports map[string]DrmCardPort + Ports map[string]DRMCardPort } -// DrmCardPort contains info from files in +// DRMCardPort contains info from files in // /sys/class/drm//- -// for a single port of one DrmCard device. -type DrmCardPort struct { +// for a single port of one DRMCard device. +type DRMCardPort struct { Name string Status string - Dpms string + DPMS string Enabled string } -// DrmCardClass is a collection of every Card device in +// DRMCardClass is a collection of every Card device in // /sys/class/drm. // // The map keys are the names of the InfiniBand devices. -type DrmCardClass map[string]DrmCard +type DRMCardClass map[string]DRMCard -// DrmCardClass returns infos for all Drm devices read from +// DRMCardClass returns infos for all DRM devices read from // /sys/class/drm. -func (fs FS) DrmCardClass() (DrmCardClass, error) { +func (fs FS) DRMCardClass() (DRMCardClass, error) { cards, err := filepath.Glob(fs.sys.Path("class/drm/card[0-9]")) @@ -59,9 +59,9 @@ func (fs FS) DrmCardClass() (DrmCardClass, error) { return nil, fmt.Errorf("failed to list DRM card ports at %q: %w", cards, err) } - drmCardClass := make(DrmCardClass, len(cards)) + drmCardClass := make(DRMCardClass, len(cards)) for _, c := range cards { - card, err := fs.parseDrmCard(filepath.Base(c)) + card, err := fs.parseDRMCard(filepath.Base(c)) if err != nil { return nil, err } @@ -72,10 +72,10 @@ func (fs FS) DrmCardClass() (DrmCardClass, error) { return drmCardClass, nil } -// Parse one DrmCard. -func (fs FS) parseDrmCard(name string) (*DrmCard, error) { +// Parse one DRMCard. +func (fs FS) parseDRMCard(name string) (*DRMCard, error) { path := fs.sys.Path(drmClassPath, name) - card := DrmCard{Name: name} + card := DRMCard{Name: name} // Read the kernel module of the card cardDriverPath, err := filepath.EvalSymlinks(filepath.Join(path, "device/driver")) @@ -90,9 +90,9 @@ func (fs FS) parseDrmCard(name string) (*DrmCard, error) { return nil, fmt.Errorf("failed to list DRM card ports at %q: %w", portsPath, err) } - card.Ports = make(map[string]DrmCardPort, len(portsPath)) + card.Ports = make(map[string]DRMCardPort, len(portsPath)) for _, d := range portsPath { - port, err := parseDrmCardPort(d) + port, err := parseDRMCardPort(d) if err != nil { return nil, err } @@ -103,20 +103,20 @@ func (fs FS) parseDrmCard(name string) (*DrmCard, error) { return &card, nil } -func parseDrmCardPort(port string) (*DrmCardPort, error) { +func parseDRMCardPort(port string) (*DRMCardPort, error) { portStatus, err := util.SysReadFile(filepath.Join(port, "status")) if err != nil { return nil, err } - drmCardPort := DrmCardPort{Name: filepath.Base(port), Status: portStatus} + drmCardPort := DRMCardPort{Name: filepath.Base(port), Status: portStatus} - portDpms, err := util.SysReadFile(filepath.Join(port, "dpms")) + portDPMS, err := util.SysReadFile(filepath.Join(port, "dpms")) if err != nil { return nil, err } - drmCardPort.Dpms = portDpms + drmCardPort.DPMS = portDPMS portEnabled, err := util.SysReadFile(filepath.Join(port, "enabled")) if err != nil { diff --git a/sysfs/class_drm_card_test.go b/sysfs/class_drm_card_test.go index 8f3a3711..4d064673 100644 --- a/sysfs/class_drm_card_test.go +++ b/sysfs/class_drm_card_test.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Prometheus Authors +// Copyright 2024 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -28,30 +28,30 @@ func TestClassDRMCard(t *testing.T) { t.Fatal(err) } - got, err := fs.DrmCardClass() + got, err := fs.DRMCardClass() if err != nil { t.Fatal(err) } - want := DrmCardClass{ - "card0": DrmCard{ + want := DRMCardClass{ + "card0": DRMCard{ Name: "card0", Driver: "amdgpu", - Ports: map[string]DrmCardPort{}, + Ports: map[string]DRMCardPort{}, }, - "card1": DrmCard{ + "card1": DRMCard{ Name: "card1", Driver: "i915", - Ports: map[string]DrmCardPort{ + Ports: map[string]DRMCardPort{ "card1-DP-1": { Name: "card1-DP-1", - Dpms: "Off", + DPMS: "Off", Enabled: "disabled", Status: "disconnected", }, "card1-DP-5": { Name: "card1-DP-5", - Dpms: "On", + DPMS: "On", Enabled: "enabled", Status: "connected", }, @@ -60,6 +60,6 @@ func TestClassDRMCard(t *testing.T) { } if diff := cmp.Diff(want, got); diff != "" { - t.Fatalf("unexpected DrmCard class (-want +got):\n%s", diff) + t.Fatalf("unexpected DRMCard class (-want +got):\n%s", diff) } } From 88acb09fcf2c0e9a669b412031224dc038e4f525 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 20:39:30 +0000 Subject: [PATCH 20/69] Bump golang.org/x/sys from 0.28.0 to 0.29.0 Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.28.0 to 0.29.0. - [Commits](https://github.com/golang/sys/compare/v0.28.0...v0.29.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8b757df1..957675f3 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.21 require ( github.com/google/go-cmp v0.6.0 golang.org/x/sync v0.10.0 - golang.org/x/sys v0.28.0 + golang.org/x/sys v0.29.0 ) diff --git a/go.sum b/go.sum index acccf6ae..05082cbc 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 3cc6dc9d63852bd5fadc81a851c08d36f4112151 Mon Sep 17 00:00:00 2001 From: Ville Vesilehto Date: Fri, 31 Jan 2025 22:33:40 +0200 Subject: [PATCH 21/69] fix: correct linters-settings typo in .golangci.yml The linter configuration had a typo ("linter-settings" instead of "linters-settings"), which prevented linter rules from being applied. Fixing this revealed and resolved multiple style issues across the codebase: - Renamed shadowing parameter in `net_unix.go` - Fixed import grouping in `valueparser_test.go` - Corrected comment capitalization and spelling - Unused parameters Signed-off-by: Ville Vesilehto --- .golangci.yml | 2 +- arp.go | 4 ++-- bcache/get.go | 2 +- blockdevice/stats.go | 2 +- fs_statfs_notype.go | 4 ++-- fscache.go | 6 +++--- internal/util/valueparser_test.go | 1 + mountstats.go | 4 ++-- net_ip_socket.go | 6 +++--- net_unix.go | 8 ++++---- proc_cgroup.go | 2 +- proc_io.go | 2 +- proc_smaps.go | 2 +- 13 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index e07e8211..b43e09f6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -15,7 +15,7 @@ linters: - testifylint - unused -linter-settings: +linters-settings: forbidigo: forbid: - p: ^fmt\.Print.*$ diff --git a/arp.go b/arp.go index cdcc8a7c..2e533441 100644 --- a/arp.go +++ b/arp.go @@ -23,9 +23,9 @@ import ( // 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. ATFPublish = 0x08 diff --git a/bcache/get.go b/bcache/get.go index aa380c2b..de018df0 100644 --- a/bcache/get.go +++ b/bcache/get.go @@ -62,7 +62,7 @@ func (fs FS) StatsWithoutPriority() ([]*Stats, error) { return fs.stats(false) } -// stats() retrieves bcache runtime statistics for each bcache. +// stats retrieves bcache runtime statistics for each bcache and // priorityStats flag controls if we need to read priority_stats. func (fs FS) stats(priorityStats bool) ([]*Stats, error) { matches, err := filepath.Glob(fs.sys.Path("fs/bcache/*-*")) diff --git a/blockdevice/stats.go b/blockdevice/stats.go index 1bee6d64..277f2428 100644 --- a/blockdevice/stats.go +++ b/blockdevice/stats.go @@ -483,7 +483,7 @@ func (fs FS) SysBlockDeviceUnderlyingDevices(device string) (UnderlyingDeviceInf } -// SysBlockDeviceSize returns the size of the block device from /sys/block//size. +// 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. func (fs FS) SysBlockDeviceSize(device string) (uint64, error) { size, err := util.ReadUintFromFile(fs.sys.Path(sysBlockPath, device, sysBlockSize)) diff --git a/fs_statfs_notype.go b/fs_statfs_notype.go index 134767d6..1b5bdbdf 100644 --- a/fs_statfs_notype.go +++ b/fs_statfs_notype.go @@ -17,7 +17,7 @@ package procfs // isRealProc returns true on architectures that don't have a Type argument -// in their Statfs_t struct -func isRealProc(mountPoint string) (bool, error) { +// in their Statfs_t struct. +func isRealProc(_ string) (bool, error) { return true, nil } diff --git a/fscache.go b/fscache.go index cf2e3eaa..7db86330 100644 --- a/fscache.go +++ b/fscache.go @@ -162,7 +162,7 @@ type Fscacheinfo struct { ReleaseRequestsAgainstPagesStoredByTimeLockGranted uint64 // Number of release reqs ignored due to in-progress store ReleaseRequestsIgnoredDueToInProgressStore uint64 - // Number of page stores cancelled due to release req + // Number of page stores canceled due to release req PageStoresCancelledByReleaseRequests uint64 VmscanWaiting uint64 // Number of times async ops added to pending queues @@ -171,11 +171,11 @@ type Fscacheinfo struct { OpsRunning uint64 // Number of times async ops queued for processing OpsEnqueued uint64 - // Number of async ops cancelled + // Number of async ops canceled OpsCancelled uint64 // Number of async ops rejected due to object lookup/create failure OpsRejected uint64 - // Number of async ops initialised + // Number of async ops initialized OpsInitialised uint64 // Number of async ops queued for deferred release OpsDeferred uint64 diff --git a/internal/util/valueparser_test.go b/internal/util/valueparser_test.go index fccdf633..63ac8d89 100644 --- a/internal/util/valueparser_test.go +++ b/internal/util/valueparser_test.go @@ -17,6 +17,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" + "github.com/prometheus/procfs/internal/util" ) diff --git a/mountstats.go b/mountstats.go index 75a3b6c8..b6c8d1a5 100644 --- a/mountstats.go +++ b/mountstats.go @@ -45,11 +45,11 @@ const ( fieldTransport11TCPLen = 13 fieldTransport11UDPLen = 10 - // kernel version >= 4.14 MaxLen + // Kernel version >= 4.14 MaxLen // See: https://elixir.bootlin.com/linux/v6.4.8/source/net/sunrpc/xprtrdma/xprt_rdma.h#L393 fieldTransport11RDMAMaxLen = 28 - // kernel version <= 4.2 MinLen + // Kernel version <= 4.2 MinLen // See: https://elixir.bootlin.com/linux/v4.2.8/source/net/sunrpc/xprtrdma/xprt_rdma.h#L331 fieldTransport11RDMAMinLen = 20 ) diff --git a/net_ip_socket.go b/net_ip_socket.go index 0dc3c30f..19e3378f 100644 --- a/net_ip_socket.go +++ b/net_ip_socket.go @@ -25,7 +25,7 @@ import ( ) const ( - // readLimit is used by io.LimitReader while reading the content of the + // Maximum size limit used by io.LimitReader while reading the content of the // /proc/net/udp{,6} files. The number of lines inside such a file is dynamic // as each line represents a single used socket. // In theory, the number of available sockets is 65535 (2^16 - 1) per IP. @@ -54,8 +54,8 @@ type ( Drops *uint64 } - // netIPSocketLine represents the fields parsed from a single line - // in /proc/net/{t,u}dp{,6}. Fields which are not used by IPSocket are skipped. + // A single line parser for fields from /proc/net/{t,u}dp{,6}. + // Fields which are not used by IPSocket are skipped. // Drops is non-nil for udp{,6}, but nil for tcp{,6}. // For the proc file format details, see https://linux.die.net/man/5/proc. netIPSocketLine struct { diff --git a/net_unix.go b/net_unix.go index d868cebd..d7e0cacb 100644 --- a/net_unix.go +++ b/net_unix.go @@ -121,12 +121,12 @@ func parseNetUNIX(r io.Reader) (*NetUNIX, error) { return &nu, nil } -func (u *NetUNIX) parseLine(line string, hasInode bool, min int) (*NetUNIXLine, error) { +func (u *NetUNIX) parseLine(line string, hasInode bool, minFields int) (*NetUNIXLine, error) { fields := strings.Fields(line) l := len(fields) - if l < min { - return nil, fmt.Errorf("%w: expected at least %d fields but got %d", ErrFileParse, min, l) + if l < minFields { + return nil, fmt.Errorf("%w: expected at least %d fields but got %d", ErrFileParse, minFields, l) } // Field offsets are as follows: @@ -172,7 +172,7 @@ func (u *NetUNIX) parseLine(line string, hasInode bool, min int) (*NetUNIXLine, } // Path field is optional. - if l > min { + if l > minFields { // Path occurs at either index 6 or 7 depending on whether inode is // already present. pathIdx := 7 diff --git a/proc_cgroup.go b/proc_cgroup.go index daeed7f5..4a64347c 100644 --- a/proc_cgroup.go +++ b/proc_cgroup.go @@ -24,7 +24,7 @@ import ( ) // Cgroup models one line from /proc/[pid]/cgroup. Each Cgroup struct describes the placement of a PID inside a -// specific control hierarchy. The kernel has two cgroup APIs, v1 and v2. v1 has one hierarchy per available resource +// specific control hierarchy. The kernel has two cgroup APIs, v1 and v2. The v1 has one hierarchy per available resource // controller, while v2 has one unified hierarchy shared by all controllers. Regardless of v1 or v2, all hierarchies // contain all running processes, so the question answerable with a Cgroup struct is 'where is this process in // this hierarchy' (where==what path on the specific cgroupfs). By prefixing this path with the mount point of diff --git a/proc_io.go b/proc_io.go index 776f3497..d15b66dd 100644 --- a/proc_io.go +++ b/proc_io.go @@ -50,7 +50,7 @@ func (p Proc) IO() (ProcIO, error) { ioFormat := "rchar: %d\nwchar: %d\nsyscr: %d\nsyscw: %d\n" + "read_bytes: %d\nwrite_bytes: %d\n" + - "cancelled_write_bytes: %d\n" + "cancelled_write_bytes: %d\n" //nolint:misspell _, err = fmt.Sscanf(string(data), ioFormat, &pio.RChar, &pio.WChar, &pio.SyscR, &pio.SyscW, &pio.ReadBytes, &pio.WriteBytes, &pio.CancelledWriteBytes) diff --git a/proc_smaps.go b/proc_smaps.go index 07e7e650..9a297afc 100644 --- a/proc_smaps.go +++ b/proc_smaps.go @@ -28,7 +28,7 @@ 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].*$`) ) From 64d7b47109a1296e87f8e3e16d49806fdda02993 Mon Sep 17 00:00:00 2001 From: Ville Vesilehto Date: Sun, 2 Feb 2025 14:09:08 +0200 Subject: [PATCH 22/69] chore: nolint misspell on vulnerability names Signed-off-by: Ville Vesilehto --- sysfs/vulnerability_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysfs/vulnerability_test.go b/sysfs/vulnerability_test.go index ec9cafcb..561640e4 100644 --- a/sysfs/vulnerability_test.go +++ b/sysfs/vulnerability_test.go @@ -41,8 +41,8 @@ func TestFS_CPUVulnerabilities(t *testing.T) { {"Not affected", "tsx_async_abort", &Vulnerability{CodeName: "tsx_async_abort", State: VulnerabilityStateNotAffected, Mitigation: ""}, false}, {"Mitigation simple string", "spec_store_bypass", &Vulnerability{CodeName: "spec_store_bypass", State: VulnerabilityStateMitigation, Mitigation: "Speculative Store Bypass disabled via prctl"}, false}, {"Mitigation special chars", "retbleed", &Vulnerability{CodeName: "retbleed", State: VulnerabilityStateMitigation, Mitigation: "untrained return thunk; SMT enabled with STIBP protection"}, false}, - {"Mitigation more special chars", "spectre_v1", &Vulnerability{CodeName: "spectre_v1", State: VulnerabilityStateMitigation, Mitigation: "usercopy/swapgs barriers and __user pointer sanitization"}, false}, - {"Mitigation with multiple subsections", "spectre_v2", &Vulnerability{CodeName: "spectre_v2", State: VulnerabilityStateMitigation, Mitigation: "Retpolines, IBPB: conditional, STIBP: always-on, RSB filling, PBRSB-eIBRS: Not affected"}, false}, + {"Mitigation more special chars", "spectre_v1", &Vulnerability{CodeName: "spectre_v1", State: VulnerabilityStateMitigation, Mitigation: "usercopy/swapgs barriers and __user pointer sanitization"}, false}, //nolint:misspell + {"Mitigation with multiple subsections", "spectre_v2", &Vulnerability{CodeName: "spectre_v2", State: VulnerabilityStateMitigation, Mitigation: "Retpolines, IBPB: conditional, STIBP: always-on, RSB filling, PBRSB-eIBRS: Not affected"}, false}, //nolint:misspell {"Vulnerable", "mds", &Vulnerability{CodeName: "mds", State: VulnerabilityStateVulnerable, Mitigation: ""}, false}, {"Vulnerable with mitigation available", "mmio_stale_data", &Vulnerability{CodeName: "mmio_stale_data", State: VulnerabilityStateVulnerable, Mitigation: "Clear CPU buffers attempted, no microcode"}, false}, {"Unknown", "srbds", &Vulnerability{CodeName: "srbds", State: VulnerabilityStateUnknown, Mitigation: "Dependent on hypervisor status"}, false}, From 5d8dd5587b3589f4861ac5b4cd500d9e0e11ecc6 Mon Sep 17 00:00:00 2001 From: Felix Geschwindner Date: Sun, 2 Feb 2025 09:58:42 -0800 Subject: [PATCH 23/69] Add support for per-interface SNMP6 stats Signed-off-by: Felix Geschwindner --- README.md | 6 +- net_dev_snmp6.go | 96 ++++++++++++ net_dev_snmp6_test.go | 86 ++++++++++ testdata/fixtures.ttar | 348 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 533 insertions(+), 3 deletions(-) create mode 100644 net_dev_snmp6.go create mode 100644 net_dev_snmp6_test.go diff --git a/README.md b/README.md index 1224816c..0718239c 100644 --- a/README.md +++ b/README.md @@ -47,15 +47,15 @@ However, most of the API includes unit tests which can be run with `make test`. The procfs library includes a set of test fixtures which include many example files from the `/proc` and `/sys` filesystems. These fixtures are included as a [ttar](https://github.com/ideaship/ttar) file which is extracted automatically during testing. To add/update the test fixtures, first -ensure the `fixtures` directory is up to date by removing the existing directory and then -extracting the ttar file using `make fixtures/.unpacked` or just `make test`. +ensure the `testdata/fixtures` directory is up to date by removing the existing directory and then +extracting the ttar file using `make testdata/fixtures/.unpacked` or just `make test`. ```bash rm -rf testdata/fixtures make test ``` -Next, make the required changes to the extracted files in the `fixtures` directory. When +Next, make the required changes to the extracted files in the `testdata/fixtures` directory. When the changes are complete, run `make update_fixtures` to create a new `fixtures.ttar` file based on the updated `fixtures` directory. And finally, verify the changes using `git diff testdata/fixtures.ttar`. diff --git a/net_dev_snmp6.go b/net_dev_snmp6.go new file mode 100644 index 00000000..f50b38e3 --- /dev/null +++ b/net_dev_snmp6.go @@ -0,0 +1,96 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "bufio" + "errors" + "io" + "os" + "strconv" + "strings" +) + +// NetDevSNMP6 is parsed from files in /proc/net/dev_snmp6/ or /proc//net/dev_snmp6/. +// The outer map's keys are interface names and the inner map's keys are stat names. +// +// If you'd like a total across all interfaces, please use the Snmp6() method of the Proc type. +type NetDevSNMP6 map[string]map[string]uint64 + +// Returns kernel/system statistics read from interface files within the /proc/net/dev_snmp6/ +// directory. +func (fs FS) NetDevSNMP6() (NetDevSNMP6, error) { + return newNetDevSNMP6(fs.proc.Path("net/dev_snmp6")) +} + +// Returns kernel/system statistics read from interface files within the /proc//net/dev_snmp6/ +// directory. +func (p Proc) NetDevSNMP6() (NetDevSNMP6, error) { + return newNetDevSNMP6(p.path("net/dev_snmp6")) +} + +// newNetDevSNMP6 creates a new NetDevSNMP6 from the contents of the given directory. +func newNetDevSNMP6(dir string) (NetDevSNMP6, error) { + netDevSNMP6 := make(NetDevSNMP6) + + // The net/dev_snmp6 folders contain one file per interface + ifaceFiles, err := os.ReadDir(dir) + if err != nil { + // On systems with IPv6 disabled, this directory won't exist. + // Do nothing. + if errors.Is(err, os.ErrNotExist) { + return netDevSNMP6, err + } + return netDevSNMP6, err + } + + for _, iFaceFile := range ifaceFiles { + f, err := os.Open(dir + "/" + iFaceFile.Name()) + if err != nil { + return netDevSNMP6, err + } + defer f.Close() + + netDevSNMP6[iFaceFile.Name()], err = parseNetDevSNMP6Stats(f) + if err != nil { + return netDevSNMP6, err + } + } + + return netDevSNMP6, nil +} + +func parseNetDevSNMP6Stats(r io.Reader) (map[string]uint64, error) { + m := make(map[string]uint64) + + scanner := bufio.NewScanner(r) + for scanner.Scan() { + stat := strings.Fields(scanner.Text()) + if len(stat) < 2 { + continue + } + key, val := stat[0], stat[1] + + // Expect stat name to contain "6" or be "ifIndex" + if strings.Contains(key, "6") || key == "ifIndex" { + v, err := strconv.ParseUint(val, 10, 64) + if err != nil { + return m, err + } + + m[key] = v + } + } + return m, scanner.Err() +} diff --git a/net_dev_snmp6_test.go b/net_dev_snmp6_test.go new file mode 100644 index 00000000..b5ace7be --- /dev/null +++ b/net_dev_snmp6_test.go @@ -0,0 +1,86 @@ +// Copyright 2025 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "fmt" + "testing" +) + +func TestNetDevSNMP6(t *testing.T) { + fs, err := NewFS(procTestFixtures) + if err != nil { + t.Fatal(err) + } + + netDevSNMP6, err := fs.NetDevSNMP6() + if err != nil { + t.Fatal(err) + } + + if err := validateNetDevSNMP6(netDevSNMP6); err != nil { + t.Error(err.Error()) + } +} + +func TestProcNetDevSNMP6(t *testing.T) { + p, err := getProcFixtures(t).Proc(26231) + if err != nil { + t.Fatal(err) + } + + procNetDevSNMP6, err := p.NetDevSNMP6() + if err != nil { + t.Fatal(err) + } + + if err := validateNetDevSNMP6(procNetDevSNMP6); err != nil { + t.Error(err.Error()) + } +} + +func validateNetDevSNMP6(have NetDevSNMP6) error { + var wantNetDevSNMP6 = map[string]map[string]uint64{ + "eth0": { + "ifIndex": 1, + "Ip6InOctets": 14064059261, + "Ip6OutOctets": 811213622, + "Icmp6InMsgs": 53293, + "Icmp6OutMsgs": 20400, + }, + "eth1": { + "ifIndex": 2, + "Ip6InOctets": 303177290674, + "Ip6OutOctets": 29245052746, + "Icmp6InMsgs": 37911, + "Icmp6OutMsgs": 114015, + }, + } + + for wantIface, wantData := range wantNetDevSNMP6 { + if haveData, ok := have[wantIface]; ok { + for wantStat, wantVal := range wantData { + if haveVal, ok := haveData[wantStat]; !ok { + return fmt.Errorf("stat %s missing from %s test data", wantStat, wantIface) + } else if wantVal != haveVal { + return fmt.Errorf("%s - %s: want %d, have %d", wantIface, wantStat, wantVal, haveVal) + } + } + } else { + return fmt.Errorf("%s not found in test data", wantIface) + } + } + + return nil +} diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index f64f09e5..8f6cd477 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -209,6 +209,180 @@ Inter-| Receive | Transmit eth0: 438 5 0 0 0 0 0 0 648 8 0 0 0 0 0 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/proc/26231/net/dev_snmp6 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/26231/net/dev_snmp6/eth0 +Lines: 83 +ifIndex 1 +Ip6InReceives 3057229 +Ip6InHdrErrors 0 +Ip6InTooBigErrors 0 +Ip6InNoRoutes 0 +Ip6InAddrErrors 0 +Ip6InUnknownProtos 0 +Ip6InTruncatedPkts 0 +Ip6InDiscards 0 +Ip6InDelivers 3056375 +Ip6OutForwDatagrams 0 +Ip6OutRequests 2359950 +Ip6OutDiscards 0 +Ip6OutNoRoutes 0 +Ip6ReasmTimeout 0 +Ip6ReasmReqds 0 +Ip6ReasmOKs 0 +Ip6ReasmFails 0 +Ip6FragOKs 0 +Ip6FragFails 5 +Ip6FragCreates 0 +Ip6InMcastPkts 40895 +Ip6OutMcastPkts 6221 +Ip6InOctets 14064059261 +Ip6OutOctets 811213622 +Ip6InMcastOctets 3425239 +Ip6OutMcastOctets 791888 +Ip6InBcastOctets 0 +Ip6OutBcastOctets 0 +Ip6InNoECTPkts 10518218 +Ip6InECT1Pkts 0 +Ip6InECT0Pkts 179561 +Ip6InCEPkts 0 +Ip6OutTransmits 2359950 +Icmp6InMsgs 53293 +Icmp6InErrors 0 +Icmp6OutMsgs 20400 +Icmp6OutErrors 0 +Icmp6InCsumErrors 0 +Icmp6OutRateLimitHost 0 +Icmp6InDestUnreachs 306 +Icmp6InPktTooBigs 12 +Icmp6InTimeExcds 0 +Icmp6InParmProblems 0 +Icmp6InEchos 11 +Icmp6InEchoReplies 0 +Icmp6InGroupMembQueries 0 +Icmp6InGroupMembResponses 0 +Icmp6InGroupMembReductions 0 +Icmp6InRouterSolicits 0 +Icmp6InRouterAdvertisements 16615 +Icmp6InNeighborSolicits 8892 +Icmp6InNeighborAdvertisements 27457 +Icmp6InRedirects 0 +Icmp6InMLDv2Reports 0 +Icmp6OutDestUnreachs 275 +Icmp6OutPktTooBigs 5 +Icmp6OutTimeExcds 0 +Icmp6OutParmProblems 0 +Icmp6OutEchos 0 +Icmp6OutEchoReplies 11 +Icmp6OutGroupMembQueries 0 +Icmp6OutGroupMembResponses 0 +Icmp6OutGroupMembReductions 0 +Icmp6OutRouterSolicits 1 +Icmp6OutRouterAdvertisements 0 +Icmp6OutNeighborSolicits 5864 +Icmp6OutNeighborAdvertisements 8891 +Icmp6OutRedirects 0 +Icmp6OutMLDv2Reports 5353 +Icmp6InType1 306 +Icmp6InType2 12 +Icmp6InType128 11 +Icmp6InType134 16615 +Icmp6InType135 8892 +Icmp6InType136 27457 +Icmp6OutType1 275 +Icmp6OutType2 5 +Icmp6OutType129 11 +Icmp6OutType133 1 +Icmp6OutType135 5864 +Icmp6OutType136 8891 +Icmp6OutType143 5353 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/26231/net/dev_snmp6/eth1 +Lines: 80 +ifIndex 2 +Ip6InReceives 234373162 +Ip6InHdrErrors 12 +Ip6InTooBigErrors 0 +Ip6InNoRoutes 48 +Ip6InAddrErrors 0 +Ip6InUnknownProtos 0 +Ip6InTruncatedPkts 0 +Ip6InDiscards 0 +Ip6InDelivers 2023911 +Ip6OutForwDatagrams 43716990 +Ip6OutRequests 2185080 +Ip6OutDiscards 0 +Ip6OutNoRoutes 0 +Ip6ReasmTimeout 0 +Ip6ReasmReqds 0 +Ip6ReasmOKs 0 +Ip6ReasmFails 0 +Ip6FragOKs 0 +Ip6FragFails 0 +Ip6FragCreates 0 +Ip6InMcastPkts 7648 +Ip6OutMcastPkts 15218 +Ip6InOctets 303177290674 +Ip6OutOctets 29245052746 +Ip6InMcastOctets 805916 +Ip6OutMcastOctets 2976102 +Ip6InBcastOctets 0 +Ip6OutBcastOctets 0 +Ip6InNoECTPkts 152608869 +Ip6InECT1Pkts 73833 +Ip6InECT0Pkts 81686963 +Ip6InCEPkts 3497 +Ip6OutTransmits 47151828 +Icmp6InMsgs 37911 +Icmp6InErrors 3 +Icmp6OutMsgs 114015 +Icmp6OutErrors 0 +Icmp6InCsumErrors 0 +Icmp6OutRateLimitHost 1899 +Icmp6InDestUnreachs 12 +Icmp6InPktTooBigs 0 +Icmp6InTimeExcds 0 +Icmp6InParmProblems 0 +Icmp6InEchos 0 +Icmp6InEchoReplies 0 +Icmp6InGroupMembQueries 0 +Icmp6InGroupMembResponses 0 +Icmp6InGroupMembReductions 0 +Icmp6InRouterSolicits 0 +Icmp6InRouterAdvertisements 7521 +Icmp6InNeighborSolicits 13184 +Icmp6InNeighborAdvertisements 17194 +Icmp6InRedirects 0 +Icmp6InMLDv2Reports 0 +Icmp6OutDestUnreachs 68537 +Icmp6OutPktTooBigs 0 +Icmp6OutTimeExcds 12 +Icmp6OutParmProblems 0 +Icmp6OutEchos 0 +Icmp6OutEchoReplies 0 +Icmp6OutGroupMembQueries 0 +Icmp6OutGroupMembResponses 0 +Icmp6OutGroupMembReductions 0 +Icmp6OutRouterSolicits 7 +Icmp6OutRouterAdvertisements 0 +Icmp6OutNeighborSolicits 17216 +Icmp6OutNeighborAdvertisements 13184 +Icmp6OutRedirects 0 +Icmp6OutMLDv2Reports 15059 +Icmp6InType1 12 +Icmp6InType134 7521 +Icmp6InType135 13184 +Icmp6InType136 17194 +Icmp6OutType1 68537 +Icmp6OutType3 12 +Icmp6OutType133 7 +Icmp6OutType135 17216 +Icmp6OutType136 13184 +Icmp6OutType143 15059 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/26231/net/netstat Lines: 4 TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFailed EmbryonicRsts PruneCalled RcvPruned OfoPruned OutOfWindowIcmps LockDroppedIcmps ArpFilter TW TWRecycled TWKilled PAWSActive PAWSEstab DelayedACKs DelayedACKLocked DelayedACKLost ListenOverflows ListenDrops TCPHPHits TCPPureAcks TCPHPAcks TCPRenoRecovery TCPSackRecovery TCPSACKReneging TCPSACKReorder TCPRenoReorder TCPTSReorder TCPFullUndo TCPPartialUndo TCPDSACKUndo TCPLossUndo TCPLostRetransmit TCPRenoFailures TCPSackFailures TCPLossFailures TCPFastRetrans TCPSlowStartRetrans TCPTimeouts TCPLossProbes TCPLossProbeRecovery TCPRenoRecoveryFail TCPSackRecoveryFail TCPRcvCollapsed TCPDSACKOldSent TCPDSACKOfoSent TCPDSACKRecv TCPDSACKOfoRecv TCPAbortOnData TCPAbortOnClose TCPAbortOnMemory TCPAbortOnTimeout TCPAbortOnLinger TCPAbortFailed TCPMemoryPressures TCPMemoryPressuresChrono TCPSACKDiscard TCPDSACKIgnoredOld TCPDSACKIgnoredNoUndo TCPSpuriousRTOs TCPMD5NotFound TCPMD5Unexpected TCPMD5Failure TCPSackShifted TCPSackMerged TCPSackShiftFallback TCPBacklogDrop PFMemallocDrop TCPMinTTLDrop TCPDeferAcceptDrop IPReversePathFilter TCPTimeWaitOverflow TCPReqQFullDoCookies TCPReqQFullDrop TCPRetransFail TCPRcvCoalesce TCPRcvQDrop TCPOFOQueue TCPOFODrop TCPOFOMerge TCPChallengeACK TCPSYNChallenge TCPFastOpenActive TCPFastOpenActiveFail TCPFastOpenPassive TCPFastOpenPassiveFail TCPFastOpenListenOverflow TCPFastOpenCookieReqd TCPFastOpenBlackhole TCPSpuriousRtxHostQueues BusyPollRxPackets TCPAutoCorking TCPFromZeroWindowAdv TCPToZeroWindowAdv TCPWantZeroWindowAdv TCPSynRetrans TCPOrigDataSent TCPHystartTrainDetect TCPHystartTrainCwnd TCPHystartDelayDetect TCPHystartDelayCwnd TCPACKSkippedSynRecv TCPACKSkippedPAWS TCPACKSkippedSeq TCPACKSkippedFinWait2 TCPACKSkippedTimeWait TCPACKSkippedChallenge TCPWinProbe TCPKeepAlive TCPMTUPFail TCPMTUPSuccess TCPWqueueTooBig @@ -2383,6 +2557,180 @@ docker0: 2568 38 0 0 0 0 0 0 438 eth0: 874354587 1036395 0 0 0 0 0 0 563352563 732147 0 0 0 0 0 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/proc/net/dev_snmp6 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/net/dev_snmp6/eth0 +Lines: 83 +ifIndex 1 +Ip6InReceives 3057229 +Ip6InHdrErrors 0 +Ip6InTooBigErrors 0 +Ip6InNoRoutes 0 +Ip6InAddrErrors 0 +Ip6InUnknownProtos 0 +Ip6InTruncatedPkts 0 +Ip6InDiscards 0 +Ip6InDelivers 3056375 +Ip6OutForwDatagrams 0 +Ip6OutRequests 2359950 +Ip6OutDiscards 0 +Ip6OutNoRoutes 0 +Ip6ReasmTimeout 0 +Ip6ReasmReqds 0 +Ip6ReasmOKs 0 +Ip6ReasmFails 0 +Ip6FragOKs 0 +Ip6FragFails 5 +Ip6FragCreates 0 +Ip6InMcastPkts 40895 +Ip6OutMcastPkts 6221 +Ip6InOctets 14064059261 +Ip6OutOctets 811213622 +Ip6InMcastOctets 3425239 +Ip6OutMcastOctets 791888 +Ip6InBcastOctets 0 +Ip6OutBcastOctets 0 +Ip6InNoECTPkts 10518218 +Ip6InECT1Pkts 0 +Ip6InECT0Pkts 179561 +Ip6InCEPkts 0 +Ip6OutTransmits 2359950 +Icmp6InMsgs 53293 +Icmp6InErrors 0 +Icmp6OutMsgs 20400 +Icmp6OutErrors 0 +Icmp6InCsumErrors 0 +Icmp6OutRateLimitHost 0 +Icmp6InDestUnreachs 306 +Icmp6InPktTooBigs 12 +Icmp6InTimeExcds 0 +Icmp6InParmProblems 0 +Icmp6InEchos 11 +Icmp6InEchoReplies 0 +Icmp6InGroupMembQueries 0 +Icmp6InGroupMembResponses 0 +Icmp6InGroupMembReductions 0 +Icmp6InRouterSolicits 0 +Icmp6InRouterAdvertisements 16615 +Icmp6InNeighborSolicits 8892 +Icmp6InNeighborAdvertisements 27457 +Icmp6InRedirects 0 +Icmp6InMLDv2Reports 0 +Icmp6OutDestUnreachs 275 +Icmp6OutPktTooBigs 5 +Icmp6OutTimeExcds 0 +Icmp6OutParmProblems 0 +Icmp6OutEchos 0 +Icmp6OutEchoReplies 11 +Icmp6OutGroupMembQueries 0 +Icmp6OutGroupMembResponses 0 +Icmp6OutGroupMembReductions 0 +Icmp6OutRouterSolicits 1 +Icmp6OutRouterAdvertisements 0 +Icmp6OutNeighborSolicits 5864 +Icmp6OutNeighborAdvertisements 8891 +Icmp6OutRedirects 0 +Icmp6OutMLDv2Reports 5353 +Icmp6InType1 306 +Icmp6InType2 12 +Icmp6InType128 11 +Icmp6InType134 16615 +Icmp6InType135 8892 +Icmp6InType136 27457 +Icmp6OutType1 275 +Icmp6OutType2 5 +Icmp6OutType129 11 +Icmp6OutType133 1 +Icmp6OutType135 5864 +Icmp6OutType136 8891 +Icmp6OutType143 5353 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/net/dev_snmp6/eth1 +Lines: 80 +ifIndex 2 +Ip6InReceives 234373162 +Ip6InHdrErrors 12 +Ip6InTooBigErrors 0 +Ip6InNoRoutes 48 +Ip6InAddrErrors 0 +Ip6InUnknownProtos 0 +Ip6InTruncatedPkts 0 +Ip6InDiscards 0 +Ip6InDelivers 2023911 +Ip6OutForwDatagrams 43716990 +Ip6OutRequests 2185080 +Ip6OutDiscards 0 +Ip6OutNoRoutes 0 +Ip6ReasmTimeout 0 +Ip6ReasmReqds 0 +Ip6ReasmOKs 0 +Ip6ReasmFails 0 +Ip6FragOKs 0 +Ip6FragFails 0 +Ip6FragCreates 0 +Ip6InMcastPkts 7648 +Ip6OutMcastPkts 15218 +Ip6InOctets 303177290674 +Ip6OutOctets 29245052746 +Ip6InMcastOctets 805916 +Ip6OutMcastOctets 2976102 +Ip6InBcastOctets 0 +Ip6OutBcastOctets 0 +Ip6InNoECTPkts 152608869 +Ip6InECT1Pkts 73833 +Ip6InECT0Pkts 81686963 +Ip6InCEPkts 3497 +Ip6OutTransmits 47151828 +Icmp6InMsgs 37911 +Icmp6InErrors 3 +Icmp6OutMsgs 114015 +Icmp6OutErrors 0 +Icmp6InCsumErrors 0 +Icmp6OutRateLimitHost 1899 +Icmp6InDestUnreachs 12 +Icmp6InPktTooBigs 0 +Icmp6InTimeExcds 0 +Icmp6InParmProblems 0 +Icmp6InEchos 0 +Icmp6InEchoReplies 0 +Icmp6InGroupMembQueries 0 +Icmp6InGroupMembResponses 0 +Icmp6InGroupMembReductions 0 +Icmp6InRouterSolicits 0 +Icmp6InRouterAdvertisements 7521 +Icmp6InNeighborSolicits 13184 +Icmp6InNeighborAdvertisements 17194 +Icmp6InRedirects 0 +Icmp6InMLDv2Reports 0 +Icmp6OutDestUnreachs 68537 +Icmp6OutPktTooBigs 0 +Icmp6OutTimeExcds 12 +Icmp6OutParmProblems 0 +Icmp6OutEchos 0 +Icmp6OutEchoReplies 0 +Icmp6OutGroupMembQueries 0 +Icmp6OutGroupMembResponses 0 +Icmp6OutGroupMembReductions 0 +Icmp6OutRouterSolicits 7 +Icmp6OutRouterAdvertisements 0 +Icmp6OutNeighborSolicits 17216 +Icmp6OutNeighborAdvertisements 13184 +Icmp6OutRedirects 0 +Icmp6OutMLDv2Reports 15059 +Icmp6InType1 12 +Icmp6InType134 7521 +Icmp6InType135 13184 +Icmp6InType136 17194 +Icmp6OutType1 68537 +Icmp6OutType3 12 +Icmp6OutType133 7 +Icmp6OutType135 17216 +Icmp6OutType136 13184 +Icmp6OutType143 15059 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/net/ip_vs Lines: 21 IP Virtual Server version 1.2.1 (size=4096) From ca691f1d2ef79c766a0ddf9e0d8d3a09bcd2bd08 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 2 Mar 2025 20:39:47 +0100 Subject: [PATCH 24/69] build(deps): bump golang.org/x/sync from 0.10.0 to 0.11.0 (#701) Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.10.0 to 0.11.0. - [Commits](https://github.com/golang/sync/compare/v0.10.0...v0.11.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 957675f3..53bcd0ff 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.21 require ( github.com/google/go-cmp v0.6.0 - golang.org/x/sync v0.10.0 + golang.org/x/sync v0.11.0 golang.org/x/sys v0.29.0 ) diff --git a/go.sum b/go.sum index 05082cbc..7d0b42fe 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 672fb0ee631cb5fdc368dbabd4bbbf4bed74cd9c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 2 Mar 2025 20:44:22 +0100 Subject: [PATCH 25/69] build(deps): bump github.com/google/go-cmp from 0.6.0 to 0.7.0 (#702) Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.6.0 to 0.7.0. - [Release notes](https://github.com/google/go-cmp/releases) - [Commits](https://github.com/google/go-cmp/compare/v0.6.0...v0.7.0) --- updated-dependencies: - dependency-name: github.com/google/go-cmp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 53bcd0ff..152c364f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/prometheus/procfs go 1.21 require ( - github.com/google/go-cmp v0.6.0 + github.com/google/go-cmp v0.7.0 golang.org/x/sync v0.11.0 golang.org/x/sys v0.29.0 ) diff --git a/go.sum b/go.sum index 7d0b42fe..c8e9c2b8 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= From 775997f46ff61807cd9980078b8fdfee847d0c2d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 2 Mar 2025 20:44:35 +0100 Subject: [PATCH 26/69] build(deps): bump golang.org/x/sys from 0.29.0 to 0.30.0 (#703) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.29.0 to 0.30.0. - [Commits](https://github.com/golang/sys/compare/v0.29.0...v0.30.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 152c364f..e14d6541 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.21 require ( github.com/google/go-cmp v0.7.0 golang.org/x/sync v0.11.0 - golang.org/x/sys v0.29.0 + golang.org/x/sys v0.30.0 ) diff --git a/go.sum b/go.sum index c8e9c2b8..812aaf44 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= From 171952fe5a3d4a43b5e88a166f4c7ff06c71b678 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Tue, 18 Mar 2025 09:36:16 +0100 Subject: [PATCH 27/69] Update common Prometheus files (#671) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index a15cfc97..1c099932 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: From 1e882c21d811247c720f8369a2ba7dadd2fafab7 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Tue, 18 Mar 2025 23:26:05 +0100 Subject: [PATCH 28/69] Update common Prometheus files (#709) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 10 +++++----- Makefile.common | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 1c099932..e36a9f1a 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -24,16 +24,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Install Go - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 with: - go-version: 1.23.x + go-version: 1.24.x - name: Install snmp_exporter/generator dependencies run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' - name: Lint - uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 + uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0 with: args: --verbose - version: v1.60.2 + version: v1.64.6 diff --git a/Makefile.common b/Makefile.common index cbb5d863..8cb38385 100644 --- a/Makefile.common +++ b/Makefile.common @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.60.2 +GOLANGCI_LINT_VERSION ?= v1.64.6 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) From 0289c96206b614a57a78f74450b389d6262401b3 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Sun, 23 Mar 2025 16:58:12 +0100 Subject: [PATCH 29/69] Update common Prometheus files (#710) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index e36a9f1a..b404ce7c 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -33,7 +33,7 @@ jobs: run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' - name: Lint - uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0 + uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2 with: args: --verbose version: v1.64.6 From ba1e271eed931208d46deafe4dfeedc38bd85d0d Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Mon, 31 Mar 2025 12:19:11 +0200 Subject: [PATCH 30/69] Update Go (#708) * Update latest Go to 1.24. * Update minimum Go to 1.23. * Bump Go modules. Signed-off-by: SuperQ --- .circleci/config.yml | 8 +++----- go.mod | 6 +++--- go.sum | 8 ++++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8a00ef62..19a082bf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ version: 2.1 jobs: lint: docker: - - image: cimg/go:1.23 + - image: cimg/go:1.24 steps: - checkout - run: make check_license @@ -46,9 +46,8 @@ workflows: matrix: parameters: go_version: - - "1.21" - - "1.22" - "1.23" + - "1.24" - test: name: test-windows os: windows @@ -56,6 +55,5 @@ workflows: matrix: parameters: go_version: - - "1.21" - - "1.22" - "1.23" + - "1.24" diff --git a/go.mod b/go.mod index e14d6541..44be2351 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ module github.com/prometheus/procfs -go 1.21 +go 1.23.0 require ( github.com/google/go-cmp v0.7.0 - golang.org/x/sync v0.11.0 - golang.org/x/sys v0.30.0 + golang.org/x/sync v0.12.0 + golang.org/x/sys v0.31.0 ) diff --git a/go.sum b/go.sum index 812aaf44..6eb97cbd 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= -golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= -golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= +golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= From 6c7a48199e7caff301cc4dac308a82f6d0a5abba Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Mon, 31 Mar 2025 12:19:27 +0200 Subject: [PATCH 31/69] Update common Prometheus files (#713) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index b404ce7c..5342cbe0 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -26,7 +26,7 @@ jobs: - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Install Go - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 + uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 with: go-version: 1.24.x - name: Install snmp_exporter/generator dependencies From 67f32efcfd2148c97c1152315b0e18c88abc4fd9 Mon Sep 17 00:00:00 2001 From: Kemal Akkoyun Date: Sat, 19 Apr 2025 17:32:48 +0200 Subject: [PATCH 32/69] chore: Upgrade golangci-lint to v2 (#715) - Migrate the configuration file - Update the tooling version and CI - Apply auto-fixes Signed-off-by: Kemal Akkoyun --- .github/workflows/golangci-lint.yml | 4 +- .golangci.yml | 72 +++++---- Makefile.common | 4 +- buddyinfo_test.go | 8 +- ipvs_test.go | 4 +- iscsi/get_test.go | 9 +- mountstats.go | 23 +-- net_protocols.go | 21 +-- proc.go | 8 +- proc_netstat.go | 224 ++++++++++++++-------------- proc_netstat_test.go | 14 +- proc_snmp.go | 120 +++++++-------- proc_snmp6.go | 150 +++++++++---------- proc_snmp6_test.go | 10 +- proc_snmp_test.go | 14 +- proc_sys.go | 2 +- proc_sys_test.go | 2 +- softirqs.go | 22 +-- sysfs/system_cpu.go | 6 +- 19 files changed, 369 insertions(+), 348 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 5342cbe0..3893ef86 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -33,7 +33,7 @@ jobs: run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' - name: Lint - uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2 + uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0 with: args: --verbose - version: v1.64.6 + version: v2.0.2 diff --git a/.golangci.yml b/.golangci.yml index b43e09f6..3c3bf910 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,31 +1,45 @@ ---- +version: "2" linters: enable: - - errcheck - - forbidigo - - godot - - gofmt - - goimports - - gosimple - - govet - - ineffassign - - misspell - - revive - - staticcheck - - testifylint - - unused - -linters-settings: - forbidigo: - forbid: - - p: ^fmt\.Print.*$ - msg: Do not commit print statements. - godot: - capital: true - exclude: - # Ignore "See: URL" - - 'See:' - goimports: - local-prefixes: github.com/prometheus/procfs - misspell: - locale: US + - forbidigo + - godot + - misspell + - revive + - testifylint + settings: + forbidigo: + forbid: + - pattern: ^fmt\.Print.*$ + msg: Do not commit print statements. + godot: + exclude: + # Ignore "See: URL". + - 'See:' + capital: true + misspell: + locale: US + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + - goimports + settings: + goimports: + local-prefixes: + - github.com/prometheus/procfs + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile.common b/Makefile.common index 8cb38385..0ed55c2b 100644 --- a/Makefile.common +++ b/Makefile.common @@ -33,7 +33,7 @@ GOHOSTOS ?= $(shell $(GO) env GOHOSTOS) GOHOSTARCH ?= $(shell $(GO) env GOHOSTARCH) GO_VERSION ?= $(shell $(GO) version) -GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION)) +GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION))Error Parsing File PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.') PROMU := $(FIRST_GOPATH)/bin/promu @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.64.6 +GOLANGCI_LINT_VERSION ?= v2.0.2 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) diff --git a/buddyinfo_test.go b/buddyinfo_test.go index 8237724f..05ea302e 100644 --- a/buddyinfo_test.go +++ b/buddyinfo_test.go @@ -52,8 +52,8 @@ Node 0, zone if err == nil { t.Fatalf("expected error, but none occurred") } - if want, got := "Error Parsing File: Invalid number of fields, found: [Node 0, zone]", err.Error(); want != got { - t.Fatalf("Error Parsing File: Invalid number of fields, found: [Node %q, %q]", want, got) + if want, got := "error parsing file: Invalid number of fields, found: [Node 0, zone]", err.Error(); want != got { + t.Fatalf("error parsing file: Invalid number of fields, found: [Node %q, %q]", want, got) } } @@ -68,7 +68,7 @@ Node 0, zone Normal 4381 1093 185 1530 567 102 4 0 if err == nil { t.Fatalf("expected error, but none occurred") } - if want, got := "Error Parsing File: mismatch in number of buddyinfo buckets, previous count 11, new count 12", err.Error(); !strings.HasPrefix(got, want) { - t.Fatalf("Error Parsing File: mismatch in number of buddyinfo buckets, previous count %q, new count %q", want, got) + if want, got := "error parsing file: mismatch in number of buddyinfo buckets, previous count 11, new count 12", err.Error(); !strings.HasPrefix(got, want) { + t.Fatalf("error parsing file: mismatch in number of buddyinfo buckets, previous count %q, new count %q", want, got) } } diff --git a/ipvs_test.go b/ipvs_test.go index 4feb0cb3..2f6f1197 100644 --- a/ipvs_test.go +++ b/ipvs_test.go @@ -181,7 +181,7 @@ func TestParseIPPort(t *testing.T) { if err != nil { t.Fatal(err) } - if !(gotIP.Equal(ip) && port == gotPort) { + if !gotIP.Equal(ip) || port != gotPort { t.Errorf("want %s:%d, have %s:%d", ip, port, gotIP, gotPort) } } @@ -211,7 +211,7 @@ func TestParseIPPortIPv6(t *testing.T) { if err != nil { t.Fatal(err) } - if !(gotIP.Equal(ip) && port == gotPort) { + if !gotIP.Equal(ip) || port != gotPort { t.Errorf("want %s:%d, have %s:%d", ip, port, gotIP, gotPort) } } diff --git a/iscsi/get_test.go b/iscsi/get_test.go index 86e34eac..f8ffaca3 100644 --- a/iscsi/get_test.go +++ b/iscsi/get_test.go @@ -159,7 +159,8 @@ func TestGetStats(t *testing.T) { if !reflect.DeepEqual(readTests[i].iops, iops) { t.Errorf("unexpected iSCSI iops data :\nwant:\n%v\nhave:\n%v", readTests[i].iops, iops) } - if stat.Tpgt[0].Luns[0].Backstore == "rd_mcp" { + switch stat.Tpgt[0].Luns[0].Backstore { + case "rd_mcp": haveRdmcp, err := sysconfigfs.GetRDMCPPath("119", "ramdisk_lio_1G") if err != nil { t.Errorf("fail rdmcp error %v", err) @@ -170,7 +171,7 @@ func TestGetStats(t *testing.T) { if !reflect.DeepEqual(wantRdmcp, haveRdmcp) { t.Errorf("unexpected rdmcp data :\nwant:\n%v\nhave:\n%v", wantRdmcp, haveRdmcp) } - } else if stat.Tpgt[0].Luns[0].Backstore == "iblock" { + case "iblock": haveIblock, err := sysconfigfs.GetIblockUdev("0", "block_lio_rbd1") if err != nil { t.Errorf("fail iblock error %v", err) @@ -180,7 +181,7 @@ func TestGetStats(t *testing.T) { if !reflect.DeepEqual(wantIblock, haveIblock) { t.Errorf("unexpected iblock data :\nwant:\n%v\nhave:\n%v", wantIblock, haveIblock) } - } else if stat.Tpgt[0].Luns[0].Backstore == "fileio" { + case "fileio": haveFileIO, err := sysconfigfs.GetFileioUdev("1", "file_lio_1G") if err != nil { t.Errorf("fail fileio error %v", err) @@ -190,7 +191,7 @@ func TestGetStats(t *testing.T) { if !reflect.DeepEqual(wantFileIO, haveFileIO) { t.Errorf("unexpected fileio data :\nwant:\n%v\nhave:\n%v", wantFileIO, haveFileIO) } - } else if stat.Tpgt[0].Luns[0].Backstore == "rbd" { + case "rbd": haveRBD, err := sysconfigfs.GetRBDMatch("0", "iscsi-images-demo") if err != nil { t.Errorf("fail rbd error %v", err) diff --git a/mountstats.go b/mountstats.go index b6c8d1a5..50caa732 100644 --- a/mountstats.go +++ b/mountstats.go @@ -601,11 +601,12 @@ func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats switch statVersion { case statVersion10: var expectedLength int - if protocol == "tcp" { + switch protocol { + case "tcp": expectedLength = fieldTransport10TCPLen - } else if protocol == "udp" { + case "udp": expectedLength = fieldTransport10UDPLen - } else { + default: return nil, fmt.Errorf("%w: Invalid NFS protocol \"%s\" in stats 1.0 statement: %v", ErrFileParse, protocol, ss) } if len(ss) != expectedLength { @@ -613,13 +614,14 @@ func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats } case statVersion11: var expectedLength int - if protocol == "tcp" { + switch protocol { + case "tcp": expectedLength = fieldTransport11TCPLen - } else if protocol == "udp" { + case "udp": expectedLength = fieldTransport11UDPLen - } else if protocol == "rdma" { + case "rdma": expectedLength = fieldTransport11RDMAMinLen - } else { + default: return nil, fmt.Errorf("%w: invalid NFS protocol \"%s\" in stats 1.1 statement: %v", ErrFileParse, protocol, ss) } if (len(ss) != expectedLength && (protocol == "tcp" || protocol == "udp")) || @@ -655,11 +657,12 @@ func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats // For the udp RPC transport there is no connection count, connect idle time, // or idle time (fields #3, #4, and #5); all other fields are the same. So // we set them to 0 here. - if protocol == "udp" { + switch protocol { + case "udp": ns = append(ns[:2], append(make([]uint64, 3), ns[2:]...)...) - } else if protocol == "tcp" { + case "tcp": ns = append(ns[:fieldTransport11TCPLen], make([]uint64, fieldTransport11RDMAMaxLen-fieldTransport11TCPLen+3)...) - } else if protocol == "rdma" { + case "rdma": ns = append(ns[:fieldTransport10TCPLen], append(make([]uint64, 3), ns[fieldTransport10TCPLen:]...)...) } diff --git a/net_protocols.go b/net_protocols.go index b6c77b70..8d4b1ac0 100644 --- a/net_protocols.go +++ b/net_protocols.go @@ -115,22 +115,24 @@ func (ps NetProtocolStats) parseLine(rawLine string) (*NetProtocolStatLine, erro if err != nil { return nil, err } - if fields[4] == enabled { + switch fields[4] { + case enabled: line.Pressure = 1 - } else if fields[4] == disabled { + case disabled: line.Pressure = 0 - } else { + default: line.Pressure = -1 } line.MaxHeader, err = strconv.ParseUint(fields[5], 10, 64) if err != nil { return nil, err } - if fields[6] == enabled { + switch fields[6] { + case enabled: line.Slab = true - } else if fields[6] == disabled { + case disabled: line.Slab = false - } else { + default: return nil, fmt.Errorf("%w: capability for protocol: %s", ErrFileParse, line.Name) } line.ModuleName = fields[7] @@ -168,11 +170,12 @@ func (pc *NetProtocolCapabilities) parseCapabilities(capabilities []string) erro } for i := 0; i < len(capabilities); i++ { - if capabilities[i] == "y" { + switch capabilities[i] { + case "y": *capabilityFields[i] = true - } else if capabilities[i] == "n" { + case "n": *capabilityFields[i] = false - } else { + default: return fmt.Errorf("%w: capability block for protocol: position %d", ErrFileParse, i) } } diff --git a/proc.go b/proc.go index 14279636..368187fa 100644 --- a/proc.go +++ b/proc.go @@ -37,9 +37,9 @@ type Proc struct { type Procs []Proc var ( - ErrFileParse = errors.New("Error Parsing File") - ErrFileRead = errors.New("Error Reading File") - ErrMountPoint = errors.New("Error Accessing Mount point") + ErrFileParse = errors.New("error parsing file") + ErrFileRead = errors.New("error reading file") + ErrMountPoint = errors.New("error accessing mount point") ) func (p Procs) Len() int { return len(p) } @@ -79,7 +79,7 @@ func (fs FS) Self() (Proc, error) { if err != nil { return Proc{}, err } - pid, err := strconv.Atoi(strings.Replace(p, string(fs.proc), "", -1)) + pid, err := strconv.Atoi(strings.ReplaceAll(p, string(fs.proc), "")) if err != nil { return Proc{}, err } diff --git a/proc_netstat.go b/proc_netstat.go index 8e3ff4d7..4248c171 100644 --- a/proc_netstat.go +++ b/proc_netstat.go @@ -209,232 +209,232 @@ func parseProcNetstat(r io.Reader, fileName string) (ProcNetstat, error) { case "TcpExt": switch key { case "SyncookiesSent": - procNetstat.TcpExt.SyncookiesSent = &value + procNetstat.SyncookiesSent = &value case "SyncookiesRecv": - procNetstat.TcpExt.SyncookiesRecv = &value + procNetstat.SyncookiesRecv = &value case "SyncookiesFailed": - procNetstat.TcpExt.SyncookiesFailed = &value + procNetstat.SyncookiesFailed = &value case "EmbryonicRsts": - procNetstat.TcpExt.EmbryonicRsts = &value + procNetstat.EmbryonicRsts = &value case "PruneCalled": - procNetstat.TcpExt.PruneCalled = &value + procNetstat.PruneCalled = &value case "RcvPruned": - procNetstat.TcpExt.RcvPruned = &value + procNetstat.RcvPruned = &value case "OfoPruned": - procNetstat.TcpExt.OfoPruned = &value + procNetstat.OfoPruned = &value case "OutOfWindowIcmps": - procNetstat.TcpExt.OutOfWindowIcmps = &value + procNetstat.OutOfWindowIcmps = &value case "LockDroppedIcmps": - procNetstat.TcpExt.LockDroppedIcmps = &value + procNetstat.LockDroppedIcmps = &value case "ArpFilter": - procNetstat.TcpExt.ArpFilter = &value + procNetstat.ArpFilter = &value case "TW": - procNetstat.TcpExt.TW = &value + procNetstat.TW = &value case "TWRecycled": - procNetstat.TcpExt.TWRecycled = &value + procNetstat.TWRecycled = &value case "TWKilled": - procNetstat.TcpExt.TWKilled = &value + procNetstat.TWKilled = &value case "PAWSActive": - procNetstat.TcpExt.PAWSActive = &value + procNetstat.PAWSActive = &value case "PAWSEstab": - procNetstat.TcpExt.PAWSEstab = &value + procNetstat.PAWSEstab = &value case "DelayedACKs": - procNetstat.TcpExt.DelayedACKs = &value + procNetstat.DelayedACKs = &value case "DelayedACKLocked": - procNetstat.TcpExt.DelayedACKLocked = &value + procNetstat.DelayedACKLocked = &value case "DelayedACKLost": - procNetstat.TcpExt.DelayedACKLost = &value + procNetstat.DelayedACKLost = &value case "ListenOverflows": - procNetstat.TcpExt.ListenOverflows = &value + procNetstat.ListenOverflows = &value case "ListenDrops": - procNetstat.TcpExt.ListenDrops = &value + procNetstat.ListenDrops = &value case "TCPHPHits": - procNetstat.TcpExt.TCPHPHits = &value + procNetstat.TCPHPHits = &value case "TCPPureAcks": - procNetstat.TcpExt.TCPPureAcks = &value + procNetstat.TCPPureAcks = &value case "TCPHPAcks": - procNetstat.TcpExt.TCPHPAcks = &value + procNetstat.TCPHPAcks = &value case "TCPRenoRecovery": - procNetstat.TcpExt.TCPRenoRecovery = &value + procNetstat.TCPRenoRecovery = &value case "TCPSackRecovery": - procNetstat.TcpExt.TCPSackRecovery = &value + procNetstat.TCPSackRecovery = &value case "TCPSACKReneging": - procNetstat.TcpExt.TCPSACKReneging = &value + procNetstat.TCPSACKReneging = &value case "TCPSACKReorder": - procNetstat.TcpExt.TCPSACKReorder = &value + procNetstat.TCPSACKReorder = &value case "TCPRenoReorder": - procNetstat.TcpExt.TCPRenoReorder = &value + procNetstat.TCPRenoReorder = &value case "TCPTSReorder": - procNetstat.TcpExt.TCPTSReorder = &value + procNetstat.TCPTSReorder = &value case "TCPFullUndo": - procNetstat.TcpExt.TCPFullUndo = &value + procNetstat.TCPFullUndo = &value case "TCPPartialUndo": - procNetstat.TcpExt.TCPPartialUndo = &value + procNetstat.TCPPartialUndo = &value case "TCPDSACKUndo": - procNetstat.TcpExt.TCPDSACKUndo = &value + procNetstat.TCPDSACKUndo = &value case "TCPLossUndo": - procNetstat.TcpExt.TCPLossUndo = &value + procNetstat.TCPLossUndo = &value case "TCPLostRetransmit": - procNetstat.TcpExt.TCPLostRetransmit = &value + procNetstat.TCPLostRetransmit = &value case "TCPRenoFailures": - procNetstat.TcpExt.TCPRenoFailures = &value + procNetstat.TCPRenoFailures = &value case "TCPSackFailures": - procNetstat.TcpExt.TCPSackFailures = &value + procNetstat.TCPSackFailures = &value case "TCPLossFailures": - procNetstat.TcpExt.TCPLossFailures = &value + procNetstat.TCPLossFailures = &value case "TCPFastRetrans": - procNetstat.TcpExt.TCPFastRetrans = &value + procNetstat.TCPFastRetrans = &value case "TCPSlowStartRetrans": - procNetstat.TcpExt.TCPSlowStartRetrans = &value + procNetstat.TCPSlowStartRetrans = &value case "TCPTimeouts": - procNetstat.TcpExt.TCPTimeouts = &value + procNetstat.TCPTimeouts = &value case "TCPLossProbes": - procNetstat.TcpExt.TCPLossProbes = &value + procNetstat.TCPLossProbes = &value case "TCPLossProbeRecovery": - procNetstat.TcpExt.TCPLossProbeRecovery = &value + procNetstat.TCPLossProbeRecovery = &value case "TCPRenoRecoveryFail": - procNetstat.TcpExt.TCPRenoRecoveryFail = &value + procNetstat.TCPRenoRecoveryFail = &value case "TCPSackRecoveryFail": - procNetstat.TcpExt.TCPSackRecoveryFail = &value + procNetstat.TCPSackRecoveryFail = &value case "TCPRcvCollapsed": - procNetstat.TcpExt.TCPRcvCollapsed = &value + procNetstat.TCPRcvCollapsed = &value case "TCPDSACKOldSent": - procNetstat.TcpExt.TCPDSACKOldSent = &value + procNetstat.TCPDSACKOldSent = &value case "TCPDSACKOfoSent": - procNetstat.TcpExt.TCPDSACKOfoSent = &value + procNetstat.TCPDSACKOfoSent = &value case "TCPDSACKRecv": - procNetstat.TcpExt.TCPDSACKRecv = &value + procNetstat.TCPDSACKRecv = &value case "TCPDSACKOfoRecv": - procNetstat.TcpExt.TCPDSACKOfoRecv = &value + procNetstat.TCPDSACKOfoRecv = &value case "TCPAbortOnData": - procNetstat.TcpExt.TCPAbortOnData = &value + procNetstat.TCPAbortOnData = &value case "TCPAbortOnClose": - procNetstat.TcpExt.TCPAbortOnClose = &value + procNetstat.TCPAbortOnClose = &value case "TCPDeferAcceptDrop": - procNetstat.TcpExt.TCPDeferAcceptDrop = &value + procNetstat.TCPDeferAcceptDrop = &value case "IPReversePathFilter": - procNetstat.TcpExt.IPReversePathFilter = &value + procNetstat.IPReversePathFilter = &value case "TCPTimeWaitOverflow": - procNetstat.TcpExt.TCPTimeWaitOverflow = &value + procNetstat.TCPTimeWaitOverflow = &value case "TCPReqQFullDoCookies": - procNetstat.TcpExt.TCPReqQFullDoCookies = &value + procNetstat.TCPReqQFullDoCookies = &value case "TCPReqQFullDrop": - procNetstat.TcpExt.TCPReqQFullDrop = &value + procNetstat.TCPReqQFullDrop = &value case "TCPRetransFail": - procNetstat.TcpExt.TCPRetransFail = &value + procNetstat.TCPRetransFail = &value case "TCPRcvCoalesce": - procNetstat.TcpExt.TCPRcvCoalesce = &value + procNetstat.TCPRcvCoalesce = &value case "TCPRcvQDrop": - procNetstat.TcpExt.TCPRcvQDrop = &value + procNetstat.TCPRcvQDrop = &value case "TCPOFOQueue": - procNetstat.TcpExt.TCPOFOQueue = &value + procNetstat.TCPOFOQueue = &value case "TCPOFODrop": - procNetstat.TcpExt.TCPOFODrop = &value + procNetstat.TCPOFODrop = &value case "TCPOFOMerge": - procNetstat.TcpExt.TCPOFOMerge = &value + procNetstat.TCPOFOMerge = &value case "TCPChallengeACK": - procNetstat.TcpExt.TCPChallengeACK = &value + procNetstat.TCPChallengeACK = &value case "TCPSYNChallenge": - procNetstat.TcpExt.TCPSYNChallenge = &value + procNetstat.TCPSYNChallenge = &value case "TCPFastOpenActive": - procNetstat.TcpExt.TCPFastOpenActive = &value + procNetstat.TCPFastOpenActive = &value case "TCPFastOpenActiveFail": - procNetstat.TcpExt.TCPFastOpenActiveFail = &value + procNetstat.TCPFastOpenActiveFail = &value case "TCPFastOpenPassive": - procNetstat.TcpExt.TCPFastOpenPassive = &value + procNetstat.TCPFastOpenPassive = &value case "TCPFastOpenPassiveFail": - procNetstat.TcpExt.TCPFastOpenPassiveFail = &value + procNetstat.TCPFastOpenPassiveFail = &value case "TCPFastOpenListenOverflow": - procNetstat.TcpExt.TCPFastOpenListenOverflow = &value + procNetstat.TCPFastOpenListenOverflow = &value case "TCPFastOpenCookieReqd": - procNetstat.TcpExt.TCPFastOpenCookieReqd = &value + procNetstat.TCPFastOpenCookieReqd = &value case "TCPFastOpenBlackhole": - procNetstat.TcpExt.TCPFastOpenBlackhole = &value + procNetstat.TCPFastOpenBlackhole = &value case "TCPSpuriousRtxHostQueues": - procNetstat.TcpExt.TCPSpuriousRtxHostQueues = &value + procNetstat.TCPSpuriousRtxHostQueues = &value case "BusyPollRxPackets": - procNetstat.TcpExt.BusyPollRxPackets = &value + procNetstat.BusyPollRxPackets = &value case "TCPAutoCorking": - procNetstat.TcpExt.TCPAutoCorking = &value + procNetstat.TCPAutoCorking = &value case "TCPFromZeroWindowAdv": - procNetstat.TcpExt.TCPFromZeroWindowAdv = &value + procNetstat.TCPFromZeroWindowAdv = &value case "TCPToZeroWindowAdv": - procNetstat.TcpExt.TCPToZeroWindowAdv = &value + procNetstat.TCPToZeroWindowAdv = &value case "TCPWantZeroWindowAdv": - procNetstat.TcpExt.TCPWantZeroWindowAdv = &value + procNetstat.TCPWantZeroWindowAdv = &value case "TCPSynRetrans": - procNetstat.TcpExt.TCPSynRetrans = &value + procNetstat.TCPSynRetrans = &value case "TCPOrigDataSent": - procNetstat.TcpExt.TCPOrigDataSent = &value + procNetstat.TCPOrigDataSent = &value case "TCPHystartTrainDetect": - procNetstat.TcpExt.TCPHystartTrainDetect = &value + procNetstat.TCPHystartTrainDetect = &value case "TCPHystartTrainCwnd": - procNetstat.TcpExt.TCPHystartTrainCwnd = &value + procNetstat.TCPHystartTrainCwnd = &value case "TCPHystartDelayDetect": - procNetstat.TcpExt.TCPHystartDelayDetect = &value + procNetstat.TCPHystartDelayDetect = &value case "TCPHystartDelayCwnd": - procNetstat.TcpExt.TCPHystartDelayCwnd = &value + procNetstat.TCPHystartDelayCwnd = &value case "TCPACKSkippedSynRecv": - procNetstat.TcpExt.TCPACKSkippedSynRecv = &value + procNetstat.TCPACKSkippedSynRecv = &value case "TCPACKSkippedPAWS": - procNetstat.TcpExt.TCPACKSkippedPAWS = &value + procNetstat.TCPACKSkippedPAWS = &value case "TCPACKSkippedSeq": - procNetstat.TcpExt.TCPACKSkippedSeq = &value + procNetstat.TCPACKSkippedSeq = &value case "TCPACKSkippedFinWait2": - procNetstat.TcpExt.TCPACKSkippedFinWait2 = &value + procNetstat.TCPACKSkippedFinWait2 = &value case "TCPACKSkippedTimeWait": - procNetstat.TcpExt.TCPACKSkippedTimeWait = &value + procNetstat.TCPACKSkippedTimeWait = &value case "TCPACKSkippedChallenge": - procNetstat.TcpExt.TCPACKSkippedChallenge = &value + procNetstat.TCPACKSkippedChallenge = &value case "TCPWinProbe": - procNetstat.TcpExt.TCPWinProbe = &value + procNetstat.TCPWinProbe = &value case "TCPKeepAlive": - procNetstat.TcpExt.TCPKeepAlive = &value + procNetstat.TCPKeepAlive = &value case "TCPMTUPFail": - procNetstat.TcpExt.TCPMTUPFail = &value + procNetstat.TCPMTUPFail = &value case "TCPMTUPSuccess": - procNetstat.TcpExt.TCPMTUPSuccess = &value + procNetstat.TCPMTUPSuccess = &value case "TCPWqueueTooBig": - procNetstat.TcpExt.TCPWqueueTooBig = &value + procNetstat.TCPWqueueTooBig = &value } case "IpExt": switch key { case "InNoRoutes": - procNetstat.IpExt.InNoRoutes = &value + procNetstat.InNoRoutes = &value case "InTruncatedPkts": - procNetstat.IpExt.InTruncatedPkts = &value + procNetstat.InTruncatedPkts = &value case "InMcastPkts": - procNetstat.IpExt.InMcastPkts = &value + procNetstat.InMcastPkts = &value case "OutMcastPkts": - procNetstat.IpExt.OutMcastPkts = &value + procNetstat.OutMcastPkts = &value case "InBcastPkts": - procNetstat.IpExt.InBcastPkts = &value + procNetstat.InBcastPkts = &value case "OutBcastPkts": - procNetstat.IpExt.OutBcastPkts = &value + procNetstat.OutBcastPkts = &value case "InOctets": - procNetstat.IpExt.InOctets = &value + procNetstat.InOctets = &value case "OutOctets": - procNetstat.IpExt.OutOctets = &value + procNetstat.OutOctets = &value case "InMcastOctets": - procNetstat.IpExt.InMcastOctets = &value + procNetstat.InMcastOctets = &value case "OutMcastOctets": - procNetstat.IpExt.OutMcastOctets = &value + procNetstat.OutMcastOctets = &value case "InBcastOctets": - procNetstat.IpExt.InBcastOctets = &value + procNetstat.InBcastOctets = &value case "OutBcastOctets": - procNetstat.IpExt.OutBcastOctets = &value + procNetstat.OutBcastOctets = &value case "InCsumErrors": - procNetstat.IpExt.InCsumErrors = &value + procNetstat.InCsumErrors = &value case "InNoECTPkts": - procNetstat.IpExt.InNoECTPkts = &value + procNetstat.InNoECTPkts = &value case "InECT1Pkts": - procNetstat.IpExt.InECT1Pkts = &value + procNetstat.InECT1Pkts = &value case "InECT0Pkts": - procNetstat.IpExt.InECT0Pkts = &value + procNetstat.InECT0Pkts = &value case "InCEPkts": - procNetstat.IpExt.InCEPkts = &value + procNetstat.InCEPkts = &value case "ReasmOverlaps": - procNetstat.IpExt.ReasmOverlaps = &value + procNetstat.ReasmOverlaps = &value } } } diff --git a/proc_netstat_test.go b/proc_netstat_test.go index a1d20a9a..2b9c7668 100644 --- a/proc_netstat_test.go +++ b/proc_netstat_test.go @@ -34,14 +34,14 @@ func TestProcNetstat(t *testing.T) { have float64 }{ {name: "pid", want: 26231, have: float64(procNetstat.PID)}, - {name: "TcpExt:SyncookiesSent", want: 0, have: *procNetstat.TcpExt.SyncookiesSent}, - {name: "TcpExt:EmbryonicRsts", want: 1, have: *procNetstat.TcpExt.EmbryonicRsts}, - {name: "TcpExt:TW", want: 83, have: *procNetstat.TcpExt.TW}, - {name: "TcpExt:PAWSEstab", want: 3640, have: *procNetstat.TcpExt.PAWSEstab}, + {name: "TcpExt:SyncookiesSent", want: 0, have: *procNetstat.SyncookiesSent}, + {name: "TcpExt:EmbryonicRsts", want: 1, have: *procNetstat.EmbryonicRsts}, + {name: "TcpExt:TW", want: 83, have: *procNetstat.TW}, + {name: "TcpExt:PAWSEstab", want: 3640, have: *procNetstat.PAWSEstab}, - {name: "IpExt:InNoRoutes", want: 0, have: *procNetstat.IpExt.InNoRoutes}, - {name: "IpExt:InMcastPkts", want: 208, have: *procNetstat.IpExt.InMcastPkts}, - {name: "IpExt:OutMcastPkts", want: 214, have: *procNetstat.IpExt.OutMcastPkts}, + {name: "IpExt:InNoRoutes", want: 0, have: *procNetstat.InNoRoutes}, + {name: "IpExt:InMcastPkts", want: 208, have: *procNetstat.InMcastPkts}, + {name: "IpExt:OutMcastPkts", want: 214, have: *procNetstat.OutMcastPkts}, } { if test.want != test.have { t.Errorf("want %s %f, have %f", test.name, test.want, test.have) diff --git a/proc_snmp.go b/proc_snmp.go index b9d2cf64..4bdc90b0 100644 --- a/proc_snmp.go +++ b/proc_snmp.go @@ -173,138 +173,138 @@ func parseSnmp(r io.Reader, fileName string) (ProcSnmp, error) { case "Ip": switch key { case "Forwarding": - procSnmp.Ip.Forwarding = &value + procSnmp.Forwarding = &value case "DefaultTTL": - procSnmp.Ip.DefaultTTL = &value + procSnmp.DefaultTTL = &value case "InReceives": - procSnmp.Ip.InReceives = &value + procSnmp.InReceives = &value case "InHdrErrors": - procSnmp.Ip.InHdrErrors = &value + procSnmp.InHdrErrors = &value case "InAddrErrors": - procSnmp.Ip.InAddrErrors = &value + procSnmp.InAddrErrors = &value case "ForwDatagrams": - procSnmp.Ip.ForwDatagrams = &value + procSnmp.ForwDatagrams = &value case "InUnknownProtos": - procSnmp.Ip.InUnknownProtos = &value + procSnmp.InUnknownProtos = &value case "InDiscards": - procSnmp.Ip.InDiscards = &value + procSnmp.InDiscards = &value case "InDelivers": - procSnmp.Ip.InDelivers = &value + procSnmp.InDelivers = &value case "OutRequests": - procSnmp.Ip.OutRequests = &value + procSnmp.OutRequests = &value case "OutDiscards": - procSnmp.Ip.OutDiscards = &value + procSnmp.OutDiscards = &value case "OutNoRoutes": - procSnmp.Ip.OutNoRoutes = &value + procSnmp.OutNoRoutes = &value case "ReasmTimeout": - procSnmp.Ip.ReasmTimeout = &value + procSnmp.ReasmTimeout = &value case "ReasmReqds": - procSnmp.Ip.ReasmReqds = &value + procSnmp.ReasmReqds = &value case "ReasmOKs": - procSnmp.Ip.ReasmOKs = &value + procSnmp.ReasmOKs = &value case "ReasmFails": - procSnmp.Ip.ReasmFails = &value + procSnmp.ReasmFails = &value case "FragOKs": - procSnmp.Ip.FragOKs = &value + procSnmp.FragOKs = &value case "FragFails": - procSnmp.Ip.FragFails = &value + procSnmp.FragFails = &value case "FragCreates": - procSnmp.Ip.FragCreates = &value + procSnmp.FragCreates = &value } case "Icmp": switch key { case "InMsgs": - procSnmp.Icmp.InMsgs = &value + procSnmp.InMsgs = &value case "InErrors": procSnmp.Icmp.InErrors = &value case "InCsumErrors": procSnmp.Icmp.InCsumErrors = &value case "InDestUnreachs": - procSnmp.Icmp.InDestUnreachs = &value + procSnmp.InDestUnreachs = &value case "InTimeExcds": - procSnmp.Icmp.InTimeExcds = &value + procSnmp.InTimeExcds = &value case "InParmProbs": - procSnmp.Icmp.InParmProbs = &value + procSnmp.InParmProbs = &value case "InSrcQuenchs": - procSnmp.Icmp.InSrcQuenchs = &value + procSnmp.InSrcQuenchs = &value case "InRedirects": - procSnmp.Icmp.InRedirects = &value + procSnmp.InRedirects = &value case "InEchos": - procSnmp.Icmp.InEchos = &value + procSnmp.InEchos = &value case "InEchoReps": - procSnmp.Icmp.InEchoReps = &value + procSnmp.InEchoReps = &value case "InTimestamps": - procSnmp.Icmp.InTimestamps = &value + procSnmp.InTimestamps = &value case "InTimestampReps": - procSnmp.Icmp.InTimestampReps = &value + procSnmp.InTimestampReps = &value case "InAddrMasks": - procSnmp.Icmp.InAddrMasks = &value + procSnmp.InAddrMasks = &value case "InAddrMaskReps": - procSnmp.Icmp.InAddrMaskReps = &value + procSnmp.InAddrMaskReps = &value case "OutMsgs": - procSnmp.Icmp.OutMsgs = &value + procSnmp.OutMsgs = &value case "OutErrors": - procSnmp.Icmp.OutErrors = &value + procSnmp.OutErrors = &value case "OutDestUnreachs": - procSnmp.Icmp.OutDestUnreachs = &value + procSnmp.OutDestUnreachs = &value case "OutTimeExcds": - procSnmp.Icmp.OutTimeExcds = &value + procSnmp.OutTimeExcds = &value case "OutParmProbs": - procSnmp.Icmp.OutParmProbs = &value + procSnmp.OutParmProbs = &value case "OutSrcQuenchs": - procSnmp.Icmp.OutSrcQuenchs = &value + procSnmp.OutSrcQuenchs = &value case "OutRedirects": - procSnmp.Icmp.OutRedirects = &value + procSnmp.OutRedirects = &value case "OutEchos": - procSnmp.Icmp.OutEchos = &value + procSnmp.OutEchos = &value case "OutEchoReps": - procSnmp.Icmp.OutEchoReps = &value + procSnmp.OutEchoReps = &value case "OutTimestamps": - procSnmp.Icmp.OutTimestamps = &value + procSnmp.OutTimestamps = &value case "OutTimestampReps": - procSnmp.Icmp.OutTimestampReps = &value + procSnmp.OutTimestampReps = &value case "OutAddrMasks": - procSnmp.Icmp.OutAddrMasks = &value + procSnmp.OutAddrMasks = &value case "OutAddrMaskReps": - procSnmp.Icmp.OutAddrMaskReps = &value + procSnmp.OutAddrMaskReps = &value } case "IcmpMsg": switch key { case "InType3": - procSnmp.IcmpMsg.InType3 = &value + procSnmp.InType3 = &value case "OutType3": - procSnmp.IcmpMsg.OutType3 = &value + procSnmp.OutType3 = &value } case "Tcp": switch key { case "RtoAlgorithm": - procSnmp.Tcp.RtoAlgorithm = &value + procSnmp.RtoAlgorithm = &value case "RtoMin": - procSnmp.Tcp.RtoMin = &value + procSnmp.RtoMin = &value case "RtoMax": - procSnmp.Tcp.RtoMax = &value + procSnmp.RtoMax = &value case "MaxConn": - procSnmp.Tcp.MaxConn = &value + procSnmp.MaxConn = &value case "ActiveOpens": - procSnmp.Tcp.ActiveOpens = &value + procSnmp.ActiveOpens = &value case "PassiveOpens": - procSnmp.Tcp.PassiveOpens = &value + procSnmp.PassiveOpens = &value case "AttemptFails": - procSnmp.Tcp.AttemptFails = &value + procSnmp.AttemptFails = &value case "EstabResets": - procSnmp.Tcp.EstabResets = &value + procSnmp.EstabResets = &value case "CurrEstab": - procSnmp.Tcp.CurrEstab = &value + procSnmp.CurrEstab = &value case "InSegs": - procSnmp.Tcp.InSegs = &value + procSnmp.InSegs = &value case "OutSegs": - procSnmp.Tcp.OutSegs = &value + procSnmp.OutSegs = &value case "RetransSegs": - procSnmp.Tcp.RetransSegs = &value + procSnmp.RetransSegs = &value case "InErrs": - procSnmp.Tcp.InErrs = &value + procSnmp.InErrs = &value case "OutRsts": - procSnmp.Tcp.OutRsts = &value + procSnmp.OutRsts = &value case "InCsumErrors": procSnmp.Tcp.InCsumErrors = &value } diff --git a/proc_snmp6.go b/proc_snmp6.go index 3059cc6a..fb7fd399 100644 --- a/proc_snmp6.go +++ b/proc_snmp6.go @@ -182,161 +182,161 @@ func parseSNMP6Stats(r io.Reader) (ProcSnmp6, error) { case "Ip6": switch key { case "InReceives": - procSnmp6.Ip6.InReceives = &value + procSnmp6.InReceives = &value case "InHdrErrors": - procSnmp6.Ip6.InHdrErrors = &value + procSnmp6.InHdrErrors = &value case "InTooBigErrors": - procSnmp6.Ip6.InTooBigErrors = &value + procSnmp6.InTooBigErrors = &value case "InNoRoutes": - procSnmp6.Ip6.InNoRoutes = &value + procSnmp6.InNoRoutes = &value case "InAddrErrors": - procSnmp6.Ip6.InAddrErrors = &value + procSnmp6.InAddrErrors = &value case "InUnknownProtos": - procSnmp6.Ip6.InUnknownProtos = &value + procSnmp6.InUnknownProtos = &value case "InTruncatedPkts": - procSnmp6.Ip6.InTruncatedPkts = &value + procSnmp6.InTruncatedPkts = &value case "InDiscards": - procSnmp6.Ip6.InDiscards = &value + procSnmp6.InDiscards = &value case "InDelivers": - procSnmp6.Ip6.InDelivers = &value + procSnmp6.InDelivers = &value case "OutForwDatagrams": - procSnmp6.Ip6.OutForwDatagrams = &value + procSnmp6.OutForwDatagrams = &value case "OutRequests": - procSnmp6.Ip6.OutRequests = &value + procSnmp6.OutRequests = &value case "OutDiscards": - procSnmp6.Ip6.OutDiscards = &value + procSnmp6.OutDiscards = &value case "OutNoRoutes": - procSnmp6.Ip6.OutNoRoutes = &value + procSnmp6.OutNoRoutes = &value case "ReasmTimeout": - procSnmp6.Ip6.ReasmTimeout = &value + procSnmp6.ReasmTimeout = &value case "ReasmReqds": - procSnmp6.Ip6.ReasmReqds = &value + procSnmp6.ReasmReqds = &value case "ReasmOKs": - procSnmp6.Ip6.ReasmOKs = &value + procSnmp6.ReasmOKs = &value case "ReasmFails": - procSnmp6.Ip6.ReasmFails = &value + procSnmp6.ReasmFails = &value case "FragOKs": - procSnmp6.Ip6.FragOKs = &value + procSnmp6.FragOKs = &value case "FragFails": - procSnmp6.Ip6.FragFails = &value + procSnmp6.FragFails = &value case "FragCreates": - procSnmp6.Ip6.FragCreates = &value + procSnmp6.FragCreates = &value case "InMcastPkts": - procSnmp6.Ip6.InMcastPkts = &value + procSnmp6.InMcastPkts = &value case "OutMcastPkts": - procSnmp6.Ip6.OutMcastPkts = &value + procSnmp6.OutMcastPkts = &value case "InOctets": - procSnmp6.Ip6.InOctets = &value + procSnmp6.InOctets = &value case "OutOctets": - procSnmp6.Ip6.OutOctets = &value + procSnmp6.OutOctets = &value case "InMcastOctets": - procSnmp6.Ip6.InMcastOctets = &value + procSnmp6.InMcastOctets = &value case "OutMcastOctets": - procSnmp6.Ip6.OutMcastOctets = &value + procSnmp6.OutMcastOctets = &value case "InBcastOctets": - procSnmp6.Ip6.InBcastOctets = &value + procSnmp6.InBcastOctets = &value case "OutBcastOctets": - procSnmp6.Ip6.OutBcastOctets = &value + procSnmp6.OutBcastOctets = &value case "InNoECTPkts": - procSnmp6.Ip6.InNoECTPkts = &value + procSnmp6.InNoECTPkts = &value case "InECT1Pkts": - procSnmp6.Ip6.InECT1Pkts = &value + procSnmp6.InECT1Pkts = &value case "InECT0Pkts": - procSnmp6.Ip6.InECT0Pkts = &value + procSnmp6.InECT0Pkts = &value case "InCEPkts": - procSnmp6.Ip6.InCEPkts = &value + procSnmp6.InCEPkts = &value } case "Icmp6": switch key { case "InMsgs": - procSnmp6.Icmp6.InMsgs = &value + procSnmp6.InMsgs = &value case "InErrors": procSnmp6.Icmp6.InErrors = &value case "OutMsgs": - procSnmp6.Icmp6.OutMsgs = &value + procSnmp6.OutMsgs = &value case "OutErrors": - procSnmp6.Icmp6.OutErrors = &value + procSnmp6.OutErrors = &value case "InCsumErrors": procSnmp6.Icmp6.InCsumErrors = &value case "InDestUnreachs": - procSnmp6.Icmp6.InDestUnreachs = &value + procSnmp6.InDestUnreachs = &value case "InPktTooBigs": - procSnmp6.Icmp6.InPktTooBigs = &value + procSnmp6.InPktTooBigs = &value case "InTimeExcds": - procSnmp6.Icmp6.InTimeExcds = &value + procSnmp6.InTimeExcds = &value case "InParmProblems": - procSnmp6.Icmp6.InParmProblems = &value + procSnmp6.InParmProblems = &value case "InEchos": - procSnmp6.Icmp6.InEchos = &value + procSnmp6.InEchos = &value case "InEchoReplies": - procSnmp6.Icmp6.InEchoReplies = &value + procSnmp6.InEchoReplies = &value case "InGroupMembQueries": - procSnmp6.Icmp6.InGroupMembQueries = &value + procSnmp6.InGroupMembQueries = &value case "InGroupMembResponses": - procSnmp6.Icmp6.InGroupMembResponses = &value + procSnmp6.InGroupMembResponses = &value case "InGroupMembReductions": - procSnmp6.Icmp6.InGroupMembReductions = &value + procSnmp6.InGroupMembReductions = &value case "InRouterSolicits": - procSnmp6.Icmp6.InRouterSolicits = &value + procSnmp6.InRouterSolicits = &value case "InRouterAdvertisements": - procSnmp6.Icmp6.InRouterAdvertisements = &value + procSnmp6.InRouterAdvertisements = &value case "InNeighborSolicits": - procSnmp6.Icmp6.InNeighborSolicits = &value + procSnmp6.InNeighborSolicits = &value case "InNeighborAdvertisements": - procSnmp6.Icmp6.InNeighborAdvertisements = &value + procSnmp6.InNeighborAdvertisements = &value case "InRedirects": - procSnmp6.Icmp6.InRedirects = &value + procSnmp6.InRedirects = &value case "InMLDv2Reports": - procSnmp6.Icmp6.InMLDv2Reports = &value + procSnmp6.InMLDv2Reports = &value case "OutDestUnreachs": - procSnmp6.Icmp6.OutDestUnreachs = &value + procSnmp6.OutDestUnreachs = &value case "OutPktTooBigs": - procSnmp6.Icmp6.OutPktTooBigs = &value + procSnmp6.OutPktTooBigs = &value case "OutTimeExcds": - procSnmp6.Icmp6.OutTimeExcds = &value + procSnmp6.OutTimeExcds = &value case "OutParmProblems": - procSnmp6.Icmp6.OutParmProblems = &value + procSnmp6.OutParmProblems = &value case "OutEchos": - procSnmp6.Icmp6.OutEchos = &value + procSnmp6.OutEchos = &value case "OutEchoReplies": - procSnmp6.Icmp6.OutEchoReplies = &value + procSnmp6.OutEchoReplies = &value case "OutGroupMembQueries": - procSnmp6.Icmp6.OutGroupMembQueries = &value + procSnmp6.OutGroupMembQueries = &value case "OutGroupMembResponses": - procSnmp6.Icmp6.OutGroupMembResponses = &value + procSnmp6.OutGroupMembResponses = &value case "OutGroupMembReductions": - procSnmp6.Icmp6.OutGroupMembReductions = &value + procSnmp6.OutGroupMembReductions = &value case "OutRouterSolicits": - procSnmp6.Icmp6.OutRouterSolicits = &value + procSnmp6.OutRouterSolicits = &value case "OutRouterAdvertisements": - procSnmp6.Icmp6.OutRouterAdvertisements = &value + procSnmp6.OutRouterAdvertisements = &value case "OutNeighborSolicits": - procSnmp6.Icmp6.OutNeighborSolicits = &value + procSnmp6.OutNeighborSolicits = &value case "OutNeighborAdvertisements": - procSnmp6.Icmp6.OutNeighborAdvertisements = &value + procSnmp6.OutNeighborAdvertisements = &value case "OutRedirects": - procSnmp6.Icmp6.OutRedirects = &value + procSnmp6.OutRedirects = &value case "OutMLDv2Reports": - procSnmp6.Icmp6.OutMLDv2Reports = &value + procSnmp6.OutMLDv2Reports = &value case "InType1": - procSnmp6.Icmp6.InType1 = &value + procSnmp6.InType1 = &value case "InType134": - procSnmp6.Icmp6.InType134 = &value + procSnmp6.InType134 = &value case "InType135": - procSnmp6.Icmp6.InType135 = &value + procSnmp6.InType135 = &value case "InType136": - procSnmp6.Icmp6.InType136 = &value + procSnmp6.InType136 = &value case "InType143": - procSnmp6.Icmp6.InType143 = &value + procSnmp6.InType143 = &value case "OutType133": - procSnmp6.Icmp6.OutType133 = &value + procSnmp6.OutType133 = &value case "OutType135": - procSnmp6.Icmp6.OutType135 = &value + procSnmp6.OutType135 = &value case "OutType136": - procSnmp6.Icmp6.OutType136 = &value + procSnmp6.OutType136 = &value case "OutType143": - procSnmp6.Icmp6.OutType143 = &value + procSnmp6.OutType143 = &value } case "Udp6": switch key { @@ -355,7 +355,7 @@ func parseSNMP6Stats(r io.Reader) (ProcSnmp6, error) { case "InCsumErrors": procSnmp6.Udp6.InCsumErrors = &value case "IgnoredMulti": - procSnmp6.Udp6.IgnoredMulti = &value + procSnmp6.IgnoredMulti = &value } case "UdpLite6": switch key { diff --git a/proc_snmp6_test.go b/proc_snmp6_test.go index 4850c8c3..e69442d3 100644 --- a/proc_snmp6_test.go +++ b/proc_snmp6_test.go @@ -32,11 +32,11 @@ func TestProcSnmp6(t *testing.T) { have float64 }{ {name: "pid", want: 26231, have: float64(procSnmp6.PID)}, - {name: "Ip6InReceives", want: 92166, have: *procSnmp6.Ip6.InReceives}, - {name: "Ip6InDelivers", want: 92053, have: *procSnmp6.Ip6.InDelivers}, - {name: "Ip6OutNoRoutes", want: 169, have: *procSnmp6.Ip6.OutNoRoutes}, - {name: "Ip6InOctets", want: 113479132, have: *procSnmp6.Ip6.InOctets}, - {name: "Icmp6InMsgs", want: 142, have: *procSnmp6.Icmp6.InMsgs}, + {name: "Ip6InReceives", want: 92166, have: *procSnmp6.InReceives}, + {name: "Ip6InDelivers", want: 92053, have: *procSnmp6.InDelivers}, + {name: "Ip6OutNoRoutes", want: 169, have: *procSnmp6.OutNoRoutes}, + {name: "Ip6InOctets", want: 113479132, have: *procSnmp6.InOctets}, + {name: "Icmp6InMsgs", want: 142, have: *procSnmp6.InMsgs}, {name: "Udp6InDatagrams", want: 2016, have: *procSnmp6.Udp6.InDatagrams}, {name: "UdpLite6InDatagrams", want: 0, have: *procSnmp6.UdpLite6.InDatagrams}, } { diff --git a/proc_snmp_test.go b/proc_snmp_test.go index 8268b433..e256dfb0 100644 --- a/proc_snmp_test.go +++ b/proc_snmp_test.go @@ -32,13 +32,13 @@ func TestProcSnmp(t *testing.T) { have float64 }{ {name: "pid", want: 26231, have: float64(procSnmp.PID)}, - {name: "IP:Forwarding", want: 2, have: *procSnmp.Ip.Forwarding}, - {name: "IP:DefaultTTL", want: 64, have: *procSnmp.Ip.DefaultTTL}, - {name: "Icmp:InMsgs", want: 45, have: *procSnmp.Icmp.InMsgs}, - {name: "IcmpMsg:InType3", want: 45, have: *procSnmp.IcmpMsg.InType3}, - {name: "IcmpMsg:OutType3", want: 50, have: *procSnmp.IcmpMsg.OutType3}, - {name: "TCP:RtoAlgorithm", want: 1, have: *procSnmp.Tcp.RtoAlgorithm}, - {name: "TCP:RtoMin", want: 200, have: *procSnmp.Tcp.RtoMin}, + {name: "IP:Forwarding", want: 2, have: *procSnmp.Forwarding}, + {name: "IP:DefaultTTL", want: 64, have: *procSnmp.DefaultTTL}, + {name: "Icmp:InMsgs", want: 45, have: *procSnmp.InMsgs}, + {name: "IcmpMsg:InType3", want: 45, have: *procSnmp.InType3}, + {name: "IcmpMsg:OutType3", want: 50, have: *procSnmp.OutType3}, + {name: "TCP:RtoAlgorithm", want: 1, have: *procSnmp.RtoAlgorithm}, + {name: "TCP:RtoMin", want: 200, have: *procSnmp.RtoMin}, {name: "Udp:InDatagrams", want: 10179, have: *procSnmp.Udp.InDatagrams}, {name: "Udp:NoPorts", want: 50, have: *procSnmp.Udp.NoPorts}, {name: "UdpLite:InDatagrams", want: 0, have: *procSnmp.UdpLite.NoPorts}, diff --git a/proc_sys.go b/proc_sys.go index 5eefbe2e..3810d1ac 100644 --- a/proc_sys.go +++ b/proc_sys.go @@ -21,7 +21,7 @@ import ( ) func sysctlToPath(sysctl string) string { - return strings.Replace(sysctl, ".", "/", -1) + return strings.ReplaceAll(sysctl, ".", "/") } func (fs FS) SysctlStrings(sysctl string) ([]string, error) { diff --git a/proc_sys_test.go b/proc_sys_test.go index 60593903..972c1551 100644 --- a/proc_sys_test.go +++ b/proc_sys_test.go @@ -69,7 +69,7 @@ func TestSysctlIntsError(t *testing.T) { sysctl string want string }{ - {"kernel.seccomp.actions_avail", "Error Parsing File: field 0 in sysctl kernel.seccomp.actions_avail is not a valid int: strconv.ParseInt: parsing \"kill_process\": invalid syntax"}, + {"kernel.seccomp.actions_avail", "error parsing file: field 0 in sysctl kernel.seccomp.actions_avail is not a valid int: strconv.ParseInt: parsing \"kill_process\": invalid syntax"}, } { t.Run(tc.sysctl, func(t *testing.T) { _, err := fs.SysctlInts(tc.sysctl) diff --git a/softirqs.go b/softirqs.go index 28708e07..403e6ae7 100644 --- a/softirqs.go +++ b/softirqs.go @@ -68,8 +68,8 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { if len(parts) < 2 { continue } - switch { - case parts[0] == "HI:": + switch parts[0] { + case "HI:": perCPU := parts[1:] softirqs.Hi = make([]uint64, len(perCPU)) for i, count := range perCPU { @@ -77,7 +77,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (HI%d): %w", ErrFileParse, count, i, err) } } - case parts[0] == "TIMER:": + case "TIMER:": perCPU := parts[1:] softirqs.Timer = make([]uint64, len(perCPU)) for i, count := range perCPU { @@ -85,7 +85,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (TIMER%d): %w", ErrFileParse, count, i, err) } } - case parts[0] == "NET_TX:": + case "NET_TX:": perCPU := parts[1:] softirqs.NetTx = make([]uint64, len(perCPU)) for i, count := range perCPU { @@ -93,7 +93,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (NET_TX%d): %w", ErrFileParse, count, i, err) } } - case parts[0] == "NET_RX:": + case "NET_RX:": perCPU := parts[1:] softirqs.NetRx = make([]uint64, len(perCPU)) for i, count := range perCPU { @@ -101,7 +101,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (NET_RX%d): %w", ErrFileParse, count, i, err) } } - case parts[0] == "BLOCK:": + case "BLOCK:": perCPU := parts[1:] softirqs.Block = make([]uint64, len(perCPU)) for i, count := range perCPU { @@ -109,7 +109,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (BLOCK%d): %w", ErrFileParse, count, i, err) } } - case parts[0] == "IRQ_POLL:": + case "IRQ_POLL:": perCPU := parts[1:] softirqs.IRQPoll = make([]uint64, len(perCPU)) for i, count := range perCPU { @@ -117,7 +117,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (IRQ_POLL%d): %w", ErrFileParse, count, i, err) } } - case parts[0] == "TASKLET:": + case "TASKLET:": perCPU := parts[1:] softirqs.Tasklet = make([]uint64, len(perCPU)) for i, count := range perCPU { @@ -125,7 +125,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (TASKLET%d): %w", ErrFileParse, count, i, err) } } - case parts[0] == "SCHED:": + case "SCHED:": perCPU := parts[1:] softirqs.Sched = make([]uint64, len(perCPU)) for i, count := range perCPU { @@ -133,7 +133,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (SCHED%d): %w", ErrFileParse, count, i, err) } } - case parts[0] == "HRTIMER:": + case "HRTIMER:": perCPU := parts[1:] softirqs.HRTimer = make([]uint64, len(perCPU)) for i, count := range perCPU { @@ -141,7 +141,7 @@ func parseSoftirqs(r io.Reader) (Softirqs, error) { return Softirqs{}, fmt.Errorf("%w: couldn't parse %q (HRTIMER%d): %w", ErrFileParse, count, i, err) } } - case parts[0] == "RCU:": + case "RCU:": perCPU := parts[1:] softirqs.RCU = make([]uint64, len(perCPU)) for i, count := range perCPU { diff --git a/sysfs/system_cpu.go b/sysfs/system_cpu.go index a68c6d9a..a4b2c9ea 100644 --- a/sysfs/system_cpu.go +++ b/sysfs/system_cpu.go @@ -310,7 +310,7 @@ func parseCpufreqCpuinfo(cpuPath string) (*SystemCPUCpufreqStats, error) { var cpuinfoFrequencyTransitionsTotal *uint64 cpuinfoFrequencyTransitionsTotalUint, err := util.ReadUintFromFile(filepath.Join(cpuPath, "stats", "total_trans")) if err != nil { - if !(os.IsNotExist(err) || os.IsPermission(err)) { + if !os.IsNotExist(err) && !os.IsPermission(err) { return &SystemCPUCpufreqStats{}, err } } else { @@ -321,7 +321,7 @@ func parseCpufreqCpuinfo(cpuPath string) (*SystemCPUCpufreqStats, error) { var cpuinfoFrequencyDuration *map[uint64]uint64 cpuinfoFrequencyDurationString, err := util.ReadFileNoStat(filepath.Join(cpuPath, "stats", "time_in_state")) if err != nil { - if !(os.IsNotExist(err) || os.IsPermission(err)) { + if !os.IsNotExist(err) && !os.IsPermission(err) { return &SystemCPUCpufreqStats{}, err } } else { @@ -350,7 +350,7 @@ func parseCpufreqCpuinfo(cpuPath string) (*SystemCPUCpufreqStats, error) { var cpuinfoTransitionTable *[][]uint64 cpuinfoTransitionTableString, err := util.ReadFileNoStat(filepath.Join(cpuPath, "stats", "trans_table")) if err != nil { - if !(os.IsNotExist(err) || os.IsPermission(err)) { + if !os.IsNotExist(err) && !os.IsPermission(err) { return &SystemCPUCpufreqStats{}, err } } else { From f61a33056e656b77cec15243f20831292fa81ed9 Mon Sep 17 00:00:00 2001 From: Sean Swehla Date: Sat, 19 Apr 2025 11:34:53 -0400 Subject: [PATCH 33/69] Use SysReadFile for thermals and skip failed zones (#712) Switches all calls in the thermal zones processing to use SysReadFile so that unavailable zones won't stall forever waiting for them to become available. Also continues processing in the case that one zone fails with EAGAIN, as is the case for temporarily unavailable zones. Addresses #698 Signed-off-by: Sean Swehla --- internal/util/sysreadfile.go | 20 ++++++++++++++++++++ sysfs/class_thermal.go | 6 +++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/internal/util/sysreadfile.go b/internal/util/sysreadfile.go index 1ab875ce..d5404a6d 100644 --- a/internal/util/sysreadfile.go +++ b/internal/util/sysreadfile.go @@ -20,6 +20,8 @@ package util import ( "bytes" "os" + "strconv" + "strings" "syscall" ) @@ -48,3 +50,21 @@ func SysReadFile(file string) (string, error) { return string(bytes.TrimSpace(b[:n])), nil } + +// SysReadUintFromFile reads a file using SysReadFile and attempts to parse a uint64 from it. +func SysReadUintFromFile(path string) (uint64, error) { + data, err := SysReadFile(path) + if err != nil { + return 0, err + } + return strconv.ParseUint(strings.TrimSpace(string(data)), 10, 64) +} + +// SysReadIntFromFile reads a file using SysReadFile and attempts to parse a int64 from it. +func SysReadIntFromFile(path string) (int64, error) { + data, err := SysReadFile(path) + if err != nil { + return 0, err + } + return strconv.ParseInt(strings.TrimSpace(string(data)), 10, 64) +} diff --git a/sysfs/class_thermal.go b/sysfs/class_thermal.go index 10f4a9a7..19706c0b 100644 --- a/sysfs/class_thermal.go +++ b/sysfs/class_thermal.go @@ -51,7 +51,7 @@ func (fs FS) ClassThermalZoneStats() ([]ClassThermalZoneStats, error) { for _, zone := range zones { zoneStats, err := parseClassThermalZone(zone) if err != nil { - if errors.Is(err, syscall.ENODATA) || errors.As(err, new(*fsp.PathError)) { + if errors.Is(err, syscall.ENODATA) || errors.As(err, new(*fsp.PathError)) || errors.Is(err, syscall.EAGAIN) { continue } return nil, err @@ -72,7 +72,7 @@ func parseClassThermalZone(zone string) (ClassThermalZoneStats, error) { if err != nil { return ClassThermalZoneStats{}, err } - zoneTemp, err := util.ReadIntFromFile(filepath.Join(zone, "temp")) + zoneTemp, err := util.SysReadIntFromFile(filepath.Join(zone, "temp")) if err != nil { return ClassThermalZoneStats{}, err } @@ -85,7 +85,7 @@ func parseClassThermalZone(zone string) (ClassThermalZoneStats, error) { zoneMode := util.ParseBool(mode) var zonePassive *uint64 - passive, err := util.ReadUintFromFile(filepath.Join(zone, "passive")) + passive, err := util.SysReadUintFromFile(filepath.Join(zone, "passive")) if os.IsNotExist(err) || os.IsPermission(err) { zonePassive = nil } else if err != nil { From 70166be27d2d65be1e39049bf734728c013e6757 Mon Sep 17 00:00:00 2001 From: Michael Fuller <168471316+mfuller-lambda@users.noreply.github.com> Date: Sat, 19 Apr 2025 10:37:17 -0500 Subject: [PATCH 34/69] class_infiniband: continue on syscall EINVAL (#705) https://github.com/prometheus/procfs/issues/704 In some very bleeding-edge configurations, syscalls against some IB counters will return `invalid argument`. This bubbles back to callers (e.g. node_exporter) in a very bad way -- e.g. all IB metrics collection failing when a single or group of IB ports returns this. Suspect this has always been an error case and possible to experience, but it's the first time we're seeing it in a very new hardware deployment. Signed-off-by: Michael Fuller --- sysfs/class_infiniband.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sysfs/class_infiniband.go b/sysfs/class_infiniband.go index 7892c69a..e9dd576e 100644 --- a/sysfs/class_infiniband.go +++ b/sysfs/class_infiniband.go @@ -23,6 +23,7 @@ import ( "path/filepath" "strconv" "strings" + "syscall" "github.com/prometheus/procfs/internal/util" ) @@ -319,7 +320,7 @@ func parseInfiniBandCounters(portPath string) (*InfiniBandCounters, error) { name := filepath.Join(path, f.Name()) value, err := util.SysReadFile(name) if err != nil { - if os.IsNotExist(err) || os.IsPermission(err) || err.Error() == "operation not supported" || errors.Is(err, os.ErrInvalid) { + if os.IsNotExist(err) || os.IsPermission(err) || err.Error() == "operation not supported" || errors.Is(err, os.ErrInvalid) || errors.Is(err, syscall.EINVAL) { continue } return nil, fmt.Errorf("failed to read file %q: %w", name, err) From 49d0fe65442213127f8af2963917c8b1dc91774d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 19 Apr 2025 17:37:53 +0200 Subject: [PATCH 35/69] build(deps): bump golang.org/x/sys from 0.31.0 to 0.32.0 (#717) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.31.0 to 0.32.0. - [Commits](https://github.com/golang/sys/compare/v0.31.0...v0.32.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-version: 0.32.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 44be2351..0e4a7e67 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.23.0 require ( github.com/google/go-cmp v0.7.0 golang.org/x/sync v0.12.0 - golang.org/x/sys v0.31.0 + golang.org/x/sys v0.32.0 ) diff --git a/go.sum b/go.sum index 6eb97cbd..9b7f5017 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= +golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= From 4482eb5b16b367a2f75b5be00e593ef3b0bf3794 Mon Sep 17 00:00:00 2001 From: Jeffrey Chu Date: Sat, 19 Apr 2025 23:40:23 +0800 Subject: [PATCH 36/69] Update class_infiniband.go (#687) Signed-off-by: Jeffrey Chu --- sysfs/class_infiniband.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysfs/class_infiniband.go b/sysfs/class_infiniband.go index e9dd576e..89478f93 100644 --- a/sysfs/class_infiniband.go +++ b/sysfs/class_infiniband.go @@ -280,8 +280,8 @@ func (fs FS) parseInfiniBandPort(name string, port string) (*InfiniBandPort, err return nil, fmt.Errorf("could not parse rate file in %q: %w", portPath, err) } - // Intel irdma module does not expose /sys/class/infiniband//ports//counters - if !strings.HasPrefix(ibp.Name, "irdma") { + // Intel irdma and Broadcom RoCE does not expose /sys/class/infiniband//ports//counters + if !strings.HasPrefix(ibp.Name, "irdma") && !strings.HasPrefix(ibp.Name, "bnxt_re") { counters, err := parseInfiniBandCounters(portPath) if err != nil { return nil, err From ee82f2ffc749a5996cde5a14085edc6ce1e68dc0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 19 Apr 2025 17:40:33 +0200 Subject: [PATCH 37/69] build(deps): bump golang.org/x/sync from 0.12.0 to 0.13.0 (#716) Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.12.0 to 0.13.0. - [Commits](https://github.com/golang/sync/compare/v0.12.0...v0.13.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-version: 0.13.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0e4a7e67..901c22f6 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.23.0 require ( github.com/google/go-cmp v0.7.0 - golang.org/x/sync v0.12.0 + golang.org/x/sync v0.13.0 golang.org/x/sys v0.32.0 ) diff --git a/go.sum b/go.sum index 9b7f5017..7cc99177 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= -golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= +golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= From cff69b9d9aa77a0793276da74310e38422864e28 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Sat, 19 Apr 2025 17:43:08 +0200 Subject: [PATCH 38/69] infiniband: do not make assumptions about counters based on HCA name (#678) Some users have reported cases of systemd "predictable network interface naming" apparently also renaming the HCA device. This means we can no longer make assumptions about which counter(s) should be present based on the HCA name (i.e., irdma*, mlx5_*). The previous approach was quite brittle anyway, since there will undoubtedly be other IB / RoCE drivers in future which implement the hw_counters directory (but not the older counters directory). Signed-off-by: Daniel Swarbrick Signed-off-by: Ben Kochie Co-authored-by: Ben Kochie --- sysfs/class_infiniband.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sysfs/class_infiniband.go b/sysfs/class_infiniband.go index 89478f93..30d1d3f0 100644 --- a/sysfs/class_infiniband.go +++ b/sysfs/class_infiniband.go @@ -280,8 +280,11 @@ func (fs FS) parseInfiniBandPort(name string, port string) (*InfiniBandPort, err return nil, fmt.Errorf("could not parse rate file in %q: %w", portPath, err) } - // Intel irdma and Broadcom RoCE does not expose /sys/class/infiniband//ports//counters - if !strings.HasPrefix(ibp.Name, "irdma") && !strings.HasPrefix(ibp.Name, "bnxt_re") { + // Since the HCA may have been renamed by systemd, we cannot infer the kernel driver used by the + // device, and thus do not know what type(s) of counters should be present. Attempt to parse + // either / both "counters" (and potentially also "counters_ext"), and "hw_counters", subject + // to their availability on the system - irrespective of HCA naming convention. + if _, err := os.Stat(filepath.Join(portPath, "counters")); err == nil { counters, err := parseInfiniBandCounters(portPath) if err != nil { return nil, err @@ -289,7 +292,7 @@ func (fs FS) parseInfiniBandPort(name string, port string) (*InfiniBandPort, err ibp.Counters = *counters } - if strings.HasPrefix(ibp.Name, "irdma") || strings.HasPrefix(ibp.Name, "mlx5_") { + if _, err := os.Stat(filepath.Join(portPath, "hw_counters")); err == nil { hwCounters, err := parseInfiniBandHwCounters(portPath) if err != nil { return nil, err From 369f9022fb69c3f44aad84de96914f25b581f997 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Wed, 14 May 2025 13:38:58 +0200 Subject: [PATCH 39/69] Update common Prometheus files (#718) Signed-off-by: prombot --- Makefile.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.common b/Makefile.common index 0ed55c2b..81bad5f4 100644 --- a/Makefile.common +++ b/Makefile.common @@ -33,7 +33,7 @@ GOHOSTOS ?= $(shell $(GO) env GOHOSTOS) GOHOSTARCH ?= $(shell $(GO) env GOHOSTARCH) GO_VERSION ?= $(shell $(GO) version) -GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION))Error Parsing File +GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION)) PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.') PROMU := $(FIRST_GOPATH)/bin/promu From 6dab0ae941868a1b8c6a72c778d2d8957bd2896d Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Wed, 21 May 2025 19:56:15 +0200 Subject: [PATCH 40/69] Update common Prometheus files (#721) Signed-off-by: prombot --- .github/workflows/golangci-lint.yml | 2 +- Makefile.common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 3893ef86..672dd424 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -36,4 +36,4 @@ jobs: uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0 with: args: --verbose - version: v2.0.2 + version: v2.1.5 diff --git a/Makefile.common b/Makefile.common index 81bad5f4..d8b79890 100644 --- a/Makefile.common +++ b/Makefile.common @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v2.0.2 +GOLANGCI_LINT_VERSION ?= v2.1.5 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) From 367ae0315ef6e201c3651996d557ab6ef7c18c11 Mon Sep 17 00:00:00 2001 From: Samuli Thomasson Date: Wed, 21 May 2025 20:02:53 +0200 Subject: [PATCH 41/69] btrfs: correct allocation ratios for raid1c[34] (#722) * Return right allocation ratios for the (somewhat recently added) btrfs RAID modes raid1c3 and raid1c4. Signed-off-by: Samuli Thomasson --- btrfs/get.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/btrfs/get.go b/btrfs/get.go index 4fce6212..583b5cc8 100644 --- a/btrfs/get.go +++ b/btrfs/get.go @@ -194,6 +194,10 @@ func (r *reader) calcRatio(p string) float64 { return 1 case "dup", "raid1", "raid10": return 2 + case "raid1c3": + return 3 + case "raid1c4": + return 4 case "raid5": return float64(r.devCount) / (float64(r.devCount) - 1) case "raid6": From d9705f6ce622155abfe9b11f62ea35f6e6e8417f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 20:03:56 +0200 Subject: [PATCH 42/69] build(deps): bump golang.org/x/sync from 0.13.0 to 0.14.0 (#724) Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.13.0 to 0.14.0. - [Commits](https://github.com/golang/sync/compare/v0.13.0...v0.14.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-version: 0.14.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 901c22f6..d8e96a32 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.23.0 require ( github.com/google/go-cmp v0.7.0 - golang.org/x/sync v0.13.0 + golang.org/x/sync v0.14.0 golang.org/x/sys v0.32.0 ) diff --git a/go.sum b/go.sum index 7cc99177..7759eda0 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= -golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= +golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= From 588b88c23f12c329a3e83376ba3dbc35fff85366 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 20:07:17 +0200 Subject: [PATCH 43/69] build(deps): bump golang.org/x/sys from 0.32.0 to 0.33.0 (#723) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.32.0 to 0.33.0. - [Commits](https://github.com/golang/sys/compare/v0.32.0...v0.33.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-version: 0.33.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d8e96a32..6446f9c1 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.23.0 require ( github.com/google/go-cmp v0.7.0 golang.org/x/sync v0.14.0 - golang.org/x/sys v0.32.0 + golang.org/x/sys v0.33.0 ) diff --git a/go.sum b/go.sum index 7759eda0..7f2a7465 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= -golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= From 28d508db177fff6d90696c7ce462f34fcf448101 Mon Sep 17 00:00:00 2001 From: zhiyuan zhou Date: Thu, 3 Jul 2025 16:10:49 +0800 Subject: [PATCH 44/69] Supports collection of process shared memory (#719) * Parse process memory usage from /proc/[pid]/statm into ProcStatm struct. * Add unit tests for proc_statm. * Add /proc/26231/statm test data to fixtures. Signed-off-by: zhiyuan.zhou Co-authored-by: zhiyuan.zhou --- proc_statm.go | 116 +++++++++++++++++++++++++++++++++++ proc_statm_test.go | 135 +++++++++++++++++++++++++++++++++++++++++ testdata/fixtures.ttar | 5 ++ 3 files changed, 256 insertions(+) create mode 100644 proc_statm.go create mode 100644 proc_statm_test.go diff --git a/proc_statm.go b/proc_statm.go new file mode 100644 index 00000000..0ebc2502 --- /dev/null +++ b/proc_statm.go @@ -0,0 +1,116 @@ +// Copyright 2025 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "os" + "strconv" + "strings" + + "github.com/prometheus/procfs/internal/util" +) + +// - https://man7.org/linux/man-pages/man5/proc_pid_statm.5.html + +// ProcStatm Provides memory usage information for a process, measured in memory pages. +// read from /proc/[pid]/statm. +type ProcStatm struct { + // The process ID. + PID int + // total program size (same as VmSize in status) + Size uint64 + // resident set size (same as VmRSS in status) + Resident uint64 + // number of resident shared pages (i.e., backed by a file) + Shared uint64 + // text (code) + Text uint64 + // library (unused since Linux 2.6; always 0) + Lib uint64 + // data + stack + Data uint64 + // dirty pages (unused since Linux 2.6; always 0) + Dt uint64 +} + +// NewStatm returns the current status information of the process. +// Deprecated: Use p.Statm() instead. +func (p Proc) NewStatm() (ProcStatm, error) { + return p.Statm() +} + +// Statm returns the current memory usage information of the process. +func (p Proc) Statm() (ProcStatm, error) { + data, err := util.ReadFileNoStat(p.path("statm")) + if err != nil { + return ProcStatm{}, err + } + + statmSlice, err := parseStatm(data) + if err != nil { + return ProcStatm{}, err + } + + procStatm := ProcStatm{ + PID: p.PID, + Size: statmSlice[0], + Resident: statmSlice[1], + Shared: statmSlice[2], + Text: statmSlice[3], + Lib: statmSlice[4], + Data: statmSlice[5], + Dt: statmSlice[6], + } + + return procStatm, nil +} + +// parseStatm return /proc/[pid]/statm data to uint64 slice. +func parseStatm(data []byte) ([]uint64, error) { + var statmSlice []uint64 + statmItems := strings.Fields(string(data)) + for i := 0; i < len(statmItems); i++ { + statmItem, err := strconv.ParseUint(statmItems[i], 10, 64) + if err != nil { + return nil, err + } + statmSlice = append(statmSlice, statmItem) + } + return statmSlice, nil +} + +// SizeBytes returns the process of total program size in bytes. +func (s ProcStatm) SizeBytes() uint64 { + return s.Size * uint64(os.Getpagesize()) +} + +// ResidentBytes returns the process of resident set size in bytes. +func (s ProcStatm) ResidentBytes() uint64 { + return s.Resident * uint64(os.Getpagesize()) +} + +// SHRBytes returns the process of share memory size in bytes. +func (s ProcStatm) SHRBytes() uint64 { + return s.Shared * uint64(os.Getpagesize()) +} + +// TextBytes returns the process of text (code) size in bytes. +func (s ProcStatm) TextBytes() uint64 { + return s.Text * uint64(os.Getpagesize()) +} + +// DataBytes returns the process of data + stack size in bytes. +func (s ProcStatm) DataBytes() uint64 { + return s.Data * uint64(os.Getpagesize()) +} diff --git a/proc_statm_test.go b/proc_statm_test.go new file mode 100644 index 00000000..8d2c651d --- /dev/null +++ b/proc_statm_test.go @@ -0,0 +1,135 @@ +// Copyright 2025 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "math" + "os" + "testing" +) + +func TestProcStatm(t *testing.T) { + statm, err := testProcStatm(26231) + if err != nil { + t.Fatal(err) + } + + for _, test := range []struct { + name string + want uint64 + have uint64 + }{ + {name: "Pid", want: 26231, have: uint64(statm.PID)}, + {name: "Size", want: 149919, have: statm.Size}, + {name: "Resident", want: 12547, have: statm.Resident}, + {name: "Shared", want: 18446744073709551615, have: statm.Shared}, + {name: "Text", want: 19864, have: statm.Text}, + {name: "Lib", want: 0, have: statm.Lib}, + {name: "Data", want: 14531, have: statm.Data}, + {name: "Dt", want: 0, have: statm.Dt}, + } { + if test.want != test.have { + t.Errorf("want %s %d, have %d", test.name, test.want, test.have) + } + } +} + +func TestProcStatmLimits(t *testing.T) { + statm, err := testProcStatm(26231) + if err != nil { + t.Fatal(err) + } + + // max values of stat int fields + for _, test := range []struct { + name string + want uint64 + have uint64 + }{ + {name: "number of resident shared pages in process", want: math.MaxUint64, have: statm.Shared}, + {name: "number of dirty pages in process", want: 0, have: statm.Dt}, + } { + if test.want != test.have { + t.Errorf("want %s %d, have %d", test.name, test.want, test.have) + } + } +} + +func TestSizeBytes(t *testing.T) { + statm, err := testProcStatm(26231) + if err != nil { + t.Fatal(err) + } + + if want, have := statm.Size*uint64(os.Getpagesize()), statm.SizeBytes(); want != have { + t.Errorf("want total program memory %d, have %d", want, have) + } +} + +func TestResidentBytes(t *testing.T) { + statm, err := testProcStatm(26231) + if err != nil { + t.Fatal(err) + } + + if want, have := statm.Resident*uint64(os.Getpagesize()), statm.ResidentBytes(); want != have { + t.Errorf("want resident memory %d, have %d", want, have) + } +} + +func TestSHRBytes(t *testing.T) { + statm, err := testProcStatm(26231) + if err != nil { + t.Fatal(err) + } + + if want, have := statm.Shared*uint64(os.Getpagesize()), statm.SHRBytes(); want != have { + t.Errorf("want share memory %d, have %d", want, have) + } +} + +func TestTextBytes(t *testing.T) { + statm, err := testProcStatm(26231) + if err != nil { + t.Fatal(err) + } + + if want, have := statm.Text*uint64(os.Getpagesize()), statm.TextBytes(); want != have { + t.Errorf("want text (code) size %d, have %d", want, have) + } +} + +func TestDataBytes(t *testing.T) { + statm, err := testProcStatm(26231) + if err != nil { + t.Fatal(err) + } + + if want, have := statm.Data*uint64(os.Getpagesize()), statm.DataBytes(); want != have { + t.Errorf("want data + stack size %d, have %d", want, have) + } +} + +func testProcStatm(pid int) (ProcStatm, error) { + fs, err := NewFS(procTestFixtures) + if err != nil { + return ProcStatm{}, err + } + p, err := fs.Proc(pid) + if err != nil { + return ProcStatm{}, err + } + + return p.Statm() +} diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index 8f6cd477..b42a5f5a 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -802,6 +802,11 @@ Lines: 1 26231 (vim) R 5392 7446 5392 34835 7446 4218880 32533 309516 26 82 1677 44 158 99 20 0 1 0 82375 56274944 1981 18446744073709551615 4194304 6294284 140736914091744 140736914087944 139965136429984 0 0 12288 1870679807 0 0 0 17 0 0 0 31 0 0 8391624 8481048 16420864 140736914093252 140736914093279 140736914093279 140736914096107 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/26231/statm +Lines: 1 +149919 12547 18446744073709551615 19864 0 14531 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/26231/status Lines: 53 From 65857f3abe1de8e9dedc8015e31ca702f5bfe798 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Jul 2025 10:11:02 +0200 Subject: [PATCH 45/69] build(deps): bump golang.org/x/sync from 0.14.0 to 0.15.0 (#732) Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.14.0 to 0.15.0. - [Commits](https://github.com/golang/sync/compare/v0.14.0...v0.15.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-version: 0.15.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6446f9c1..e8254697 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.23.0 require ( github.com/google/go-cmp v0.7.0 - golang.org/x/sync v0.14.0 + golang.org/x/sync v0.15.0 golang.org/x/sys v0.33.0 ) diff --git a/go.sum b/go.sum index 7f2a7465..2143357f 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ= -golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= +golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= From 0e4338f8ec5ae11a47bd6a3ff8c15d6f5d806019 Mon Sep 17 00:00:00 2001 From: Shashwat Hiregoudar Date: Thu, 3 Jul 2025 13:42:49 +0530 Subject: [PATCH 46/69] exposing ControllerID (#731) Signed-off-by: Shashwat Hiregoudar --- sysfs/class_nvme.go | 5 ++++- sysfs/class_nvme_test.go | 1 + testdata/fixtures.ttar | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sysfs/class_nvme.go b/sysfs/class_nvme.go index 133f6afa..439847a5 100644 --- a/sysfs/class_nvme.go +++ b/sysfs/class_nvme.go @@ -33,6 +33,7 @@ type NVMeDevice struct { Model string // /sys/class/nvme//model State string // /sys/class/nvme//state FirmwareRevision string // /sys/class/nvme//firmware_rev + ControllerID string // /sys/class/nvme//cntlid } // NVMeClass is a collection of every NVMe device in /sys/class/nvme. @@ -67,7 +68,7 @@ func (fs FS) parseNVMeDevice(name string) (*NVMeDevice, error) { path := fs.sys.Path(nvmeClassPath, name) device := NVMeDevice{Name: name} - for _, f := range [...]string{"firmware_rev", "model", "serial", "state"} { + for _, f := range [...]string{"firmware_rev", "model", "serial", "state", "cntlid"} { name := filepath.Join(path, f) value, err := util.SysReadFile(name) if err != nil { @@ -83,6 +84,8 @@ func (fs FS) parseNVMeDevice(name string) (*NVMeDevice, error) { device.Serial = value case "state": device.State = value + case "cntlid": + device.ControllerID = value } } diff --git a/sysfs/class_nvme_test.go b/sysfs/class_nvme_test.go index 3867be8d..9827474c 100644 --- a/sysfs/class_nvme_test.go +++ b/sysfs/class_nvme_test.go @@ -40,6 +40,7 @@ func TestNVMeClass(t *testing.T) { Model: "Samsung SSD 970 PRO 512GB", Serial: "S680HF8N190894I", State: "live", + ControllerID: "1997", }, } diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index b42a5f5a..6228324a 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -6417,6 +6417,11 @@ Mode: 755 Directory: fixtures/sys/class/nvme/nvme0 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/nvme/nvme0/cntlid +Lines: 1 +1997 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/nvme/nvme0/firmware_rev Lines: 1 1B2QEXP7 From 0f247ba36764120f923904e68202df0dae9cc58f Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Thu, 3 Jul 2025 10:13:21 +0200 Subject: [PATCH 47/69] Update common Prometheus files (#727) Signed-off-by: prombot --- Makefile.common | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile.common b/Makefile.common index d8b79890..4de21512 100644 --- a/Makefile.common +++ b/Makefile.common @@ -62,6 +62,7 @@ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= GOLANGCI_LINT_VERSION ?= v2.1.5 +GOLANGCI_FMT_OPTS ?= # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) @@ -156,9 +157,13 @@ $(GOTEST_DIR): @mkdir -p $@ .PHONY: common-format -common-format: +common-format: $(GOLANGCI_LINT) @echo ">> formatting code" $(GO) fmt $(pkgs) +ifdef GOLANGCI_LINT + @echo ">> formatting code with golangci-lint" + $(GOLANGCI_LINT) fmt $(GOLANGCI_FMT_OPTS) +endif .PHONY: common-vet common-vet: @@ -248,8 +253,8 @@ $(PROMU): cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu rm -r $(PROMU_TMP) -.PHONY: proto -proto: +.PHONY: common-proto +common-proto: @echo ">> generating code from proto files" @./scripts/genproto.sh From 617681836f71740ebe8125b614e55f56a0e09667 Mon Sep 17 00:00:00 2001 From: Naoki MATSUMOTO <33079554+naoki9911@users.noreply.github.com> Date: Thu, 3 Jul 2025 17:17:09 +0900 Subject: [PATCH 48/69] sysfs: Add support to collect link status for PCIe devices (#728) The link status of PCIe devices sometimes changes, like link or speed downgrades, and devices disappear. This patch collects PCIe devices' link infromation to detect such failures. As a first step, this collector exports PCIe devices' - Device information (vendor_id, device_id, etc.) - Parent PCIe device (e.g. PCIe bridge, PCIe switch) - Link status (max_link_{speed|width}, current_link_{speed|width} Signed-off-by: Naoki MATSUMOTO --- sysfs/pci_device.go | 261 +++++ sysfs/pci_device_test.go | 112 ++ testdata/fixtures.ttar | 2301 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 2674 insertions(+) create mode 100644 sysfs/pci_device.go create mode 100644 sysfs/pci_device_test.go diff --git a/sysfs/pci_device.go b/sysfs/pci_device.go new file mode 100644 index 00000000..1ac7ee26 --- /dev/null +++ b/sysfs/pci_device.go @@ -0,0 +1,261 @@ +// Copyright 2025 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package sysfs + +import ( + "fmt" + "os" + "path/filepath" + "strconv" + "strings" + + "github.com/prometheus/procfs/internal/util" +) + +const pciDevicesPath = "bus/pci/devices" + +// PciDeviceLocation represents the location of the device attached. +// "0000:00:00.0" represents Segment:Bus:Device.Function . +type PciDeviceLocation struct { + Segment int + Bus int + Device int + Function int +} + +func (pdl PciDeviceLocation) String() string { + return fmt.Sprintf("%04x:%02x:%02x:%x", pdl.Segment, pdl.Bus, pdl.Device, pdl.Function) +} + +func (pdl PciDeviceLocation) Strings() []string { + return []string{ + fmt.Sprintf("%04x", pdl.Segment), + fmt.Sprintf("%02x", pdl.Bus), + fmt.Sprintf("%02x", pdl.Device), + fmt.Sprintf("%x", pdl.Function), + } +} + +// PciDevice contains info from files in /sys/bus/pci/devices for a +// single PCI device. +type PciDevice struct { + Location PciDeviceLocation + ParentLocation *PciDeviceLocation + + Class uint32 // /sys/bus/pci/devices//class + Vendor uint32 // /sys/bus/pci/devices//vendor + Device uint32 // /sys/bus/pci/devices//device + SubsystemVendor uint32 // /sys/bus/pci/devices//subsystem_vendor + SubsystemDevice uint32 // /sys/bus/pci/devices//subsystem_device + Revision uint32 // /sys/bus/pci/devices//revision + + MaxLinkSpeed *float64 // /sys/bus/pci/devices//max_link_speed + MaxLinkWidth *float64 // /sys/bus/pci/devices//max_link_width + CurrentLinkSpeed *float64 // /sys/bus/pci/devices//current_link_speed + CurrentLinkWidth *float64 // /sys/bus/pci/devices//current_link_width +} + +func (pd PciDevice) Name() string { + return pd.Location.String() +} + +// PciDevices is a collection of every PCI device in +// /sys/bus/pci/devices . +// +// The map keys are the location of PCI devices. +type PciDevices map[string]PciDevice + +// PciDevices returns info for all PCI devices read from +// /sys/bus/pci/devices . +func (fs FS) PciDevices() (PciDevices, error) { + path := fs.sys.Path(pciDevicesPath) + + dirs, err := os.ReadDir(path) + if err != nil { + return nil, err + } + + pciDevs := make(PciDevices, len(dirs)) + for _, d := range dirs { + device, err := fs.parsePciDevice(d.Name()) + if err != nil { + return nil, err + } + + pciDevs[device.Name()] = *device + } + + return pciDevs, nil +} + +func parsePciDeviceLocation(loc string) (*PciDeviceLocation, error) { + locs := strings.Split(loc, ":") + if len(locs) != 3 { + return nil, fmt.Errorf("invalid location '%s'", loc) + } + locs = append(locs[0:2], strings.Split(locs[2], ".")...) + if len(locs) != 4 { + return nil, fmt.Errorf("invalid location '%s'", loc) + } + + seg, err := strconv.ParseInt(locs[0], 16, 32) + if err != nil { + return nil, fmt.Errorf("invalid segment: %w", err) + } + bus, err := strconv.ParseInt(locs[1], 16, 32) + if err != nil { + return nil, fmt.Errorf("invalid bus: %w", err) + } + device, err := strconv.ParseInt(locs[2], 16, 32) + if err != nil { + return nil, fmt.Errorf("invalid device: %w", err) + } + function, err := strconv.ParseInt(locs[3], 16, 32) + if err != nil { + return nil, fmt.Errorf("invalid function: %w", err) + } + + return &PciDeviceLocation{ + Segment: int(seg), + Bus: int(bus), + Device: int(device), + Function: int(function), + }, nil +} + +// Parse one PCI device +// Refer to https://docs.kernel.org/PCI/sysfs-pci.html +func (fs FS) parsePciDevice(name string) (*PciDevice, error) { + path := fs.sys.Path(pciDevicesPath, name) + // the file must be symbolic link. + realPath, err := os.Readlink(path) + if err != nil { + return nil, fmt.Errorf("failed to readlink: %w", err) + } + + // parse device location from realpath + // like "../../../devices/pci0000:00/0000:00:02.5/0000:04:00.0" + deviceLocStr := filepath.Base(realPath) + parentDeviceLocStr := filepath.Base(filepath.Dir(realPath)) + + deviceLoc, err := parsePciDeviceLocation(deviceLocStr) + if err != nil { + return nil, fmt.Errorf("failed to parse device location:%q %w", deviceLoc, err) + } + + // the parent device may have "pci" prefix. + // this is not pci device like bridges. + // we ignore such location to avoid confusion. + // TODO: is it really ok? + var parentDeviceLoc *PciDeviceLocation + if !strings.HasPrefix(parentDeviceLocStr, "pci") { + parentDeviceLoc, err = parsePciDeviceLocation(parentDeviceLocStr) + if err != nil { + return nil, fmt.Errorf("failed to parse parent device location %q: %w", parentDeviceLocStr, err) + } + } + + device := &PciDevice{ + Location: *deviceLoc, + ParentLocation: parentDeviceLoc, + } + + // These files must exist in a device directory. + for _, f := range [...]string{"class", "vendor", "device", "subsystem_vendor", "subsystem_device", "revision"} { + name := filepath.Join(path, f) + valueStr, err := util.SysReadFile(name) + if err != nil { + return nil, fmt.Errorf("failed to read file %q: %w", name, err) + } + value, err := strconv.ParseInt(valueStr, 0, 32) + if err != nil { + return nil, fmt.Errorf("failed to parse %q: %w", valueStr, err) + } + + switch f { + case "class": + device.Class = uint32(value) + case "vendor": + device.Vendor = uint32(value) + case "device": + device.Device = uint32(value) + case "subsystem_vendor": + device.SubsystemVendor = uint32(value) + case "subsystem_device": + device.SubsystemDevice = uint32(value) + case "revision": + device.Revision = uint32(value) + default: + return nil, fmt.Errorf("unknown file %q", f) + } + } + + for _, f := range [...]string{"max_link_speed", "max_link_width", "current_link_speed", "current_link_width"} { + name := filepath.Join(path, f) + valueStr, err := util.SysReadFile(name) + if err != nil { + if os.IsNotExist(err) { + continue + } + return nil, fmt.Errorf("failed to read file %q: %w", name, err) + } + + // Some devices may be NULL or contain 'Unknown' as a value + // values defined in drivers/pci/probe.c pci_speed_string + if valueStr == "" || strings.HasPrefix(valueStr, "Unknown") { + continue + } + + switch f { + case "max_link_speed", "current_link_speed": + // example "8.0 GT/s PCIe" + values := strings.SplitAfterN(valueStr, " ", 2) + if len(values) != 2 { + return nil, fmt.Errorf("invalid value for %s %q %s", f, valueStr, device.Location) + } + if values[1] != "GT/s PCIe" { + return nil, fmt.Errorf("unknown unit for %s %q %s", f, valueStr, device.Location) + } + value, err := strconv.ParseFloat(strings.TrimSpace(values[0]), 64) + if err != nil { + return nil, fmt.Errorf("failed to parse %s %q: %w", f, valueStr, err) + } + v := float64(value) + switch f { + case "max_link_speed": + device.MaxLinkSpeed = &v + case "current_link_speed": + device.CurrentLinkSpeed = &v + } + + case "max_link_width", "current_link_width": + value, err := strconv.ParseInt(valueStr, 10, 64) + if err != nil { + return nil, fmt.Errorf("failed to parse %s %q: %w", f, valueStr, err) + } + v := float64(value) + switch f { + case "max_link_width": + device.MaxLinkWidth = &v + case "current_link_width": + device.CurrentLinkWidth = &v + } + } + } + + return device, nil +} diff --git a/sysfs/pci_device_test.go b/sysfs/pci_device_test.go new file mode 100644 index 00000000..3b7f7449 --- /dev/null +++ b/sysfs/pci_device_test.go @@ -0,0 +1,112 @@ +// Copyright 2025 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package sysfs + +import ( + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestPciDevices(t *testing.T) { + fs, err := NewFS(sysTestFixtures) + if err != nil { + t.Fatal(err) + } + + got, err := fs.PciDevices() + if err != nil { + t.Fatal(err) + } + + var ( + LinkSpeed8GTs = 8.0 + LinkWidth4 = 4.0 + LinkWidth8 = 8.0 + ) + want := PciDevices{ + "0000:00:02:1": PciDevice{ + Location: PciDeviceLocation{ + Segment: 0, + Bus: 0, + Device: 2, + Function: 1, + }, + ParentLocation: nil, + + Class: 0x060400, + Vendor: 0x1022, + Device: 0x1634, + SubsystemVendor: 0x17aa, + SubsystemDevice: 0x5095, + Revision: 0x00, + + MaxLinkSpeed: &LinkSpeed8GTs, + MaxLinkWidth: &LinkWidth8, + CurrentLinkSpeed: &LinkSpeed8GTs, + CurrentLinkWidth: &LinkWidth4, + }, + "0000:01:00:0": PciDevice{ + Location: PciDeviceLocation{ + Segment: 0, + Bus: 1, + Device: 0, + Function: 0, + }, + ParentLocation: &PciDeviceLocation{ + Segment: 0, + Bus: 0, + Device: 2, + Function: 1, + }, + + Class: 0x010802, + Vendor: 0xc0a9, + Device: 0x540a, + SubsystemVendor: 0xc0a9, + SubsystemDevice: 0x5021, + Revision: 0x01, + + MaxLinkSpeed: &LinkSpeed8GTs, + MaxLinkWidth: &LinkWidth4, + CurrentLinkSpeed: &LinkSpeed8GTs, + CurrentLinkWidth: &LinkWidth4, + }, + } + + if diff := cmp.Diff(want, got); diff != "" { + t.Fatalf("unexpected PciDevices (-want +got):\n%s", diff) + } +} + +func TestParseDeviceLocation(t *testing.T) { + got, err := parsePciDeviceLocation("0001:9b:0c.0") + if err != nil { + t.Fatal(err) + } + + want := &PciDeviceLocation{ + Segment: 1, + Bus: 0x9b, + Device: 0xc, + Function: 0, + } + + if diff := cmp.Diff(want, got); diff != "" { + t.Fatalf("unexpected location (-want +got):\n%s", diff) + } +} diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index 6228324a..1ee91695 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -4704,6 +4704,15 @@ Mode: 755 Directory: fixtures/sys/bus/pci Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/bus/pci/devices +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/bus/pci/devices/0000:00:02.1 +SymlinkTo: ../../../devices/pci0000:00/0000:00:02.1 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/bus/pci/devices/0000:01:00.0 +SymlinkTo: ../../../devices/pci0000:00/0000:00:02.1/0000:01:00.0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/bus/pci/drivers Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -7730,6 +7739,2298 @@ Lines: 1 5233597394395EOF Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie001 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie001/driver +SymlinkTo: ../../../../bus/pci_express/drivers/pcie_pme +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie001/power +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie001/power/async +Lines: 1 +enabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie001/power/runtime_active_kids +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie001/power/runtime_enabled +Lines: 1 +disabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie001/power/runtime_status +Lines: 1 +unsupported +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie001/power/runtime_usage +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie001/subsystem +SymlinkTo: ../../../../bus/pci_express +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie001/uevent +Lines: 1 +DRIVER=pcie_pme +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie010 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie010/power +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie010/power/async +Lines: 1 +enabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie010/power/runtime_active_kids +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie010/power/runtime_enabled +Lines: 1 +disabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie010/power/runtime_status +Lines: 1 +unsupported +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie010/power/runtime_usage +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie010/subsystem +SymlinkTo: ../../../../bus/pci_express +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:00:02.1:pcie010/uevent +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/aer_dev_correctable +Lines: 9 +RxErr 0 +BadTLP 0 +BadDLLP 0 +Rollover 0 +Timeout 0 +NonFatalErr 0 +CorrIntErr 0 +HeaderOF 0 +TOTAL_ERR_COR 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/aer_dev_fatal +Lines: 19 +Undefined 0 +DLP 0 +SDES 0 +TLP 0 +FCP 0 +CmpltTO 0 +CmpltAbrt 0 +UnxCmplt 0 +RxOF 0 +MalfTLP 0 +ECRC 0 +UnsupReq 0 +ACSViol 0 +UncorrIntErr 0 +BlockedTLP 0 +AtomicOpBlocked 0 +TLPBlockedErr 0 +PoisonTLPBlocked 0 +TOTAL_ERR_FATAL 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/aer_dev_nonfatal +Lines: 19 +Undefined 0 +DLP 0 +SDES 0 +TLP 0 +FCP 0 +CmpltTO 0 +CmpltAbrt 0 +UnxCmplt 0 +RxOF 0 +MalfTLP 0 +ECRC 0 +UnsupReq 0 +ACSViol 0 +UncorrIntErr 0 +BlockedTLP 0 +AtomicOpBlocked 0 +TLPBlockedErr 0 +PoisonTLPBlocked 0 +TOTAL_ERR_NONFATAL 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/ari_enabled +Lines: 1 +1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/broken_parity_status +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/class +Lines: 1 +0x010802 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/config +Lines: 2 +�� +TNULLBYTENULLBYTENULLBYTENULLBYTENULLBYTE��NULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTE��!PNULLBYTENULLBYTENULLBYTENULLBYTE�NULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTE�NULLBYTENULLBYTEEOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/consistent_dma_mask_bits +Lines: 1 +64 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/current_link_speed +Lines: 1 +8.0 GT/s PCIe +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/current_link_width +Lines: 1 +4 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/d3cold_allowed +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/device +Lines: 1 +0x540a +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/dma_mask_bits +Lines: 1 +64 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/driver +SymlinkTo: ../../../../bus/pci/drivers/nvme +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/driver_override +Lines: 1 +(null) +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/enable +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/firmware_node +SymlinkTo: ../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:16/device:17 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/iommu +SymlinkTo: ../../0000:00:00.2/iommu/ivhd0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/iommu_group +SymlinkTo: ../../../../kernel/iommu_groups/11 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/irq +Lines: 1 +80 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/link +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/local_cpulist +Lines: 1 +0-15 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/local_cpus +Lines: 1 +ffff +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/max_link_speed +Lines: 1 +8.0 GT/s PCIe +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/max_link_width +Lines: 1 +4 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/modalias +Lines: 1 +pci:v0000C0A9d0000540Asv0000C0A9sd00005021bc01sc08i02 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/msi_bus +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/msi_irqs +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/msi_irqs/81 +Lines: 1 +msix +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/msi_irqs/82 +Lines: 1 +msix +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/msi_irqs/83 +Lines: 1 +msix +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/msi_irqs/84 +Lines: 1 +msix +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/msi_irqs/85 +Lines: 1 +msix +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/msi_irqs/86 +Lines: 1 +msix +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/msi_irqs/87 +Lines: 1 +msix +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/msi_irqs/88 +Lines: 1 +msix +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/msi_irqs/89 +Lines: 1 +msix +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/numa_node +Lines: 1 +-1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/address +Lines: 1 +0000:01:00.0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/cntlid +Lines: 1 +1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/cntrltype +Lines: 1 +io +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/dctype +Lines: 1 +none +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/dev +Lines: 1 +240:0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/device +SymlinkTo: ../../../0000:01:00.0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/firmware_rev +Lines: 1 +P9CR30A +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/device +SymlinkTo: ../../nvme0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/name +Lines: 1 +nvme +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/power +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/power/async +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/power/autosuspend_delay_ms +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/power/control +Lines: 1 +auto +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/power/runtime_active_kids +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/power/runtime_active_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/power/runtime_enabled +Lines: 1 +disabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/power/runtime_status +Lines: 1 +unsupported +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/power/runtime_suspended_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/power/runtime_usage +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/subsystem +SymlinkTo: ../../../../../../../class/hwmon +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp1_alarm +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp1_crit +Lines: 1 +94850 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp1_input +Lines: 1 +43850 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp1_label +Lines: 1 +Composite +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp1_max +Lines: 1 +84850 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp1_min +Lines: 1 +-150 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp2_input +Lines: 1 +43850 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp2_label +Lines: 1 +Sensor 1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp2_max +Lines: 1 +65261850 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp2_min +Lines: 1 +-273150 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp3_input +Lines: 1 +45850 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp3_label +Lines: 1 +Sensor 2 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp3_max +Lines: 1 +65261850 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp3_min +Lines: 1 +-273150 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp9_input +Lines: 1 +43850 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp9_label +Lines: 1 +Sensor 8 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp9_max +Lines: 1 +65261850 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/temp9_min +Lines: 1 +-273150 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/hwmon3/uevent +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/kato +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/model +Lines: 1 +CT2000P3SSD8 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/dev +Lines: 1 +239:0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/device +SymlinkTo: ../../nvme0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/power +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/power/async +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/power/autosuspend_delay_ms +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/power/control +Lines: 1 +auto +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/power/runtime_active_kids +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/power/runtime_active_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/power/runtime_enabled +Lines: 1 +disabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/power/runtime_status +Lines: 1 +unsupported +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/power/runtime_suspended_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/power/runtime_usage +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/subsystem +SymlinkTo: ../../../../../../../class/nvme-generic +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/ng0n1/uevent +Lines: 3 +MAJOR=239 +MINOR=0 +DEVNAME=ng0n1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/numa_node +Lines: 1 +-1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/alignment_offset +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/bdi +SymlinkTo: ../../../../../../virtual/bdi/259:0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/capability +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/csi +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/dev +Lines: 1 +259:0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/device +SymlinkTo: ../../nvme0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/discard_alignment +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/diskseq +Lines: 1 +9 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/events +Lines: 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/events_async +Lines: 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/events_poll_msecs +Lines: 1 +-1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/ext_range +Lines: 1 +256 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/hidden +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/holders +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/inflight +Lines: 1 + 0 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/integrity +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/integrity/device_is_integrity_capable +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/integrity/format +Lines: 1 +none +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/integrity/protection_interval_bytes +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/integrity/read_verify +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/integrity/tag_size +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/integrity/write_generate +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/metadata_bytes +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/0/cpu0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/0/cpu1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/0/cpu_list +Lines: 1 +0, 1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/0/nr_reserved_tags +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/0/nr_tags +Lines: 1 +1023 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/1/cpu2 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/1/cpu3 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/1/cpu_list +Lines: 1 +2, 3 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/1/nr_reserved_tags +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/1/nr_tags +Lines: 1 +1023 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/2 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/2/cpu4 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/2/cpu5 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/2/cpu_list +Lines: 1 +4, 5 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/2/nr_reserved_tags +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/2/nr_tags +Lines: 1 +1023 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/3 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/3/cpu6 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/3/cpu7 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/3/cpu_list +Lines: 1 +6, 7 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/3/nr_reserved_tags +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/3/nr_tags +Lines: 1 +1023 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/4 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/4/cpu8 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/4/cpu9 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/4/cpu_list +Lines: 1 +8, 9 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/4/nr_reserved_tags +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/4/nr_tags +Lines: 1 +1023 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/5 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/5/cpu10 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/5/cpu11 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/5/cpu_list +Lines: 1 +10, 11 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/5/nr_reserved_tags +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/5/nr_tags +Lines: 1 +1023 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/6 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/6/cpu12 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/6/cpu13 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/6/cpu_list +Lines: 1 +12, 13 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/6/nr_reserved_tags +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/6/nr_tags +Lines: 1 +1023 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/7 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/7/cpu14 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/7/cpu15 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/7/cpu_list +Lines: 1 +14, 15 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/7/nr_reserved_tags +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/mq/7/nr_tags +Lines: 1 +1023 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nsid +Lines: 1 +1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nuse +Lines: 1 +3907029168 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/alignment_offset +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/dev +Lines: 1 +259:1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/discard_alignment +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/holders +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/inflight +Lines: 1 + 0 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/partition +Lines: 1 +1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/power +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/power/async +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/power/autosuspend_delay_ms +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/power/control +Lines: 1 +auto +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/power/runtime_active_kids +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/power/runtime_active_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/power/runtime_enabled +Lines: 1 +disabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/power/runtime_status +Lines: 1 +unsupported +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/power/runtime_suspended_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/power/runtime_usage +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/ro +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/size +Lines: 1 +2201600 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/start +Lines: 1 +2048 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/stat +Lines: 1 + 575 1730 14410 185 2 0 2 0 0 17 186 1 0 2184688 1 0 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/subsystem +SymlinkTo: ../../../../../../../../class/block +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/trace +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/trace/act_mask +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/trace/enable +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/trace/end_lba +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/trace/pid +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/trace/start_lba +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p1/uevent +Lines: 6 +MAJOR=259 +MINOR=1 +DEVNAME=nvme0n1p1 +DEVTYPE=partition +DISKSEQ=9 +PARTN=1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/alignment_offset +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/dev +Lines: 1 +259:2 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/discard_alignment +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/holders +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/inflight +Lines: 1 + 0 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/partition +Lines: 1 +2 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/power +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/power/async +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/power/autosuspend_delay_ms +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/power/control +Lines: 1 +auto +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/power/runtime_active_kids +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/power/runtime_active_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/power/runtime_enabled +Lines: 1 +disabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/power/runtime_status +Lines: 1 +unsupported +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/power/runtime_suspended_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/power/runtime_usage +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/ro +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/size +Lines: 1 +4194304 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/start +Lines: 1 +2203648 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/stat +Lines: 1 + 144 19 8954 32 21 14 248 20 0 128 132 45 0 3566944 79 0 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/subsystem +SymlinkTo: ../../../../../../../../class/block +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/trace +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/trace/act_mask +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/trace/enable +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/trace/end_lba +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/trace/pid +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/trace/start_lba +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p2/uevent +Lines: 6 +MAJOR=259 +MINOR=2 +DEVNAME=nvme0n1p2 +DEVTYPE=partition +DISKSEQ=9 +PARTN=2 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/alignment_offset +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/dev +Lines: 1 +259:3 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/discard_alignment +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/holders +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/holders/dm-0 +SymlinkTo: ../../../../../../../../virtual/block/dm-0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/inflight +Lines: 1 + 0 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/partition +Lines: 1 +3 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/power +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/power/async +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/power/autosuspend_delay_ms +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/power/control +Lines: 1 +auto +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/power/runtime_active_kids +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/power/runtime_active_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/power/runtime_enabled +Lines: 1 +disabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/power/runtime_status +Lines: 1 +unsupported +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/power/runtime_suspended_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/power/runtime_usage +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/ro +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/size +Lines: 1 +3900628992 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/start +Lines: 1 +6397952 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/stat +Lines: 1 + 60223 15025 4174111 24812 83879 46834 2302280 32384 0 24667 57196 0 0 0 0 0 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/subsystem +SymlinkTo: ../../../../../../../../class/block +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/trace +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/trace/act_mask +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/trace/enable +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/trace/end_lba +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/trace/pid +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/trace/start_lba +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/nvme0n1p3/uevent +Lines: 6 +MAJOR=259 +MINOR=3 +DEVNAME=nvme0n1p3 +DEVTYPE=partition +DISKSEQ=9 +PARTN=3 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/partscan +Lines: 1 +1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/passthru_err_log_enabled +Lines: 1 +off +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/power +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/power/async +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/power/autosuspend_delay_ms +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/power/control +Lines: 1 +auto +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/power/runtime_active_kids +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/power/runtime_active_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/power/runtime_enabled +Lines: 1 +disabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/power/runtime_status +Lines: 1 +unsupported +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/power/runtime_suspended_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/power/runtime_usage +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/add_random +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/atomic_write_boundary_bytes +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/atomic_write_max_bytes +Lines: 1 +512 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/atomic_write_unit_max_bytes +Lines: 1 +512 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/atomic_write_unit_min_bytes +Lines: 1 +512 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/chunk_sectors +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/dax +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/discard_granularity +Lines: 1 +512 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/discard_max_bytes +Lines: 1 +2199023255040 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/discard_max_hw_bytes +Lines: 1 +2199023255040 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/discard_zeroes_data +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/dma_alignment +Lines: 1 +3 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/fua +Lines: 1 +1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/hw_sector_size +Lines: 1 +512 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/io_poll +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/io_poll_delay +Lines: 1 +-1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/io_timeout +Lines: 1 +30000 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/iostats +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/logical_block_size +Lines: 1 +512 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/max_discard_segments +Lines: 1 +256 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/max_hw_sectors_kb +Lines: 1 +128 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/max_integrity_segments +Lines: 1 +1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/max_sectors_kb +Lines: 1 +128 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/max_segment_size +Lines: 1 +4294967295 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/max_segments +Lines: 1 +33 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/minimum_io_size +Lines: 1 +512 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/nomerges +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/nr_requests +Lines: 1 +1023 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/nr_zones +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/optimal_io_size +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/physical_block_size +Lines: 1 +512 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/read_ahead_kb +Lines: 1 +128 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/rotational +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/rq_affinity +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/scheduler +Lines: 1 +[none] mq-deadline +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/stable_writes +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/virt_boundary_mask +Lines: 1 +4095 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/wbt_lat_usec +Lines: 1 +2000 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/write_cache +Lines: 1 +write back +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/write_same_max_bytes +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/write_zeroes_max_bytes +Lines: 1 +131072 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/zone_append_max_bytes +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/zone_write_granularity +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/queue/zoned +Lines: 1 +none +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/range +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/removable +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/ro +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/size +Lines: 1 +3907029168 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/slaves +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/stat +Lines: 1 + 61050 16774 4202091 25036 83902 46848 2302530 32404 0 20551 64225 46 0 5751632 80 3461 6703 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/subsystem +SymlinkTo: ../../../../../../../class/block +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/trace +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/trace/act_mask +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/trace/enable +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/trace/end_lba +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/trace/pid +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/trace/start_lba +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/uevent +Lines: 5 +MAJOR=259 +MINOR=0 +DEVNAME=nvme0n1 +DEVTYPE=disk +DISKSEQ=9 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/nvme0n1/wwid +Lines: 1 +nvme.c0a9-323332384536454444384137-435432303030503353534438-00000001 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/passthru_err_log_enabled +Lines: 1 +off +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/power +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/power/async +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/power/autosuspend_delay_ms +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/power/control +Lines: 1 +auto +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/power/pm_qos_latency_tolerance_us +Lines: 1 +100000 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/power/runtime_active_kids +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/power/runtime_active_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/power/runtime_enabled +Lines: 1 +disabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/power/runtime_status +Lines: 1 +unsupported +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/power/runtime_suspended_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/power/runtime_usage +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/queue_count +Lines: 1 +9 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/serial +Lines: 1 +2328E6EDD8A7 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/sqsize +Lines: 1 +1023 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/state +Lines: 1 +live +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/subsysnqn +Lines: 1 +nqn.2014.08.org.nvmexpress:c0a9c0a92328E6EDD8A7 CT2000P3SSD8 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/subsystem +SymlinkTo: ../../../../../../class/nvme +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/transport +Lines: 1 +pcie +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/nvme/nvme0/uevent +Lines: 4 +MAJOR=240 +MINOR=0 +DEVNAME=nvme0 +NVME_TRTYPE=pcie +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/pools +Lines: 3 +poolinfo - 0.1 +prp list 256 0 64 256 4 +prp list page 0 0 4096 0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/async +Lines: 1 +enabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/autosuspend_delay_ms +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/control +Lines: 1 +on +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/runtime_active_kids +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/runtime_active_time +Lines: 1 +3838519 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/runtime_enabled +Lines: 1 +forbidden +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/runtime_status +Lines: 1 +active +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/runtime_suspended_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/runtime_usage +Lines: 1 +2 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/wakeup +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/wakeup_abort_count +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/wakeup_active +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/wakeup_active_count +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/wakeup_count +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/wakeup_expire_count +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/wakeup_last_time_ms +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/wakeup_max_time_ms +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power/wakeup_total_time_ms +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/power_state +Lines: 1 +D0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/reset_method +Lines: 1 +flr bus +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/resource +Lines: 13 +0x00000000fd800000 0x00000000fd803fff 0x0000000000140204 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/revision +Lines: 1 +0x01 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/subsystem +SymlinkTo: ../../../../bus/pci +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/subsystem_device +Lines: 1 +0x5021 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/subsystem_vendor +Lines: 1 +0xc0a9 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/uevent +Lines: 6 +DRIVER=nvme +PCI_CLASS=10802 +PCI_ID=C0A9:540A +PCI_SUBSYS_ID=C0A9:5021 +PCI_SLOT_NAME=0000:01:00.0 +MODALIAS=pci:v0000C0A9d0000540Asv0000C0A9sd00005021bc01sc08i02 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/0000:01:00.0/vendor +Lines: 1 +0xc0a9 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/ari_enabled +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/broken_parity_status +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/class +Lines: 1 +0x060400 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/config +Lines: 1 +"4NULLBYTENULLBYTENULLBYTENULLBYTE�NULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTE�NULLBYTENULLBYTE������NULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTEPNULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTENULLBYTE�NULLBYTENULLBYTEEOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/consistent_dma_mask_bits +Lines: 1 +32 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/current_link_speed +Lines: 1 +8.0 GT/s PCIe +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/current_link_width +Lines: 1 +4 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/d3cold_allowed +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/device +Lines: 1 +0x1634 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/dma_mask_bits +Lines: 1 +32 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/driver +SymlinkTo: ../../../bus/pci/drivers/pcieport +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/driver_override +Lines: 1 +(null) +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/enable +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/firmware_node +SymlinkTo: ../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:16 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/iommu +SymlinkTo: ../0000:00:00.2/iommu/ivhd0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/iommu_group +SymlinkTo: ../../../kernel/iommu_groups/2 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/irq +Lines: 1 +39 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/link +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/local_cpulist +Lines: 1 +0-15 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/local_cpus +Lines: 1 +ffff +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/max_link_speed +Lines: 1 +8.0 GT/s PCIe +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/max_link_width +Lines: 1 +8 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/modalias +Lines: 1 +pci:v00001022d00001634sv000017AAsd00005095bc06sc04i00 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/msi_bus +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/msi_irqs +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/msi_irqs/39 +Lines: 1 +msi +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/numa_node +Lines: 1 +-1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/cpuaffinity +Lines: 1 +ffff +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/cpulistaffinity +Lines: 1 +0-15 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/device +SymlinkTo: ../../../0000:00:02.1 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/power +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/power/async +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/power/autosuspend_delay_ms +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/power/control +Lines: 1 +auto +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/power/runtime_active_kids +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/power/runtime_active_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/power/runtime_enabled +Lines: 1 +disabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/power/runtime_status +Lines: 1 +unsupported +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/power/runtime_suspended_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/power/runtime_usage +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/subsystem +SymlinkTo: ../../../../../class/pci_bus +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/pci_bus/0000:01/uevent +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/pci0000:00/0000:00:02.1/power +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/async +Lines: 1 +enabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/autosuspend_delay_ms +Lines: 1 +100 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/control +Lines: 1 +auto +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/runtime_active_kids +Lines: 1 +1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/runtime_active_time +Lines: 1 +3838515 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/runtime_enabled +Lines: 1 +enabled +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/runtime_status +Lines: 1 +active +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/runtime_suspended_time +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/runtime_usage +Lines: 1 +0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/wakeup +Lines: 1 +disabled +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/wakeup_abort_count +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/wakeup_active +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/wakeup_active_count +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/wakeup_count +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/wakeup_expire_count +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/wakeup_last_time_ms +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/wakeup_max_time_ms +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power/wakeup_total_time_ms +Lines: 1 + +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/power_state +Lines: 1 +D0 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/reset_method +Lines: 1 +pm +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/resource +Lines: 17 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x00000000fd800000 0x00000000fd8fffff 0x0000000000000200 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/revision +Lines: 1 +0x00 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/secondary_bus_number +Lines: 1 +1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/subordinate_bus_number +Lines: 1 +1 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/subsystem +SymlinkTo: ../../../bus/pci +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/subsystem_device +Lines: 1 +0x5095 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/subsystem_vendor +Lines: 1 +0x17aa +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/uevent +Lines: 6 +DRIVER=pcieport +PCI_CLASS=60400 +PCI_ID=1022:1634 +PCI_SUBSYS_ID=17AA:5095 +PCI_SLOT_NAME=0000:00:02.1 +MODALIAS=pci:v00001022d00001634sv000017AAsd00005095bc06sc04i00 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/pci0000:00/0000:00:02.1/vendor +Lines: 1 +0x1022 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/pci0000:00/0000:00:03.0 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 2b1359d69b2f07556684e6ead802bb8695c733a8 Mon Sep 17 00:00:00 2001 From: John Leslie Date: Thu, 3 Jul 2025 01:18:55 -0700 Subject: [PATCH 49/69] parse.go: fix GetDeviceInfo/LayoutGet ordering -- previously had values swapped (#726) Signed-off-by: John Leslie --- nfs/parse.go | 4 ++-- nfs/parse_nfs_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nfs/parse.go b/nfs/parse.go index 76e74cbc..1247ed24 100644 --- a/nfs/parse.go +++ b/nfs/parse.go @@ -236,8 +236,8 @@ func parseClientV4Stats(v []uint64) (ClientV4Stats, error) { Sequence: v[42], GetLeaseTime: v[43], ReclaimComplete: v[44], - LayoutGet: v[45], - GetDeviceInfo: v[46], + GetDeviceInfo: v[45], + LayoutGet: v[46], LayoutCommit: v[47], LayoutReturn: v[48], SecinfoNoName: v[49], diff --git a/nfs/parse_nfs_test.go b/nfs/parse_nfs_test.go index 8ebcfd16..9d38608d 100644 --- a/nfs/parse_nfs_test.go +++ b/nfs/parse_nfs_test.go @@ -38,7 +38,7 @@ func TestNewNFSClientRPCStats(t *testing.T) { rpc 1218785755 374636 1218815394 proc2 18 16 57 74 52 71 73 45 86 0 52 83 61 17 53 50 23 70 82 proc3 22 0 1061909262 48906 4077635 117661341 5 29391916 2570425 2993289 590 0 0 7815 15 1130 0 3983 92385 13332 2 1 23729 -proc4 48 98 51 54 83 85 23 24 1 28 73 68 83 12 84 39 68 59 58 88 29 74 69 96 21 84 15 53 86 54 66 56 97 36 49 32 85 81 11 58 32 67 13 28 35 90 1 26 1337 +proc4 48 98 51 54 83 85 23 24 1 28 73 68 83 12 84 39 68 59 58 88 29 74 69 96 21 84 15 53 86 54 66 56 97 36 49 32 85 81 11 58 32 67 13 28 35 1 90 26 1337 `, stats: &nfs.ClientRPCStats{ Network: nfs.Network{ @@ -140,8 +140,8 @@ proc4 48 98 51 54 83 85 23 24 1 28 73 68 83 12 84 39 68 59 58 88 29 74 69 96 21 Sequence: 13, GetLeaseTime: 28, ReclaimComplete: 35, - LayoutGet: 90, GetDeviceInfo: 1, + LayoutGet: 90, LayoutCommit: 26, LayoutReturn: 1337, SecinfoNoName: 0, @@ -266,8 +266,8 @@ proc4 61 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Sequence: 0, GetLeaseTime: 0, ReclaimComplete: 0, - LayoutGet: 0, GetDeviceInfo: 0, + LayoutGet: 0, LayoutCommit: 0, LayoutReturn: 0, SecinfoNoName: 0, From 0cf12345350bcfed988855df227682d185c8abb7 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Thu, 3 Jul 2025 10:51:39 +0200 Subject: [PATCH 50/69] Fix linting issue (#733) Fix Go doc linting error. Signed-off-by: SuperQ --- proc_statm.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proc_statm.go b/proc_statm.go index 0ebc2502..ed579842 100644 --- a/proc_statm.go +++ b/proc_statm.go @@ -24,7 +24,7 @@ import ( // - https://man7.org/linux/man-pages/man5/proc_pid_statm.5.html // ProcStatm Provides memory usage information for a process, measured in memory pages. -// read from /proc/[pid]/statm. +// Read from /proc/[pid]/statm. type ProcStatm struct { // The process ID. PID int From c5a546e343883072a55550b7de7ef7366d8e2e56 Mon Sep 17 00:00:00 2001 From: "Philipp B." Date: Thu, 3 Jul 2025 10:55:23 +0200 Subject: [PATCH 51/69] feat(mdstat): recognize reshape status (#679) Signed-off-by: Philipp Born --- mdstat.go | 5 ++++- mdstat_test.go | 15 +++++++++++++++ testdata/fixtures.ttar | 7 ++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/mdstat.go b/mdstat.go index 67a9d2b4..1fd4381b 100644 --- a/mdstat.go +++ b/mdstat.go @@ -123,13 +123,16 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { finish := float64(0) pct := float64(0) recovering := strings.Contains(lines[syncLineIdx], "recovery") + reshaping := strings.Contains(lines[syncLineIdx], "reshape") resyncing := strings.Contains(lines[syncLineIdx], "resync") checking := strings.Contains(lines[syncLineIdx], "check") // Append recovery and resyncing state info. - if recovering || resyncing || checking { + if recovering || resyncing || checking || reshaping { if recovering { state = "recovering" + } else if reshaping { + state = "reshaping" } else if checking { state = "checking" } else { diff --git a/mdstat_test.go b/mdstat_test.go index 7a577edc..7bcc96a6 100644 --- a/mdstat_test.go +++ b/mdstat_test.go @@ -283,6 +283,21 @@ func TestFS_MDStat(t *testing.T) { BlocksSyncedFinishTime: 0.2, BlocksSyncedSpeed: 114176, Devices: []string{"sda3", "sdb3"}}, + "md42": { + Name: "md42", + ActivityState: "reshaping", + DisksActive: 2, + DisksTotal: 3, + DisksFailed: 0, + DisksDown: 1, + DisksSpare: 1, + BlocksTotal: 1953381440, + BlocksSynced: 1096879076, + BlocksToBeSynced: 1953381440, + BlocksSyncedPct: 56.1, + BlocksSyncedFinishTime: 1868.1, + BlocksSyncedSpeed: 7640, + Devices: []string{"sda1", "sdd1", "sde1"}}, } if want, have := len(refs), len(mdStats); want != have { diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index 1ee91695..57928545 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -2432,7 +2432,7 @@ Lines: 1 Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/mdstat -Lines: 60 +Lines: 65 Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md3 : active raid6 sda1[8] sdh1[7] sdg1[6] sdf1[5] sde1[11] sdd1[3] sdc1[10] sdb1[9] sdd1[10](S) sdd2[11](S) @@ -2492,6 +2492,11 @@ md120 : active linear sda1[1] sdb1[0] md101 : active (read-only) raid0 sdb[2] sdd[1] sdc[0] 322560 blocks super 1.2 512k chunks +md42 : active raid5 sda1[3](S) sdd1[0] sde1[1] + 1953381440 blocks super 1.2 level 5, 64k chunk, algorithm 2 [3/2] [UU_] + [===========>.........] reshape = 56.1% (1096879076/1953381440) finish=1868.1min speed=7640K/sec + bitmap: 4/15 pages [16KB], 65536KB chunk + unused devices: Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From a5f79dd49ddb1a496da8472c5b09fa625ed3ab6b Mon Sep 17 00:00:00 2001 From: dasturiasArista Date: Thu, 3 Jul 2025 01:56:59 -0700 Subject: [PATCH 52/69] Nvidia/Mellanox expose ROCE ECN information on sysfs on the path (#695) /sys/class/net//ecn// There are 2 protocols Reaction Point (rp) and Notification point (np) For each of the protocols they have a list of attributes: /sys/class/net//ecn//params/ Each protocol will also if ECN is enabled per priority (where X is the priority): /sys/class/net//ecn//enable/X This is documented here https://docs.nvidia.com/networking/display/mlnxofedv571020/explicit+congestion+notification+(ecn) The attributes are documented here: https://enterprise-support.nvidia.com/s/article/dcqcn-parameters Signed-off-by: Diego Asturias --- sysfs/net_class_ecn.go | 387 ++++++++++++++++++++++++++++++++++++ sysfs/net_class_ecn_test.go | 102 ++++++++++ testdata/fixtures.ttar | 190 ++++++++++++++++++ 3 files changed, 679 insertions(+) create mode 100644 sysfs/net_class_ecn.go create mode 100644 sysfs/net_class_ecn_test.go diff --git a/sysfs/net_class_ecn.go b/sysfs/net_class_ecn.go new file mode 100644 index 00000000..b376c9e0 --- /dev/null +++ b/sysfs/net_class_ecn.go @@ -0,0 +1,387 @@ +// Copyright 2024 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package sysfs + +import ( + "fmt" + "os" + "path/filepath" + "strconv" + + "github.com/prometheus/procfs/internal/util" +) + +// Documentation of the sysfs path +// https://docs.nvidia.com/networking/display/mlnxofedv571020/explicit+congestion+notification+(ecn) +// https://enterprise-support.nvidia.com/s/article/dcqcn-parameters + +// Ecn contains values from /sys/class/net//ecn/roce_np/ +// for single interface (iface). +type RoceNpEcn struct { + // A map from a priority to it's enabled status + Ecn map[uint8]bool + // Minimum time between sending CNPs from the port, in microseconds. + // Range: 0-4095, Default: 4 + MinTimeBetweenCnps uint64 + // The DSCP value for CNPs. + // Range: 0-63, Default: 48 + CnpDscp uint64 + // The PCP value for CNPs. + // Range: 0-7, Default: 6 + Cnp802pPriority uint64 +} + +// Ecn contains values from /sys/class/net//ecn/roce_rp/ +// for single interface (iface). +type RoceRpEcn struct { + // A map from a priority to it's enabled status + Ecn map[uint8]bool + + // Alpha Update + + // Every Alpha Update Period alpha is updated. + // If the CNP is received during this period, alpha is incremented. + // Otherwise, it is decremented. + // Range: 0-1023, Default: 1019 + DceTCPG uint64 + // The Alpha Update Period used in the formula for DceTCPG. Unit is microseconds. + // Range: 1-131071, Default: 1 + DceTCPRtt uint64 + // This parameter sets the initial value of alpha that should be used when receiving + // the first CNP for a flow. Fixed point with 10 bits in the fraction part. + // Range: 1-1023, Default: 1023 + InitialAlphaValue uint64 + + // Rate Decrease + + // Rates (current, target) on first CNP (0 – 85% of line rate) in Mbps. + // Range: 0, 1-line rate, Default: 0 + RateToSetOnFirstCnp uint64 + // This parameter defines the maximal ratio of rate decrease in a single event. + // Range: 0-100, Default: 50 + RpgMinDecFac uint64 + // This parameter defines the minimal rate limit of the QP in Mbps. + // Range: 1-line rate, Default: 1 + RpgMinRate uint64 + // The coefficient between alpha and the rate reduction factor. + // Range: 10-11, Default: 11 + RpgGd uint64 + // The time period between rate reductions in microseconds. + // Range: 0-UINT32, Default: 4 + RateReduceMonitorPeriod uint64 + + // Rate Increase + + // If set, every rate decreases. The target rate is updated to the current rate. + // Otherwise, the target rate is updated to the current rate only on the first + // decrement after the increment event. + ClampTgtRate bool + // The time period between rate increase events in microseconds. + // Range: 1-131071, Default: 300 + RpgTimeReset uint64 + // The sent bytes counter between rate increase events. + // Range: 1-32767, Default: 32767 + RpgByteReset uint64 + // The threshold of rate increase events for moving to next rate increase phase. + // Range: 1-31, Default: 1 + RpgThreshold uint64 + // The rate increase value in the Additive Increase phase in Mbps. + // Range: 1-line rate, Default: 5 + RpgAiRate uint64 + // The rate increase value in the Hyper Increase phase in Mbps. + // Range: 1-line rate, Default: 1 + RpgHaiRate uint64 +} + +// EcnIface contains Ecn info from files in /sys/class/net//ecn/ +// for single interface (iface). +type EcnIface struct { + Name string // Interface name + // protocols + RoceNpEcn RoceNpEcn // Notification point + RoceRpEcn RoceRpEcn // Reaction point +} + +// AllEcnIface is collection of Ecn info for every interface (iface) in /sys/class/net. +// The map keys are interface (iface) names. +type AllEcnIface map[string]EcnIface + +// EcnByIface returns info for a single net interfaces (iface). +func (fs FS) EcnByIface(devicePath string) (*EcnIface, error) { + _, err := fs.NetClassByIface(devicePath) + if err != nil { + return nil, err + } + + path := fs.sys.Path(netclassPath) + ecnPath := filepath.Join(path, devicePath, "ecn") + validPath, err := PathExistsAndIsDir(ecnPath) + if err != nil { + return nil, err + } + if !validPath { + // this device doesn't have ECN values at this path + return nil, fmt.Errorf("Does not have ECN values: %q", devicePath) + } + + ecnIface, err := ParseEcnIfaceInfo(ecnPath) + if err != nil { + return nil, err + } + ecnIface.Name = devicePath + + return ecnIface, nil +} + +// EcnDevices returns EcnIface for all net interfaces (iface) read from /sys/class/net//ecn. +func (fs FS) EcnDevices() (AllEcnIface, error) { + devices, err := fs.NetClassDevices() + if err != nil { + return nil, err + } + + path := fs.sys.Path(netclassPath) + allEcnIface := AllEcnIface{} + for _, devicePath := range devices { + ecnPath := filepath.Join(path, devicePath, "ecn") + validPath, err := PathExistsAndIsDir(ecnPath) + if err != nil { + return nil, err + } + if !validPath { + // this device doesn't have ECN values at this path + continue + } + ecnIface, err := ParseEcnIfaceInfo(ecnPath) + if err != nil { + return nil, err + } + ecnIface.Name = devicePath + allEcnIface[devicePath] = *ecnIface + } + + return allEcnIface, nil +} + +// ParseEcnIfaceInfo scans predefined files in /sys/class/net//ecn +// directory and gets their contents. +func ParseEcnIfaceInfo(ecnPath string) (*EcnIface, error) { + ecnIface := EcnIface{} + err := ParseRoceNpEcnInfo(filepath.Join(ecnPath, "roce_np"), &ecnIface.RoceNpEcn) + if err != nil { + return nil, err + } + + err = ParseRoceRpEcnInfo(filepath.Join(ecnPath, "roce_rp"), &ecnIface.RoceRpEcn) + if err != nil { + return nil, err + } + + return &ecnIface, nil +} + +// ParseEcnIfaceInfo scans predefined files in /sys/class/net//ecn/roce_np/ +// directory and gets their contents. +func ParseRoceNpEcnInfo(ecnPath string, ecn *RoceNpEcn) error { + value, err := ParseEcnEnable(filepath.Join(ecnPath, "enable")) + if err != nil { + return err + } + ecn.Ecn = value + + files, err := os.ReadDir(ecnPath) + if err != nil { + return err + } + + for _, f := range files { + if !f.Type().IsRegular() { + continue + } + if err := ParseRoceNpEcnAttribute(ecnPath, f.Name(), ecn); err != nil { + return err + } + } + return nil +} + +// Parses all of the attributes in for ROCE NP protocol. +func ParseRoceNpEcnAttribute(ecnPath string, attrName string, ecn *RoceNpEcn) error { + attrPath := filepath.Join(ecnPath, attrName) + value, err := util.SysReadFile(attrPath) + if err != nil { + if canIgnoreError(err) { + return nil + } + return fmt.Errorf("failed to read file %q: %w", attrPath, err) + } + + vp := util.NewValueParser(value) + switch attrName { + case "min_time_between_cnps": + ecn.MinTimeBetweenCnps = *vp.PUInt64() + case "cnp_802p_prio": + ecn.Cnp802pPriority = *vp.PUInt64() + case "cnp_dscp": + ecn.CnpDscp = *vp.PUInt64() + default: + return nil + } + + return nil +} + +// ParseRoceRpEcnInfo scans predefined files in /sys/class/net//ecn/roce_rp/ +// directory and gets their contents. +func ParseRoceRpEcnInfo(ecnPath string, ecn *RoceRpEcn) error { + value, err := ParseEcnEnable(filepath.Join(ecnPath, "enable")) + if err != nil { + return err + } + ecn.Ecn = value + + files, err := os.ReadDir(ecnPath) + if err != nil { + return err + } + + for _, f := range files { + if !f.Type().IsRegular() { + continue + } + if err := ParseRoceRpEcnAttribute(ecnPath, f.Name(), ecn); err != nil { + return err + } + } + return nil +} + +// Parses all of the attributes in for ROCE RP protocol. +func ParseRoceRpEcnAttribute(ecnPath string, attrName string, ecn *RoceRpEcn) error { + attrPath := filepath.Join(ecnPath, attrName) + value, err := util.SysReadFile(attrPath) + if err != nil { + if canIgnoreError(err) { + return nil + } + return fmt.Errorf("failed to read file %q: %w", attrPath, err) + } + + vp := util.NewValueParser(value) + switch attrName { + case "clamp_tgt_rate": + if *vp.PUInt64() == 0 { + ecn.ClampTgtRate = false + } else if *vp.PUInt64() == 1 { + ecn.ClampTgtRate = true + } else { + return fmt.Errorf("failed to parse file %q: %w", attrPath, err) + } + case "dce_tcp_g": + ecn.DceTCPG = *vp.PUInt64() + case "dce_tcp_rtt": + ecn.DceTCPRtt = *vp.PUInt64() + case "initial_alpha_value": + ecn.InitialAlphaValue = *vp.PUInt64() + case "rate_reduce_monitor_period": + ecn.RateReduceMonitorPeriod = *vp.PUInt64() + case "rate_to_set_on_first_cnp": + ecn.RateToSetOnFirstCnp = *vp.PUInt64() + case "rpg_ai_rate": + ecn.RpgAiRate = *vp.PUInt64() + case "rpg_byte_reset": + ecn.RpgByteReset = *vp.PUInt64() + case "rpg_gd": + ecn.RpgGd = *vp.PUInt64() + case "rpg_hai_rate": + ecn.RpgHaiRate = *vp.PUInt64() + case "rpg_min_dec_fac": + ecn.RpgMinDecFac = *vp.PUInt64() + case "rpg_min_rate": + ecn.RpgMinRate = *vp.PUInt64() + case "rpg_threshold": + ecn.RpgThreshold = *vp.PUInt64() + case "rpg_time_reset": + ecn.RpgTimeReset = *vp.PUInt64() + default: + return nil + } + + return nil +} + +// parses the ECN enable directory. It takes a path which should be a directory. +// This directory should have filenames that are uint8 and the content of the file is +// either 0 or 1. +func ParseEcnEnable(path string) (map[uint8]bool, error) { + // Read the files in the directory + files, err := os.ReadDir(path) + if err != nil { + return nil, err + } + + ecn := make(map[uint8]bool) + // Iterate through each file in the directory + for _, file := range files { + // Only process files (skip directories) + if file.IsDir() { + continue + } + + // Extract the file name (which should be the integer key) + filename := file.Name() + + // Attempt to convert the file name to an integer + filenameInt, err := strconv.ParseUint(filename, 10, 8) + if err != nil { + // Skip the file if the name cannot be converted to an integer + continue + } + + value, err := util.SysReadFile(filepath.Join(path, filename)) + if err != nil { + if canIgnoreError(err) { + return nil, err + } + return nil, fmt.Errorf("failed to read file %q: %w", filename, err) + } + + vp := util.NewValueParser(value) + fileValue := *vp.PUInt64() + if fileValue == 0 { + ecn[uint8(filenameInt)] = false + } else if fileValue == 1 { + ecn[uint8(filenameInt)] = true + } else { + return nil, fmt.Errorf("failed to parse file %q: %q", filename, value) + } + } + + return ecn, nil +} + +// Utility function that given a path will return if the path is a dir or not. +func PathExistsAndIsDir(path string) (bool, error) { + info, err := os.Stat(path) + if err != nil { + if os.IsNotExist(err) { + return false, nil // Path does not exist + } + return false, err // Some other error occurred + } + return info.IsDir(), nil // Check if the path is a directory +} diff --git a/sysfs/net_class_ecn_test.go b/sysfs/net_class_ecn_test.go new file mode 100644 index 00000000..3f501b70 --- /dev/null +++ b/sysfs/net_class_ecn_test.go @@ -0,0 +1,102 @@ +// Copyright 2024 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package sysfs + +import ( + "reflect" + "testing" +) + +func TestEcnByIface(t *testing.T) { + fs, err := NewFS(sysTestFixtures) + if err != nil { + t.Fatal(err) + } + + _, err = fs.EcnByIface("non-existent") + if err == nil { + t.Fatal("expected error, have none") + } + + device, err := fs.EcnByIface("eth0") + if err != nil { + t.Fatal(err) + } + + if device.Name != "eth0" { + t.Errorf("Found unexpected device, want %s, have %s", "eth0", device.Name) + } +} + +func TestEcnDevices(t *testing.T) { + fs, err := NewFS(sysTestFixtures) + if err != nil { + t.Fatal(err) + } + + ed, _ := fs.EcnDevices() + allEcnDevices := AllEcnIface{ + "eth0": EcnIface{ + Name: "eth0", + RoceNpEcn: RoceNpEcn{ + Ecn: map[uint8]bool{ + 0: true, + 1: true, + 2: false, + 3: true, + 4: true, + 5: false, + 6: true, + 7: true, + }, + MinTimeBetweenCnps: 4, + CnpDscp: 48, + Cnp802pPriority: 6, + }, + RoceRpEcn: RoceRpEcn{ + Ecn: map[uint8]bool{ + 0: true, + 1: true, + 2: false, + 3: true, + 4: true, + 5: false, + 6: true, + 7: false, + }, + DceTCPG: 1019, + DceTCPRtt: 1, + InitialAlphaValue: 1023, + RateToSetOnFirstCnp: 10, + RpgMinDecFac: 50, + RpgMinRate: 1, + RpgGd: 11, + RateReduceMonitorPeriod: 4, + ClampTgtRate: true, + RpgTimeReset: 300, + RpgByteReset: 32767, + RpgThreshold: 1, + RpgAiRate: 5, + RpgHaiRate: 50, + }, + }, + } + + if !reflect.DeepEqual(ed, allEcnDevices) { + t.Errorf("Result not correct: want %v, have %v", allEcnDevices, ed) + } +} diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index 57928545..5e5a3735 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -6354,6 +6354,196 @@ Lines: 1 full Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/net/eth0/ecn +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/net/eth0/ecn/roce_np +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_np/cnp_802p_prio +Lines: 1 +6 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_np/cnp_dscp +Lines: 1 +48 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/net/eth0/ecn/roce_np/enable +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_np/enable/0 +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_np/enable/1 +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_np/enable/2 +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_np/enable/3 +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_np/enable/4 +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_np/enable/5 +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_np/enable/6 +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_np/enable/7 +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_np/min_time_between_cnps +Lines: 1 +4 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/net/eth0/ecn/roce_rp +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/clamp_tgt_rate +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/clamp_tgt_rate_after_time_inc +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/dce_tcp_g +Lines: 1 +1019 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/dce_tcp_rtt +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/net/eth0/ecn/roce_rp/enable +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/enable/0 +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/enable/1 +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/enable/2 +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/enable/3 +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/enable/4 +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/enable/5 +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/enable/6 +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/enable/7 +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/initial_alpha_value +Lines: 1 +1023 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/rate_reduce_monitor_period +Lines: 1 +4 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/rate_to_set_on_first_cnp +Lines: 1 +10 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/rpg_ai_rate +Lines: 1 +5 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/rpg_byte_reset +Lines: 1 +32767 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/rpg_gd +Lines: 1 +11 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/rpg_hai_rate +Lines: 1 +50 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/rpg_max_rate +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/rpg_min_dec_fac +Lines: 1 +50 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/rpg_min_rate +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/rpg_threshold +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/net/eth0/ecn/roce_rp/rpg_time_reset +Lines: 1 +300 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/net/eth0/flags Lines: 1 0x1303 From 0bcdc45697732e8d3baf0ea742e47d5c9585de11 Mon Sep 17 00:00:00 2001 From: Navid Yaghoobi Date: Thu, 3 Jul 2025 19:27:31 +1000 Subject: [PATCH 53/69] added zswap, zswapped, secpagetables, filehugepages, hugetlb and unaccepted to meminfo (#655) Signed-off-by: Navid Yaghoobi --- meminfo.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/meminfo.go b/meminfo.go index 4b2c4050..937e1f96 100644 --- a/meminfo.go +++ b/meminfo.go @@ -66,6 +66,10 @@ type Meminfo struct { // Memory which has been evicted from RAM, and is temporarily // on the disk SwapFree *uint64 + // Memory consumed by the zswap backend (compressed size) + Zswap *uint64 + // Amount of anonymous memory stored in zswap (original size) + Zswapped *uint64 // Memory which is waiting to get written back to the disk Dirty *uint64 // Memory which is actively being written back to the disk @@ -85,6 +89,8 @@ type Meminfo struct { // amount of memory dedicated to the lowest level of page // tables. PageTables *uint64 + // secondary page tables. + SecPageTables *uint64 // NFS pages sent to the server, but not yet committed to // stable storage NFSUnstable *uint64 @@ -129,15 +135,18 @@ type Meminfo struct { Percpu *uint64 HardwareCorrupted *uint64 AnonHugePages *uint64 + FileHugePages *uint64 ShmemHugePages *uint64 ShmemPmdMapped *uint64 CmaTotal *uint64 CmaFree *uint64 + Unaccepted *uint64 HugePagesTotal *uint64 HugePagesFree *uint64 HugePagesRsvd *uint64 HugePagesSurp *uint64 Hugepagesize *uint64 + Hugetlb *uint64 DirectMap4k *uint64 DirectMap2M *uint64 DirectMap1G *uint64 @@ -161,6 +170,8 @@ type Meminfo struct { MlockedBytes *uint64 SwapTotalBytes *uint64 SwapFreeBytes *uint64 + ZswapBytes *uint64 + ZswappedBytes *uint64 DirtyBytes *uint64 WritebackBytes *uint64 AnonPagesBytes *uint64 @@ -171,6 +182,7 @@ type Meminfo struct { SUnreclaimBytes *uint64 KernelStackBytes *uint64 PageTablesBytes *uint64 + SecPageTablesBytes *uint64 NFSUnstableBytes *uint64 BounceBytes *uint64 WritebackTmpBytes *uint64 @@ -182,11 +194,14 @@ type Meminfo struct { PercpuBytes *uint64 HardwareCorruptedBytes *uint64 AnonHugePagesBytes *uint64 + FileHugePagesBytes *uint64 ShmemHugePagesBytes *uint64 ShmemPmdMappedBytes *uint64 CmaTotalBytes *uint64 CmaFreeBytes *uint64 + UnacceptedBytes *uint64 HugepagesizeBytes *uint64 + HugetlbBytes *uint64 DirectMap4kBytes *uint64 DirectMap2MBytes *uint64 DirectMap1GBytes *uint64 @@ -287,6 +302,12 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { case "SwapFree:": m.SwapFree = &val m.SwapFreeBytes = &valBytes + case "Zswap:": + m.Zswap = &val + m.ZswapBytes = &valBytes + case "Zswapped:": + m.Zswapped = &val + m.ZswapBytes = &valBytes case "Dirty:": m.Dirty = &val m.DirtyBytes = &valBytes @@ -317,6 +338,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { case "PageTables:": m.PageTables = &val m.PageTablesBytes = &valBytes + case "SecPageTables:": + m.SecPageTables = &val + m.SecPageTablesBytes = &valBytes case "NFS_Unstable:": m.NFSUnstable = &val m.NFSUnstableBytes = &valBytes @@ -350,6 +374,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { case "AnonHugePages:": m.AnonHugePages = &val m.AnonHugePagesBytes = &valBytes + case "FileHugePages:": + m.FileHugePages = &val + m.FileHugePagesBytes = &valBytes case "ShmemHugePages:": m.ShmemHugePages = &val m.ShmemHugePagesBytes = &valBytes @@ -362,6 +389,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { case "CmaFree:": m.CmaFree = &val m.CmaFreeBytes = &valBytes + case "Unaccepted:": + m.Unaccepted = &val + m.UnacceptedBytes = &valBytes case "HugePages_Total:": m.HugePagesTotal = &val case "HugePages_Free:": @@ -373,6 +403,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { case "Hugepagesize:": m.Hugepagesize = &val m.HugepagesizeBytes = &valBytes + case "Hugetlb:": + m.Hugetlb = &val + m.HugetlbBytes = &valBytes case "DirectMap4k:": m.DirectMap4k = &val m.DirectMap4kBytes = &valBytes From ee6ea54565148540b80e46685baaa9c506eb1486 Mon Sep 17 00:00:00 2001 From: Pierre Gimalac Date: Thu, 3 Jul 2025 11:28:00 +0200 Subject: [PATCH 54/69] feat: parse StartCode, EndCode, and StartStack in /proc/pid/stat (#659) Signed-off-by: Pierre Gimalac --- proc_stat.go | 12 +++++++++--- proc_stat_test.go | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/proc_stat.go b/proc_stat.go index 06a8d931..3328556b 100644 --- a/proc_stat.go +++ b/proc_stat.go @@ -101,6 +101,12 @@ type ProcStat struct { RSS int // Soft limit in bytes on the rss of the process. RSSLimit uint64 + // The address above which program text can run. + StartCode uint64 + // The address below which program text can run. + EndCode uint64 + // The address of the start (i.e., bottom) of the stack. + StartStack uint64 // CPU number last executed on. Processor uint // Real-time scheduling priority, a number in the range 1 to 99 for processes @@ -177,9 +183,9 @@ func (p Proc) Stat() (ProcStat, error) { &s.VSize, &s.RSS, &s.RSSLimit, - &ignoreUint64, - &ignoreUint64, - &ignoreUint64, + &s.StartCode, + &s.EndCode, + &s.StartStack, &ignoreUint64, &ignoreUint64, &ignoreUint64, diff --git a/proc_stat_test.go b/proc_stat_test.go index 8abd67f6..6cfa1cc4 100644 --- a/proc_stat_test.go +++ b/proc_stat_test.go @@ -55,6 +55,9 @@ func TestProcStat(t *testing.T) { have uint64 }{ {name: "RSS Limit", want: 18446744073709551615, have: s.RSSLimit}, + {name: "Start Code", want: 4194304, have: s.StartCode}, + {name: "End Code", want: 6294284, have: s.EndCode}, + {name: "Start Stack", want: 140736914091744, have: s.StartStack}, {name: "delayacct_blkio_ticks", want: 31, have: s.DelayAcctBlkIOTicks}, } { if test.want != test.have { From 61fb25b82034264056d6c202558bfd43c3322f05 Mon Sep 17 00:00:00 2001 From: Diego Sonaglia Date: Thu, 3 Jul 2025 11:38:30 +0200 Subject: [PATCH 55/69] Add node_guid to infiniband class (#665) (#670) Signed-off-by: Diego Sonaglia --- sysfs/class_infiniband.go | 5 ++++- sysfs/class_infiniband_test.go | 1 + testdata/fixtures.ttar | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sysfs/class_infiniband.go b/sysfs/class_infiniband.go index 30d1d3f0..3cd1095e 100644 --- a/sysfs/class_infiniband.go +++ b/sysfs/class_infiniband.go @@ -125,6 +125,7 @@ type InfiniBandDevice struct { Name string BoardID string // /sys/class/infiniband//board_id FirmwareVersion string // /sys/class/infiniband//fw_ver + NodeGUID string // /sys/class/infiniband//node_guid HCAType string // /sys/class/infiniband//hca_type Ports map[uint]InfiniBandPort } @@ -172,7 +173,7 @@ func (fs FS) parseInfiniBandDevice(name string) (*InfiniBandDevice, error) { device.FirmwareVersion = value // Not all InfiniBand drivers expose all of these. - for _, f := range [...]string{"board_id", "hca_type"} { + for _, f := range [...]string{"board_id", "hca_type", "node_guid"} { name := filepath.Join(path, f) value, err := util.SysReadFile(name) if err != nil { @@ -187,6 +188,8 @@ func (fs FS) parseInfiniBandDevice(name string) (*InfiniBandDevice, error) { device.BoardID = value case "hca_type": device.HCAType = value + case "node_guid": + device.NodeGUID = value } } diff --git a/sysfs/class_infiniband_test.go b/sysfs/class_infiniband_test.go index 461e2805..c61e8bfb 100644 --- a/sysfs/class_infiniband_test.go +++ b/sysfs/class_infiniband_test.go @@ -272,6 +272,7 @@ func TestInfiniBandClass(t *testing.T) { BoardID: "SM_2001000001034", FirmwareVersion: "14.28.2006", HCAType: "MT4118", + NodeGUID: "0a7f:bc12:45ef:d23b", Ports: map[uint]InfiniBandPort{ 1: { Name: "mlx5_0", diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index 5e5a3735..bae3dd16 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -6033,6 +6033,11 @@ Lines: 1 MT4118 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx5_0/node_guid +Lines: 1 +0a7f:bc12:45ef:d23bEOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/infiniband/mlx5_0/ports Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 61fe41207276bc95c4c391762e9ef137385e8a5d Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Thu, 3 Jul 2025 11:39:02 +0200 Subject: [PATCH 56/69] Fix linting issues (#734) Fixup linting issues in `sysfs/net_class_ecn.go`. Signed-off-by: SuperQ --- sysfs/net_class_ecn.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sysfs/net_class_ecn.go b/sysfs/net_class_ecn.go index b376c9e0..51d93e73 100644 --- a/sysfs/net_class_ecn.go +++ b/sysfs/net_class_ecn.go @@ -135,7 +135,7 @@ func (fs FS) EcnByIface(devicePath string) (*EcnIface, error) { } if !validPath { // this device doesn't have ECN values at this path - return nil, fmt.Errorf("Does not have ECN values: %q", devicePath) + return nil, fmt.Errorf("does not have ECN values: %q", devicePath) } ecnIface, err := ParseEcnIfaceInfo(ecnPath) @@ -362,11 +362,12 @@ func ParseEcnEnable(path string) (map[uint8]bool, error) { vp := util.NewValueParser(value) fileValue := *vp.PUInt64() - if fileValue == 0 { + switch fileValue { + case 0: ecn[uint8(filenameInt)] = false - } else if fileValue == 1 { + case 1: ecn[uint8(filenameInt)] = true - } else { + default: return nil, fmt.Errorf("failed to parse file %q: %q", filename, value) } } From 0d1fd88ede6254517cd323b9d688e3ff23f79094 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Sat, 2 Aug 2025 07:36:17 +0200 Subject: [PATCH 57/69] chore: clean up golangci-lint configuration (#720) Signed-off-by: Matthieu MOREL --- .golangci.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 3c3bf910..fdd4eb41 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -19,16 +19,12 @@ linters: misspell: locale: US exclusions: - generated: lax presets: - comments - common-false-positives - legacy - std-error-handling - paths: - - third_party$ - - builtin$ - - examples$ + warn-unused: true formatters: enable: - gofmt @@ -37,9 +33,3 @@ formatters: goimports: local-prefixes: - github.com/prometheus/procfs - exclusions: - generated: lax - paths: - - third_party$ - - builtin$ - - examples$ From 53e9e6772ade719daba4f16d7d9f007997b532a3 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Sat, 2 Aug 2025 10:17:35 +0200 Subject: [PATCH 58/69] chore: enable errorlint linter (#742) Signed-off-by: Matthieu MOREL --- .golangci.yml | 1 + blockdevice/stats_test.go | 6 ++++-- proc.go | 2 +- stat.go | 3 ++- sysfs/net_class_aer.go | 4 ++-- sysfs/system_cpu_test.go | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index fdd4eb41..1867f739 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,7 @@ version: "2" linters: enable: + - errorlint - forbidigo - godot - misspell diff --git a/blockdevice/stats_test.go b/blockdevice/stats_test.go index 0bd6016b..f352680f 100644 --- a/blockdevice/stats_test.go +++ b/blockdevice/stats_test.go @@ -14,6 +14,7 @@ package blockdevice import ( + "errors" "os" "reflect" "testing" @@ -181,9 +182,10 @@ func TestBlockDmInfo(t *testing.T) { dm1Info, err := blockdevice.SysBlockDeviceMapperInfo(devices[1]) if err != nil { - if _, ok := err.(*os.PathError); ok { + var pErr *os.PathError + if errors.As(err, &pErr) { // Fail the test if there's an error other than PathError. - if !os.IsNotExist(err) { + if !os.IsNotExist(pErr) { t.Fatal(err) } } else { diff --git a/proc.go b/proc.go index 368187fa..c3531c5d 100644 --- a/proc.go +++ b/proc.go @@ -49,7 +49,7 @@ func (p Procs) Less(i, j int) bool { return p[i].PID < p[j].PID } // Self returns a process for the current process read via /proc/self. func Self() (Proc, error) { fs, err := NewFS(DefaultMountPoint) - if err != nil || errors.Unwrap(err) == ErrMountPoint { + if err != nil || errors.Is(err, ErrMountPoint) { return Proc{}, err } return fs.Self() diff --git a/stat.go b/stat.go index e36b41c1..69cfc5ac 100644 --- a/stat.go +++ b/stat.go @@ -16,6 +16,7 @@ package procfs import ( "bufio" "bytes" + "errors" "fmt" "io" "strconv" @@ -92,7 +93,7 @@ func parseCPUStat(line string) (CPUStat, int64, error) { &cpuStat.Iowait, &cpuStat.IRQ, &cpuStat.SoftIRQ, &cpuStat.Steal, &cpuStat.Guest, &cpuStat.GuestNice) - if err != nil && err != io.EOF { + if err != nil && !errors.Is(err, io.EOF) { return CPUStat{}, -1, fmt.Errorf("%w: couldn't parse %q (cpu): %w", ErrFileParse, line, err) } if count == 0 { diff --git a/sysfs/net_class_aer.go b/sysfs/net_class_aer.go index c99539c6..84ff56f7 100644 --- a/sysfs/net_class_aer.go +++ b/sysfs/net_class_aer.go @@ -154,7 +154,7 @@ func parseCorrectableAerCounters(devicePath string, counters *CorrectableAerCoun counterName := fields[0] value, err := strconv.ParseUint(fields[1], 10, 64) if err != nil { - return fmt.Errorf("error parsing value for %s: %v", counterName, err) + return fmt.Errorf("error parsing value for %s: %w", counterName, err) } switch counterName { @@ -206,7 +206,7 @@ func parseUncorrectableAerCounters(devicePath string, counterType string, counterName := fields[0] value, err := strconv.ParseUint(fields[1], 10, 64) if err != nil { - return fmt.Errorf("error parsing value for %s: %v", counterName, err) + return fmt.Errorf("error parsing value for %s: %w", counterName, err) } switch counterName { diff --git a/sysfs/system_cpu_test.go b/sysfs/system_cpu_test.go index a39c5709..beecb408 100644 --- a/sysfs/system_cpu_test.go +++ b/sysfs/system_cpu_test.go @@ -225,7 +225,7 @@ func TestIsolatedParsingCPU(t *testing.T) { if err != nil && params.err != nil && err.Error() != params.err.Error() { t.Fatalf("should have '%v' error: got '%v'", params.err, err) } - if (err == nil || params.err == nil) && err != params.err { + if (err == nil || params.err == nil) && !errors.Is(err, params.err) { t.Fatalf("should have %v error: got %v", params.err, err) } From 56c0445b99031d4be1fe3e1a4171ba0375e3fd15 Mon Sep 17 00:00:00 2001 From: "zhiyuan.zhou" Date: Thu, 3 Jul 2025 21:10:11 +0800 Subject: [PATCH 59/69] Modify proc_statm_test notes * Modify proc_statm_test notes Signed-off-by: zhiyuan.zhou --- proc_statm_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proc_statm_test.go b/proc_statm_test.go index 8d2c651d..2c45e00b 100644 --- a/proc_statm_test.go +++ b/proc_statm_test.go @@ -51,7 +51,7 @@ func TestProcStatmLimits(t *testing.T) { t.Fatal(err) } - // max values of stat int fields + // max values of statm int fields for _, test := range []struct { name string want uint64 From ff79b1224cce1f96665464988983fb0b2ce4b162 Mon Sep 17 00:00:00 2001 From: dongjiang Date: Mon, 21 Jul 2025 18:57:56 +0800 Subject: [PATCH 60/69] add hung_task_detect_count Signed-off-by: dongjiang --- kernel_hung.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ kernel_hung_test.go | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 kernel_hung.go create mode 100644 kernel_hung_test.go diff --git a/kernel_hung.go b/kernel_hung.go new file mode 100644 index 00000000..9b13cc29 --- /dev/null +++ b/kernel_hung.go @@ -0,0 +1,45 @@ +// Copyright 2025 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !windows +// +build !windows + +package procfs + +import ( + "os" + "strconv" + "strings" +) + +// KernelHung contains information about to the kernel's hung_task_detect_count number. +type KernelHung struct { + // Indicates the total number of tasks that have been detected as hung since the system boot. + // This file shows up if `CONFIG_DETECT_HUNG_TASK` is enabled. + HungTaskDetectCount *uint64 +} + +// KernelHung returns values from /proc/sys/kernel/hung_task_detect_count. +func (fs FS) KernelHung() (KernelHung, error) { + data, err := os.ReadFile(fs.proc.Path("sys", "kernel", "hung_task_detect_count")) + if err != nil { + return KernelHung{}, err + } + val, err := strconv.ParseUint(strings.TrimSpace(string(data)), 10, 64) + if err != nil { + return KernelHung{}, err + } + return KernelHung{ + HungTaskDetectCount: &val, + }, nil +} diff --git a/kernel_hung_test.go b/kernel_hung_test.go new file mode 100644 index 00000000..569f13e3 --- /dev/null +++ b/kernel_hung_test.go @@ -0,0 +1,37 @@ +// Copyright 2025 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !windows +// +build !windows + +package procfs + +import ( + "testing" +) + +func TestKernelHung(t *testing.T) { + fs, err := NewFS(procfsFixtures) + if err != nil { + t.Fatalf("failed to access %s: %v", procfsFixtures, err) + } + + hung, err := fs.KernelHung() + if err != nil { + t.Fatalf("failed to collect %s/sys/kernel/hung_task_detect_count: %v", procfsFixtures, err) + } + + if *hung.HungTaskDetectCount != 6 { + t.Errorf("hung_task_detect_count, want %d got %d", 6, *hung.HungTaskDetectCount) + } +} From fe2a91d2777d1393cb53faef6f7003c87682838d Mon Sep 17 00:00:00 2001 From: dongjiang1989 Date: Mon, 21 Jul 2025 19:06:36 +0800 Subject: [PATCH 61/69] update testdata Signed-off-by: dongjiang1989 --- testdata/fixtures.ttar | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testdata/fixtures.ttar b/testdata/fixtures.ttar index bae3dd16..276bf95c 100644 --- a/testdata/fixtures.ttar +++ b/testdata/fixtures.ttar @@ -3398,6 +3398,11 @@ Mode: 755 Directory: fixtures/proc/sys/kernel Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/sys/kernel/hung_task_detect_count +Lines: 1 +6 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/sys/kernel/random Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 91dd824c7faa747f0606ab7d699f1f4bea14fbed Mon Sep 17 00:00:00 2001 From: prombot Date: Wed, 9 Jul 2025 17:51:03 +0000 Subject: [PATCH 62/69] Update common Prometheus files Signed-off-by: prombot --- Makefile.common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.common b/Makefile.common index 4de21512..6f61bec4 100644 --- a/Makefile.common +++ b/Makefile.common @@ -139,7 +139,7 @@ common-deps: update-go-deps: @echo ">> updating Go dependencies" @for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \ - $(GO) get -d $$m; \ + $(GO) get $$m; \ done $(GO) mod tidy From 1cf85054c1f6445e003fb8ebded02504a6654fa6 Mon Sep 17 00:00:00 2001 From: Lukas Zapletal Date: Tue, 5 Aug 2025 10:02:28 +0200 Subject: [PATCH 63/69] net_dev_snmp6: directory traversal Fix a theoretical directory traversal to silence security scanners in our vendor/ directory. Signed-off-by: Lukas Zapletal --- net_dev_snmp6.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net_dev_snmp6.go b/net_dev_snmp6.go index f50b38e3..8a8f3e66 100644 --- a/net_dev_snmp6.go +++ b/net_dev_snmp6.go @@ -18,6 +18,7 @@ import ( "errors" "io" "os" + "path/filepath" "strconv" "strings" ) @@ -56,7 +57,9 @@ func newNetDevSNMP6(dir string) (NetDevSNMP6, error) { } for _, iFaceFile := range ifaceFiles { - f, err := os.Open(dir + "/" + iFaceFile.Name()) + filePath := filepath.Join(dir, iFaceFile.Name()) + + f, err := os.Open(filePath) if err != nil { return netDevSNMP6, err } From 420c8cccbb57f603855b14bdba7aa166c3a1642f Mon Sep 17 00:00:00 2001 From: hrtbrock <103686821+hrtbrock@users.noreply.github.com> Date: Fri, 17 Oct 2025 07:21:31 -0500 Subject: [PATCH 64/69] Continue on EINVAL for sas_phy sysfs files (#749) Signed-off-by: Brock Johnson --- sysfs/class_sas_phy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sysfs/class_sas_phy.go b/sysfs/class_sas_phy.go index 67bd7a68..c49df184 100644 --- a/sysfs/class_sas_phy.go +++ b/sysfs/class_sas_phy.go @@ -17,11 +17,13 @@ package sysfs import ( + "errors" "fmt" "os" "path/filepath" "strconv" "strings" + "syscall" "github.com/prometheus/procfs/internal/util" ) @@ -97,7 +99,7 @@ func (fs FS) parseSASPhy(name string) (*SASPhy, error) { if fileinfo.Mode().IsRegular() { value, err := util.SysReadFile(name) if err != nil { - if os.IsPermission(err) { + if os.IsPermission(err) || errors.Is(err, syscall.EINVAL) { continue } return nil, fmt.Errorf("failed to read file %q: %w", name, err) From ab5187b9e2d587d40de44d9411e8b2d9f83a91ee Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 17 Oct 2025 18:30:13 +0200 Subject: [PATCH 65/69] Add compact metrics to vmstat (#754) Signed-off-by: Charles --- sysfs/vmstat_numa.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sysfs/vmstat_numa.go b/sysfs/vmstat_numa.go index 038a0ee3..ace7317c 100644 --- a/sysfs/vmstat_numa.go +++ b/sysfs/vmstat_numa.go @@ -86,6 +86,9 @@ type VMStat struct { NrKernelMiscReclaimable uint64 NrFollPinAcquired uint64 NrFollPinReleased uint64 + CompactStall uint64 + CompactFail uint64 + CompactSuccess uint64 } func (fs FS) VMStatNUMA() (map[int]VMStat, error) { @@ -242,6 +245,12 @@ func parseVMStatNUMA(r []byte) (VMStat, error) { vmStat.NrFollPinAcquired = fv case "nr_foll_pin_released": vmStat.NrFollPinReleased = fv + case "compact_stall": + vmStat.CompactStall = fv + case "compact_fail": + vmStat.CompactFail = fv + case "compact_success": + vmStat.CompactSuccess = fv } } From 2f4b14c60834b36dc8a5e7fd6b9da54d4993ee73 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Sat, 18 Oct 2025 09:23:15 +0100 Subject: [PATCH 66/69] Update supported Go versions. (#755) * Update minimum supported version to 1.24.0. * Update CI tests for latest Go versions. * Run Go modernize. Signed-off-by: SuperQ --- .circleci/config.yml | 6 +++--- blockdevice/stats.go | 3 +-- buddyinfo.go | 2 +- go.mod | 2 +- mountinfo.go | 3 +-- mountstats.go | 2 +- net_protocols.go | 2 +- net_sockstat.go | 3 --- net_unix_test.go | 2 +- proc_maps64_test.go | 4 ++-- proc_smaps_test.go | 3 +-- proc_statm.go | 2 +- proc_status.go | 7 +++---- sysfs/class_sas_device.go | 13 +++++-------- sysfs/class_sas_host.go | 13 +++++-------- sysfs/class_sas_port.go | 19 +++++++------------ sysfs/net_class_aer.go | 4 ++-- sysfs/system_cpu.go | 4 ++-- zoneinfo.go | 6 ++---- 19 files changed, 40 insertions(+), 60 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 19a082bf..273d1829 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ version: 2.1 jobs: lint: docker: - - image: cimg/go:1.24 + - image: cimg/go:1.25 steps: - checkout - run: make check_license @@ -46,8 +46,8 @@ workflows: matrix: parameters: go_version: - - "1.23" - "1.24" + - "1.25" - test: name: test-windows os: windows @@ -55,5 +55,5 @@ workflows: matrix: parameters: go_version: - - "1.23" - "1.24" + - "1.25" diff --git a/blockdevice/stats.go b/blockdevice/stats.go index 277f2428..593a142f 100644 --- a/blockdevice/stats.go +++ b/blockdevice/stats.go @@ -425,8 +425,7 @@ func (fs FS) SysBlockDeviceQueueStats(device string) (BlockQueueStats, error) { return BlockQueueStats{}, err } var schedulers []string - xs := strings.Split(scheduler, " ") - for _, s := range xs { + for s := range strings.SplitSeq(scheduler, " ") { if strings.HasPrefix(s, "[") && strings.HasSuffix(s, "]") { s = s[1 : len(s)-1] stat.SchedulerCurrent = s diff --git a/buddyinfo.go b/buddyinfo.go index 83807500..20b162d7 100644 --- a/buddyinfo.go +++ b/buddyinfo.go @@ -71,7 +71,7 @@ func parseBuddyInfo(r io.Reader) ([]BuddyInfo, error) { } sizes := make([]float64, arraySize) - for i := 0; i < arraySize; i++ { + for i := range arraySize { sizes[i], err = strconv.ParseFloat(parts[i+4], 64) if err != nil { return nil, fmt.Errorf("%w: Invalid valid in buddyinfo: %f: %w", ErrFileParse, sizes[i], err) diff --git a/go.mod b/go.mod index e8254697..33dbc60f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/prometheus/procfs -go 1.23.0 +go 1.24.0 require ( github.com/google/go-cmp v0.7.0 diff --git a/mountinfo.go b/mountinfo.go index a704c5e7..089faf55 100644 --- a/mountinfo.go +++ b/mountinfo.go @@ -147,8 +147,7 @@ func mountOptionsParseOptionalFields(o []string) (map[string]string, error) { // mountOptionsParser parses the mount options, superblock options. func mountOptionsParser(mountOptions string) map[string]string { opts := make(map[string]string) - options := strings.Split(mountOptions, ",") - for _, opt := range options { + for opt := range strings.SplitSeq(mountOptions, ",") { splitOption := strings.Split(opt, "=") if len(splitOption) < 2 { key := splitOption[0] diff --git a/mountstats.go b/mountstats.go index 50caa732..1d502fd5 100644 --- a/mountstats.go +++ b/mountstats.go @@ -383,7 +383,7 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e if stats.Opts == nil { stats.Opts = map[string]string{} } - for _, opt := range strings.Split(ss[1], ",") { + for opt := range strings.SplitSeq(ss[1], ",") { split := strings.Split(opt, "=") if len(split) == 2 { stats.Opts[split[0]] = split[1] diff --git a/net_protocols.go b/net_protocols.go index 8d4b1ac0..10bec479 100644 --- a/net_protocols.go +++ b/net_protocols.go @@ -169,7 +169,7 @@ func (pc *NetProtocolCapabilities) parseCapabilities(capabilities []string) erro &pc.EnterMemoryPressure, } - for i := 0; i < len(capabilities); i++ { + for i := range capabilities { switch capabilities[i] { case "y": *capabilityFields[i] = true diff --git a/net_sockstat.go b/net_sockstat.go index fae62b13..e4cccc21 100644 --- a/net_sockstat.go +++ b/net_sockstat.go @@ -139,9 +139,6 @@ func parseSockstatKVs(kvs []string) (map[string]int, error) { func parseSockstatProtocol(kvs map[string]int) NetSockstatProtocol { var nsp NetSockstatProtocol for k, v := range kvs { - // Capture the range variable to ensure we get unique pointers for - // each of the optional fields. - v := v switch k { case "inuse": nsp.InUse = v diff --git a/net_unix_test.go b/net_unix_test.go index 2de59bbf..70be9db3 100644 --- a/net_unix_test.go +++ b/net_unix_test.go @@ -108,7 +108,7 @@ func testNetUNIX(t *testing.T, testInode bool, got *NetUNIX) { // Enable the fixtures to be used for multiple tests by clearing the inode // field when appropriate. if !testInode { - for i := 0; i < len(want); i++ { + for i := range want { want[i].Inode = 0 } } diff --git a/proc_maps64_test.go b/proc_maps64_test.go index 44ec68c4..b69c9fc7 100644 --- a/proc_maps64_test.go +++ b/proc_maps64_test.go @@ -147,7 +147,7 @@ func BenchmarkParseAddress(b *testing.B) { s, e uintptr err error ) - for i := 0; i < b.N; i++ { + for b.Loop() { s, e, err = parseAddresses("7f7d7469e000-7f7d746a0000") if err != nil { b.Fatal(err) @@ -166,7 +166,7 @@ func BenchmarkParseDevice(b *testing.B) { d uint64 err error ) - for i := 0; i < b.N; i++ { + for b.Loop() { d, err = parseDevice("00:22") if err != nil { b.Fatal(err) diff --git a/proc_smaps_test.go b/proc_smaps_test.go index b11b98fe..ceca358a 100644 --- a/proc_smaps_test.go +++ b/proc_smaps_test.go @@ -31,8 +31,7 @@ func BenchmarkProcSMapsRollup(b *testing.B) { b.Fatal(err) } - b.ResetTimer() - for n := 0; n < b.N; n++ { + for b.Loop() { _, _ = p.ProcSMapsRollup() } } diff --git a/proc_statm.go b/proc_statm.go index ed579842..45ffc2e8 100644 --- a/proc_statm.go +++ b/proc_statm.go @@ -80,7 +80,7 @@ func (p Proc) Statm() (ProcStatm, error) { func parseStatm(data []byte) ([]uint64, error) { var statmSlice []uint64 statmItems := strings.Fields(string(data)) - for i := 0; i < len(statmItems); i++ { + for i := range statmItems { statmItem, err := strconv.ParseUint(statmItems[i], 10, 64) if err != nil { return nil, err diff --git a/proc_status.go b/proc_status.go index dd8aa568..c7b32db3 100644 --- a/proc_status.go +++ b/proc_status.go @@ -16,7 +16,7 @@ package procfs import ( "bytes" "math/bits" - "sort" + "slices" "strconv" "strings" @@ -94,8 +94,7 @@ func (p Proc) NewStatus() (ProcStatus, error) { s := ProcStatus{PID: p.PID} - lines := strings.Split(string(data), "\n") - for _, line := range lines { + for line := range strings.SplitSeq(string(data), "\n") { if !bytes.Contains([]byte(line), []byte(":")) { continue } @@ -222,7 +221,7 @@ func calcCpusAllowedList(cpuString string) []uint64 { } - sort.Slice(g, func(i, j int) bool { return g[i] < g[j] }) + slices.Sort(g) return g } diff --git a/sysfs/class_sas_device.go b/sysfs/class_sas_device.go index 644cdc08..3a857ae2 100644 --- a/sysfs/class_sas_device.go +++ b/sysfs/class_sas_device.go @@ -20,6 +20,7 @@ import ( "os" "path/filepath" "regexp" + "slices" "github.com/prometheus/procfs/internal/util" ) @@ -185,10 +186,8 @@ func (sdc *SASDeviceClass) GetByName(name string) *SASDevice { // GetByPhy finds the SASDevice that contains the provided PHY name. func (sdc *SASDeviceClass) GetByPhy(name string) *SASDevice { for _, d := range *sdc { - for _, p := range d.SASPhys { - if p == name { - return d - } + if slices.Contains(d.SASPhys, name) { + return d } } return nil @@ -197,10 +196,8 @@ func (sdc *SASDeviceClass) GetByPhy(name string) *SASDevice { // GetByPort finds the SASDevice that contains the provided SAS Port name. func (sdc *SASDeviceClass) GetByPort(name string) *SASDevice { for _, d := range *sdc { - for _, p := range d.SASPorts { - if p == name { - return d - } + if slices.Contains(d.SASPorts, name) { + return d } } return nil diff --git a/sysfs/class_sas_host.go b/sysfs/class_sas_host.go index fade1ca6..3daeca45 100644 --- a/sysfs/class_sas_host.go +++ b/sysfs/class_sas_host.go @@ -20,6 +20,7 @@ import ( "os" "path/filepath" "regexp" + "slices" ) const sasHostClassPath = "class/sas_host" @@ -100,10 +101,8 @@ func (shc *SASHostClass) GetByName(hostName string) *SASHost { // GetByPhy finds the SASHost that contains the provided PHY name. func (shc *SASHostClass) GetByPhy(phyName string) *SASHost { for _, h := range *shc { - for _, p := range h.SASPhys { - if p == phyName { - return h - } + if slices.Contains(h.SASPhys, phyName) { + return h } } return nil @@ -112,10 +111,8 @@ func (shc *SASHostClass) GetByPhy(phyName string) *SASHost { // GetByPort finds the SASHost that contains the provided SAS Port name. func (shc *SASHostClass) GetByPort(portName string) *SASHost { for _, h := range *shc { - for _, p := range h.SASPorts { - if p == portName { - return h - } + if slices.Contains(h.SASPorts, portName) { + return h } } return nil diff --git a/sysfs/class_sas_port.go b/sysfs/class_sas_port.go index 7afe251c..06b30ed0 100644 --- a/sysfs/class_sas_port.go +++ b/sysfs/class_sas_port.go @@ -20,6 +20,7 @@ import ( "os" "path/filepath" "regexp" + "slices" ) const sasPortClassPath = "class/sas_port" @@ -105,10 +106,8 @@ func (spc *SASPortClass) GetByName(name string) *SASPort { // GetByPhy finds the SASPort that contains the provided PHY name. func (spc *SASPortClass) GetByPhy(name string) *SASPort { for _, d := range *spc { - for _, p := range d.SASPhys { - if p == name { - return d - } + if slices.Contains(d.SASPhys, name) { + return d } } return nil @@ -117,10 +116,8 @@ func (spc *SASPortClass) GetByPhy(name string) *SASPort { // GetByExpander finds the SASPort that contains the provided SAS expander name. func (spc *SASPortClass) GetByExpander(name string) *SASPort { for _, d := range *spc { - for _, e := range d.Expanders { - if e == name { - return d - } + if slices.Contains(d.Expanders, name) { + return d } } return nil @@ -129,10 +126,8 @@ func (spc *SASPortClass) GetByExpander(name string) *SASPort { // GetByEndDevice finds the SASPort that contains the provided SAS end device name. func (spc *SASPortClass) GetByEndDevice(name string) *SASPort { for _, d := range *spc { - for _, e := range d.EndDevices { - if e == name { - return d - } + if slices.Contains(d.EndDevices, name) { + return d } } return nil diff --git a/sysfs/net_class_aer.go b/sysfs/net_class_aer.go index 84ff56f7..04c4c4ee 100644 --- a/sysfs/net_class_aer.go +++ b/sysfs/net_class_aer.go @@ -143,7 +143,7 @@ func parseCorrectableAerCounters(devicePath string, counters *CorrectableAerCoun return fmt.Errorf("failed to read file %q: %w", path, err) } - for _, line := range strings.Split(string(value), "\n") { + for line := range strings.SplitSeq(string(value), "\n") { if line == "" { continue } @@ -195,7 +195,7 @@ func parseUncorrectableAerCounters(devicePath string, counterType string, return fmt.Errorf("failed to read file %q: %w", path, err) } - for _, line := range strings.Split(string(value), "\n") { + for line := range strings.SplitSeq(string(value), "\n") { if line == "" { continue } diff --git a/sysfs/system_cpu.go b/sysfs/system_cpu.go index a4b2c9ea..a5e6f69b 100644 --- a/sysfs/system_cpu.go +++ b/sysfs/system_cpu.go @@ -326,7 +326,7 @@ func parseCpufreqCpuinfo(cpuPath string) (*SystemCPUCpufreqStats, error) { } } else { cpuinfoFrequencyDuration = &map[uint64]uint64{} - for _, line := range strings.Split(string(cpuinfoFrequencyDurationString), "\n") { + for line := range strings.SplitSeq(string(cpuinfoFrequencyDurationString), "\n") { if line == "" { continue } @@ -409,7 +409,7 @@ func parseCPURange(data []byte) ([]uint16, error) { var cpusInt = []uint16{} - for _, cpu := range strings.Split(strings.TrimSuffix(string(data), "\n"), ",") { + for cpu := range strings.SplitSeq(strings.TrimSuffix(string(data), "\n"), ",") { if cpu == "" { continue } diff --git a/zoneinfo.go b/zoneinfo.go index e54d94b0..f832d4ce 100644 --- a/zoneinfo.go +++ b/zoneinfo.go @@ -88,11 +88,9 @@ func parseZoneinfo(zoneinfoData []byte) ([]Zoneinfo, error) { zoneinfo := []Zoneinfo{} - zoneinfoBlocks := bytes.Split(zoneinfoData, []byte("\nNode")) - for _, block := range zoneinfoBlocks { + for block := range bytes.SplitSeq(zoneinfoData, []byte("\nNode")) { var zoneinfoElement Zoneinfo - lines := strings.Split(string(block), "\n") - for _, line := range lines { + for line := range strings.SplitSeq(string(block), "\n") { if nodeZone := nodeZoneRE.FindStringSubmatch(line); nodeZone != nil { zoneinfoElement.Node = nodeZone[1] From 38a61f65d514f8c5fda457d6b294813da037450c Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Sat, 18 Oct 2025 10:23:59 +0200 Subject: [PATCH 67/69] chore: enable several rules from go-critic (#741) * chore: enable-all rules from go-critic Signed-off-by: Matthieu MOREL * chore: enable assignOp rule from go-critic Signed-off-by: Matthieu MOREL * chore: enable captLocal rule from go-critic Signed-off-by: Matthieu MOREL * chore: enable elseif rule from go-critic Signed-off-by: Matthieu MOREL * chore: enable emptyStringTest rule from go-critic Signed-off-by: Matthieu MOREL * chore: enable ifElseChain rule from go-critic Signed-off-by: Matthieu MOREL * chore: enable regexpSimplify rule from go-critic Signed-off-by: Matthieu MOREL * chore: enable stringsCompare rule from go-critic Signed-off-by: Matthieu MOREL * chore: enable stringXbytes rule from go-critic Signed-off-by: Matthieu MOREL * chore: enable sloppyReassign rule from go-critic Signed-off-by: Matthieu MOREL --------- Signed-off-by: Matthieu MOREL --- .golangci.yml | 15 +++++++++++++++ arp.go | 7 ++++--- bcache/get.go | 2 +- buddyinfo.go | 6 ++---- fscache.go | 7 ++++--- iscsi/get.go | 4 ++-- mdstat.go | 9 +++++---- proc_cgroups.go | 6 +++--- proc_fdinfo.go | 11 ++++++----- proc_limits.go | 2 +- sysfs/class_sas_device.go | 2 +- sysfs/class_scsitape.go | 4 ++-- sysfs/class_thermal.go | 7 ++++--- sysfs/net_class.go | 11 ++++++----- sysfs/net_class_ecn.go | 7 ++++--- sysfs/system_cpu.go | 12 +++++++----- sysfs/vmstat_numa.go | 2 +- 17 files changed, 68 insertions(+), 46 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 1867f739..23ecd450 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,6 +3,7 @@ linters: enable: - errorlint - forbidigo + - gocritic - godot - misspell - revive @@ -12,6 +13,20 @@ linters: forbid: - pattern: ^fmt\.Print.*$ msg: Do not commit print statements. + gocritic: + enable-all: true + disabled-checks: + - commentFormatting + - commentedOutCode + - deferInLoop + - filepathJoin + - hugeParam + - importShadow + - paramTypeCombine + - rangeValCopy + - tooManyResultsChecker + - unnamedResult + - whyNoLint godot: exclude: # Ignore "See: URL". diff --git a/arp.go b/arp.go index 2e533441..0c7e6c68 100644 --- a/arp.go +++ b/arp.go @@ -73,15 +73,16 @@ func parseARPEntries(data []byte) ([]ARPEntry, error) { columns := strings.Fields(line) width := len(columns) - if width == expectedHeaderWidth || width == 0 { + switch width { + case expectedHeaderWidth, 0: continue - } else if width == expectedDataWidth { + case expectedDataWidth: entry, err := parseARPEntry(columns) if err != nil { return []ARPEntry{}, fmt.Errorf("%w: Failed to parse ARP entry: %v: %w", ErrFileParse, entry, err) } entries = append(entries, entry) - } else { + default: return []ARPEntry{}, fmt.Errorf("%w: %d columns found, but expected %d: %w", ErrFileParse, width, expectedDataWidth, err) } diff --git a/bcache/get.go b/bcache/get.go index de018df0..7e28ebee 100644 --- a/bcache/get.go +++ b/bcache/get.go @@ -111,7 +111,7 @@ func parsePseudoFloat(str string) (float64, error) { // v4.12-rc3). // Restore the proper order: - fracPart = fracPart / 10.24 + fracPart /= 10.24 return intPart + fracPart, nil } diff --git a/buddyinfo.go b/buddyinfo.go index 20b162d7..422f919e 100644 --- a/buddyinfo.go +++ b/buddyinfo.go @@ -64,10 +64,8 @@ func parseBuddyInfo(r io.Reader) ([]BuddyInfo, error) { if bucketCount == -1 { bucketCount = arraySize - } else { - if bucketCount != arraySize { - return nil, fmt.Errorf("%w: mismatch in number of buddyinfo buckets, previous count %d, new count %d", ErrFileParse, bucketCount, arraySize) - } + } else if bucketCount != arraySize { + return nil, fmt.Errorf("%w: mismatch in number of buddyinfo buckets, previous count %d, new count %d", ErrFileParse, bucketCount, arraySize) } sizes := make([]float64, arraySize) diff --git a/fscache.go b/fscache.go index 7db86330..d0011006 100644 --- a/fscache.go +++ b/fscache.go @@ -388,20 +388,21 @@ func parseFscacheinfo(r io.Reader) (*Fscacheinfo, error) { } } case "CacheOp:": - if strings.Split(fields[1], "=")[0] == "alo" { + switch strings.Split(fields[1], "=")[0] { + case "alo": err := setFSCacheFields(fields[1:], &m.CacheopAllocationsinProgress, &m.CacheopLookupObjectInProgress, &m.CacheopLookupCompleteInPorgress, &m.CacheopGrabObjectInProgress) if err != nil { return &m, err } - } else if strings.Split(fields[1], "=")[0] == "inv" { + case "inv": err := setFSCacheFields(fields[1:], &m.CacheopInvalidations, &m.CacheopUpdateObjectInProgress, &m.CacheopDropObjectInProgress, &m.CacheopPutObjectInProgress, &m.CacheopAttributeChangeInProgress, &m.CacheopSyncCacheInProgress) if err != nil { return &m, err } - } else { + default: err := setFSCacheFields(fields[1:], &m.CacheopReadOrAllocPageInProgress, &m.CacheopReadOrAllocPagesInProgress, &m.CacheopAllocatePageInProgress, &m.CacheopAllocatePagesInProgress, &m.CacheopWritePagesInProgress, &m.CacheopUncachePagesInProgress, &m.CacheopDissociatePagesInProgress) diff --git a/iscsi/get.go b/iscsi/get.go index 1a77c8c5..f0bb9a86 100644 --- a/iscsi/get.go +++ b/iscsi/get.go @@ -208,7 +208,7 @@ func (fs FS) GetRBDMatch(rbdNumber string, poolImage string) (*RBD, error) { } systemImage = strings.TrimSpace(string(bSystemImage)) - if strings.Compare(strconv.FormatInt(int64(systemRbdNumber), 10), rbdNumber) == 0 && + if strconv.FormatInt(int64(systemRbdNumber), 10) == rbdNumber && matchPoolImage(systemPool, systemImage, poolImage) { rbd.Pool = systemPool rbd.Image = systemImage @@ -241,5 +241,5 @@ func (fs FS) GetRDMCPPath(rdmcpNumber string, objectName string) (*RDMCP, error) func matchPoolImage(pool string, image string, matchPoolImage string) (isEqual bool) { var poolImage = fmt.Sprintf("%s-%s", pool, image) - return strings.Compare(poolImage, matchPoolImage) == 0 + return poolImage == matchPoolImage } diff --git a/mdstat.go b/mdstat.go index 1fd4381b..6a0c0de1 100644 --- a/mdstat.go +++ b/mdstat.go @@ -129,13 +129,14 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { // Append recovery and resyncing state info. if recovering || resyncing || checking || reshaping { - if recovering { + switch { + case recovering: state = "recovering" - } else if reshaping { + case reshaping: state = "reshaping" - } else if checking { + case checking: state = "checking" - } else { + default: state = "resyncing" } diff --git a/proc_cgroups.go b/proc_cgroups.go index 5dd49389..e93a466a 100644 --- a/proc_cgroups.go +++ b/proc_cgroups.go @@ -40,13 +40,13 @@ type CgroupSummary struct { // parseCgroupSummary parses each line of the /proc/cgroup file // Line format is `subsys_name hierarchy num_cgroups enabled`. -func parseCgroupSummaryString(CgroupSummaryStr string) (*CgroupSummary, error) { +func parseCgroupSummaryString(cgroupSummaryStr string) (*CgroupSummary, error) { var err error - fields := strings.Fields(CgroupSummaryStr) + fields := strings.Fields(cgroupSummaryStr) // require at least 4 fields if len(fields) < 4 { - return nil, fmt.Errorf("%w: 4+ fields required, found %d fields in cgroup info string: %s", ErrFileParse, len(fields), CgroupSummaryStr) + return nil, fmt.Errorf("%w: 4+ fields required, found %d fields in cgroup info string: %s", ErrFileParse, len(fields), cgroupSummaryStr) } CgroupSummary := &CgroupSummary{ diff --git a/proc_fdinfo.go b/proc_fdinfo.go index fa761b35..594616cd 100644 --- a/proc_fdinfo.go +++ b/proc_fdinfo.go @@ -60,15 +60,16 @@ func (p Proc) FDInfo(fd string) (*ProcFDInfo, error) { scanner := bufio.NewScanner(bytes.NewReader(data)) for scanner.Scan() { text = scanner.Text() - if rPos.MatchString(text) { + switch { + case rPos.MatchString(text): pos = rPos.FindStringSubmatch(text)[1] - } else if rFlags.MatchString(text) { + case rFlags.MatchString(text): flags = rFlags.FindStringSubmatch(text)[1] - } else if rMntID.MatchString(text) { + case rMntID.MatchString(text): mntid = rMntID.FindStringSubmatch(text)[1] - } else if rIno.MatchString(text) { + case rIno.MatchString(text): ino = rIno.FindStringSubmatch(text)[1] - } else if rInotify.MatchString(text) { + case rInotify.MatchString(text): newInotify, err := parseInotifyInfo(text) if err != nil { return nil, err diff --git a/proc_limits.go b/proc_limits.go index 9530b14b..79a4b94b 100644 --- a/proc_limits.go +++ b/proc_limits.go @@ -74,7 +74,7 @@ const ( ) var ( - limitsMatch = regexp.MustCompile(`(Max \w+\s{0,1}?\w*\s{0,1}\w*)\s{2,}(\w+)\s+(\w+)`) + limitsMatch = regexp.MustCompile(`(Max \w+\s??\w*\s?\w*)\s{2,}(\w+)\s+(\w+)`) ) // NewLimits returns the current soft limits of the process. diff --git a/sysfs/class_sas_device.go b/sysfs/class_sas_device.go index 3a857ae2..d2781283 100644 --- a/sysfs/class_sas_device.go +++ b/sysfs/class_sas_device.go @@ -43,7 +43,7 @@ type SASDeviceClass map[string]*SASDevice var ( sasTargetDeviceRegexp = regexp.MustCompile(`^target[0-9:]+$`) - sasTargetSubDeviceRegexp = regexp.MustCompile(`[0-9]+:.*`) + sasTargetSubDeviceRegexp = regexp.MustCompile(`\d+:.*`) ) // sasDeviceClasses reads all of the SAS devices from a specific set diff --git a/sysfs/class_scsitape.go b/sysfs/class_scsitape.go index 7355d64a..e2505250 100644 --- a/sysfs/class_scsitape.go +++ b/sysfs/class_scsitape.go @@ -59,10 +59,10 @@ func (fs FS) SCSITapeClass() (SCSITapeClass, error) { // There are n?st[0-9]+[a-b]? variants depending on device features. // n/2 is probably overestimated but never underestimated stc := make(SCSITapeClass, len(dirs)/2) - validDevice := regexp.MustCompile(`^st[0-9]+$`) + validDevice := regexp.MustCompile(`^st\d+$`) for _, d := range dirs { - if !validDevice.Match([]byte(d.Name())) { + if !validDevice.MatchString(d.Name()) { continue } tape, err := fs.parseSCSITape(d.Name()) diff --git a/sysfs/class_thermal.go b/sysfs/class_thermal.go index 19706c0b..7bf67762 100644 --- a/sysfs/class_thermal.go +++ b/sysfs/class_thermal.go @@ -86,11 +86,12 @@ func parseClassThermalZone(zone string) (ClassThermalZoneStats, error) { var zonePassive *uint64 passive, err := util.SysReadUintFromFile(filepath.Join(zone, "passive")) - if os.IsNotExist(err) || os.IsPermission(err) { + switch { + case os.IsNotExist(err), os.IsPermission(err): zonePassive = nil - } else if err != nil { + case err != nil: return ClassThermalZoneStats{}, err - } else { + default: zonePassive = &passive } diff --git a/sysfs/net_class.go b/sysfs/net_class.go index 20a06122..4ab27241 100644 --- a/sysfs/net_class.go +++ b/sysfs/net_class.go @@ -125,15 +125,16 @@ func (fs FS) NetClass() (NetClass, error) { func canIgnoreError(err error) bool { var errno syscall.Errno - if os.IsNotExist(err) { + switch { + case os.IsNotExist(err): return true - } else if os.IsPermission(err) { + case os.IsPermission(err): return true - } else if err.Error() == "operation not supported" { + case err.Error() == "operation not supported": return true - } else if errors.Is(err, os.ErrInvalid) { + case errors.Is(err, os.ErrInvalid): return true - } else if errors.As(err, &errno) && (errno == syscall.EINVAL) { + case errors.As(err, &errno) && (errno == syscall.EINVAL): return true } // all other errors are fatal diff --git a/sysfs/net_class_ecn.go b/sysfs/net_class_ecn.go index 51d93e73..48b839d5 100644 --- a/sysfs/net_class_ecn.go +++ b/sysfs/net_class_ecn.go @@ -284,11 +284,12 @@ func ParseRoceRpEcnAttribute(ecnPath string, attrName string, ecn *RoceRpEcn) er vp := util.NewValueParser(value) switch attrName { case "clamp_tgt_rate": - if *vp.PUInt64() == 0 { + switch *vp.PUInt64() { + case 0: ecn.ClampTgtRate = false - } else if *vp.PUInt64() == 1 { + case 1: ecn.ClampTgtRate = true - } else { + default: return fmt.Errorf("failed to parse file %q: %w", attrPath, err) } case "dce_tcp_g": diff --git a/sysfs/system_cpu.go b/sysfs/system_cpu.go index a5e6f69b..7bc20311 100644 --- a/sysfs/system_cpu.go +++ b/sysfs/system_cpu.go @@ -172,11 +172,12 @@ func binSearch(elem uint16, elemSlice *[]uint16) bool { for start <= end { mid = (start + end) / 2 - if (*elemSlice)[mid] == elem { + switch { + case (*elemSlice)[mid] == elem: return true - } else if (*elemSlice)[mid] > elem { + case (*elemSlice)[mid] > elem: end = mid - 1 - } else if (*elemSlice)[mid] < elem { + case (*elemSlice)[mid] < elem: start = mid + 1 } } @@ -254,7 +255,8 @@ func (fs FS) SystemCpufreq() ([]SystemCPUCpufreqStats, error) { }) } - if err = g.Wait(); err != nil { + err = g.Wait() + if err != nil { return nil, err } @@ -364,7 +366,7 @@ func parseCpufreqCpuinfo(cpuPath string) (*SystemCPUCpufreqStats, error) { fields[0] = strings.TrimSuffix(fields[0], ":") cpuinfoTransitionTableRow := make([]uint64, len(fields)) for i := range fields { - if len(fields[i]) == 0 { + if fields[i] == "" { continue } f, err := strconv.ParseUint(fields[i], 10, 64) diff --git a/sysfs/vmstat_numa.go b/sysfs/vmstat_numa.go index ace7317c..ad502b26 100644 --- a/sysfs/vmstat_numa.go +++ b/sysfs/vmstat_numa.go @@ -30,7 +30,7 @@ import ( var ( nodePattern = "devices/system/node/node[0-9]*" - nodeNumberRegexp = regexp.MustCompile(`.*devices/system/node/node([0-9]*)`) + nodeNumberRegexp = regexp.MustCompile(`.*devices/system/node/node(\d*)`) ) type VMStat struct { From 4a665d52d0c12a518ffb3e5c90f023328330b378 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 18 Oct 2025 11:22:12 +0200 Subject: [PATCH 68/69] build(deps): bump golang.org/x/sync from 0.15.0 to 0.17.0 (#751) Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.15.0 to 0.17.0. - [Commits](https://github.com/golang/sync/compare/v0.15.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-version: 0.17.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 33dbc60f..43d06df0 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.24.0 require ( github.com/google/go-cmp v0.7.0 - golang.org/x/sync v0.15.0 + golang.org/x/sync v0.17.0 golang.org/x/sys v0.33.0 ) diff --git a/go.sum b/go.sum index 2143357f..3d7ab67d 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= -golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= From d9fdbb463c2094f201dd4374360b036f35e2b2b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 18 Oct 2025 12:06:46 +0200 Subject: [PATCH 69/69] build(deps): bump golang.org/x/sys from 0.33.0 to 0.36.0 (#752) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.33.0 to 0.36.0. - [Commits](https://github.com/golang/sys/compare/v0.33.0...v0.36.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-version: 0.36.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 43d06df0..757df4b3 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.24.0 require ( github.com/google/go-cmp v0.7.0 golang.org/x/sync v0.17.0 - golang.org/x/sys v0.33.0 + golang.org/x/sys v0.37.0 ) diff --git a/go.sum b/go.sum index 3d7ab67d..d872d9cd 100644 --- a/go.sum +++ b/go.sum @@ -2,5 +2,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= -golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= +golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=