Update vendored procfs for buddyinfo, mountstats, and XFS changes

This commit is contained in:
Matt Layher 2017-02-14 11:04:28 -05:00
commit 5c6ff86f9d
No known key found for this signature in database
GPG key ID: 77BFE531397EDE94
7 changed files with 633 additions and 5 deletions

View file

@ -4,6 +4,8 @@ import (
"fmt"
"os"
"path"
"github.com/prometheus/procfs/xfs"
)
// FS represents the pseudo-filesystem proc, which provides an interface to
@ -31,3 +33,14 @@ func NewFS(mountPoint string) (FS, error) {
func (fs FS) Path(p ...string) string {
return path.Join(append([]string{string(fs)}, p...)...)
}
// XFSStats retrieves XFS filesystem runtime statistics.
func (fs FS) XFSStats() (*xfs.Stats, error) {
f, err := os.Open(fs.Path("fs/xfs/stat"))
if err != nil {
return nil, err
}
defer f.Close()
return xfs.ParseStats(f)
}