value

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package value decodes typed values from resolved debugfs files.

The package is intentionally independent of any specific debugfs subsystem. It operates on file.File values, usually resolved by the root debugfs package.

For common decimal counters:

file, err := dfs.Open("kvm", "1234-16", "nested_run")
if err != nil {
	return err
}

count, err := value.Uint64(file)

For custom formats, provide a decoder:

v, err := value.Read(file, func(raw []byte) (MyValue, error) {
	return parseMyValue(raw)
})

Index

Constants

This section is empty.

Variables

View Source
var ErrNilDecoder = errors.New("nil decoder")

ErrNilDecoder reports a nil decoder passed to Read.

Functions

func ParseUint64

func ParseUint64(raw []byte) (uint64, error)

ParseUint64 decodes a decimal unsigned integer.

func Read

func Read[T any](f file.File, decode Decoder[T]) (T, error)

Read reads file and decodes its contents with decode.

func Uint64

func Uint64(f file.File) (uint64, error)

Uint64 reads a decimal unsigned integer from file.

Types

type Decoder

type Decoder[T any] func([]byte) (T, error)

Decoder converts raw debugfs file contents into T.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL