vpd

package
v3.0.0-...-66753ca Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxBootEntry  = 9999
	DefaultVpdDir = "/sys/firmware/vpd"
)

default variables

Functions

func ClearRwVpd

func ClearRwVpd() error

ClearRwVpd re-format RW_VPD via flashrom and vpd executables

func FlashromRWVpdSet

func FlashromRWVpdSet(key string, value []byte, delete bool) error

Set RW_VPD key-value via flashrom and vpd executables, delete set to false would set or add the key, delete set to true would delete an existing key.

func FlashromVpdDump

func FlashromVpdDump() error

FlashromVpdDump read and dump all VPD values from RO and RW VPD flash regions directly

func Get

func Get(key string, readOnly bool) ([]byte, error)

Get wraps globalReader.Get .

func GetAll

func GetAll(readOnly bool) (map[string][]byte, error)

GetAll wraps globalReader.GetAll .

func Set

func Set(key string, value []byte, readOnly bool) error

Set wraps globalReader.Set .

Types

type Reader

type Reader struct {
	VpdDir string
}

Reader is a VPD reader object.

func NewReader

func NewReader() *Reader

NewReader returns a new VPD Reader.

func (*Reader) Get

func (r *Reader) Get(key string, readOnly bool) ([]byte, error)

Get reads a VPD variable by name and returns its value as a sequence of bytes. The `readOnly` flag specifies whether the variable is read-only or read-write.

func (*Reader) GetAll

func (r *Reader) GetAll(readOnly bool) (map[string][]byte, error)

GetAll reads all the VPD variables and returns a map contaiing each name:value couple. The `readOnly` flag specifies whether the variable is read-only or read-write.

func (*Reader) Set

func (r *Reader) Set(key string, value []byte, readOnly bool) error

Set sets a VPD variable with `key` as name and `value` as its byte-stream value. The `readOnly` flag specifies whether the variable is read-only or read-write. NOTE Unfortunately Set doesn't currently work, because the sysfs interface does not support writing. To write, this library needs a backend able to write to flash chips, like the command line tool flashrom or flashtools.

Jump to

Keyboard shortcuts

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