efivario

package
v0.0.0-...-caef65d Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEfiPath = "/sys/firmware/efi/efivars"
)
View Source
const (
	FS_IMMUTABLE_FL = 0x00000010
)

Variables

View Source
var (
	ErrInsufficientSpace = errors.New("buffer too small")
	ErrNotFound          = errors.New("variable not found")
)

Functions

This section is empty.

Types

type Attributes

type Attributes uint32

Attributes indicates how the data variable should be stored and maintained by the system.

The attributes affect when the variable may be accessed and volatility of the data.

<https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf#I12.1.1356525>

const (
	// NonVolatile indicates the firmware environment variable is
	// stored in non-volatile memory (e.g. NVRAM).
	NonVolatile Attributes = 0x0001

	// BootServiceAccess indicates whenever the variable is visible
	// for boot services.
	BootServiceAccess Attributes = 0x0002

	// RuntimeAccess indicates whenever the variable is visible
	// after ExitBootServices() in UEFI is called.
	RuntimeAccess Attributes = 0x0004

	// HardwareErrorRecord marks the variable to be stored in an
	// area for hardware errors.
	HardwareErrorRecord Attributes = 0x0008

	// AuthenticatedWriteAccess is deprecated and should no longer
	// be used.
	AuthenticatedWriteAccess Attributes = 0x0010

	TimeBasedAuthenticatedWriteAccess Attributes = 0x0020

	AppendWrite Attributes = 0x0040

	// EnhancedAuthenticatedAccess attribute indicates that the
	// variable payload begins with an
	// EFI_VARIABLE_AUTHENTICATION_3 structure, and potentially
	// more structures as indicated by fields of this structure.
	EnhancedAuthenticatedAccess Attributes = 0x0080
)

func ReadAll

func ReadAll(c Context, name string, guid efiguid.GUID) (
	attrs Attributes,
	out []byte,
	err error,
)

func (Attributes) String

func (i Attributes) String() string

type Context

type Context interface {
	io.Closer

	// GetSizeHint hints the value size of the variable.
	GetSizeHint(name string, guid efiguid.GUID) (int64, error)

	// Get reads a specific EFI variable and returns the content
	// in the slice passed through out.
	Get(name string, guid efiguid.GUID, out []byte) (Attributes, int, error)

	// Set writes a specific EFI variable.
	Set(name string, guid efiguid.GUID, attrs Attributes, value []byte) error

	// Delete causes the entire variable to be removed from
	// existence completely.
	Delete(name string, guid efiguid.GUID) error

	// VariableNames returns an Iterator which enumerates all
	// EFI variables that are currently set on the current system.
	VariableNames() (VariableNameIterator, error)
}

func NewContext

func NewContext(path string) Context

func NewDefaultContext

func NewDefaultContext() Context

type FsContext

type FsContext struct {
	// contains filtered or unexported fields
}

FsContext provides an implementation of the Context API for platforms using a directory/file-based representation of the EFI variable service.

func NewFileSystemContext

func NewFileSystemContext(fs afero.Fs) *FsContext

func (FsContext) Close

func (c FsContext) Close() error

func (FsContext) Delete

func (c FsContext) Delete(name string, guid efiguid.GUID) (err error)

func (FsContext) Get

func (c FsContext) Get(name string, guid efiguid.GUID, out []byte) (a Attributes, n int, err error)

func (FsContext) GetSizeHint

func (c FsContext) GetSizeHint(name string, guid efiguid.GUID) (int64, error)

func (FsContext) Set

func (c FsContext) Set(name string, guid efiguid.GUID, attributes Attributes, value []byte) (err error)

func (FsContext) VariableNames

func (c FsContext) VariableNames() (VariableNameIterator, error)

type VariableNameItem

type VariableNameItem struct {
	Name string
	GUID efiguid.GUID
}

type VariableNameIterator

type VariableNameIterator interface {
	io.Closer
	itkit.Iterator[VariableNameItem]
	Iter() itkit.Iterator[VariableNameItem]
	Err() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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