1
0

build: import GetPersistentVolumeClass from component-helpers

Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
This commit is contained in:
Yonatan Kahana
2022-04-02 01:07:15 +03:00
parent 23794089df
commit 9015173f00
92 changed files with 868 additions and 18248 deletions

View File

@@ -16,7 +16,6 @@ package procfs
import (
"bufio"
"bytes"
"fmt"
"regexp"
"github.com/prometheus/procfs/internal/util"
@@ -24,11 +23,10 @@ import (
// Regexp variables
var (
rPos = regexp.MustCompile(`^pos:\s+(\d+)$`)
rFlags = regexp.MustCompile(`^flags:\s+(\d+)$`)
rMntID = regexp.MustCompile(`^mnt_id:\s+(\d+)$`)
rInotify = regexp.MustCompile(`^inotify`)
rInotifyParts = regexp.MustCompile(`^inotify\s+wd:([0-9a-f]+)\s+ino:([0-9a-f]+)\s+sdev:([0-9a-f]+)(?:\s+mask:([0-9a-f]+))?`)
rPos = regexp.MustCompile(`^pos:\s+(\d+)$`)
rFlags = regexp.MustCompile(`^flags:\s+(\d+)$`)
rMntID = regexp.MustCompile(`^mnt_id:\s+(\d+)$`)
rInotify = regexp.MustCompile(`^inotify`)
)
// ProcFDInfo contains represents file descriptor information.
@@ -41,7 +39,7 @@ type ProcFDInfo struct {
Flags string
// Mount point ID
MntID string
// List of inotify lines (structured) in the fdinfo file (kernel 3.8+ only)
// List of inotify lines (structed) in the fdinfo file (kernel 3.8+ only)
InotifyInfos []InotifyInfo
}
@@ -98,21 +96,15 @@ type InotifyInfo struct {
// InotifyInfo constructor. Only available on kernel 3.8+.
func parseInotifyInfo(line string) (*InotifyInfo, error) {
m := rInotifyParts.FindStringSubmatch(line)
if len(m) >= 4 {
var mask string
if len(m) == 5 {
mask = m[4]
}
i := &InotifyInfo{
WD: m[1],
Ino: m[2],
Sdev: m[3],
Mask: mask,
}
return i, nil
r := regexp.MustCompile(`^inotify\s+wd:([0-9a-f]+)\s+ino:([0-9a-f]+)\s+sdev:([0-9a-f]+)\s+mask:([0-9a-f]+)`)
m := r.FindStringSubmatch(line)
i := &InotifyInfo{
WD: m[1],
Ino: m[2],
Sdev: m[3],
Mask: m[4],
}
return nil, fmt.Errorf("invalid inode entry: %q", line)
return i, nil
}
// ProcFDInfos represents a list of ProcFDInfo structs.