Documentation
¶
Overview ¶
Package efivarfs allows interaction with efivarfs of the linux kernel.
Index ¶
- Variables
- func RemoveVariable(desc VariableDescriptor) error
- func SimpleListVariables() ([]string, error)
- func SimpleRemoveVariable(v string) error
- func SimpleWriteVariable(v string, attrs VariableAttributes, data *bytes.Buffer) error
- func WriteVariable(desc VariableDescriptor, attrs VariableAttributes, data []byte) error
- type VariableAttributes
- type VariableDescriptor
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFsNotMounted is caused if no vailed efivarfs magic is found ErrFsNotMounted = errors.New("no efivarfs magic found, is it mounted?") ErrVarsUnavailable = errors.New("no variable backend is available") // ErrVarNotExist is caused by accessing a non-existing variable ErrVarNotExist = errors.New("variable does not exist") // ErrVarPermission is caused by not haven the right permissions either // because of not being root or xattrs not allowing changes ErrVarPermission = errors.New("permission denied") )
var EfiVarFs = "/sys/firmware/efi/efivars/"
EfiVarFs is the path to the efivarfs mount point
Note: This has to be a var instead of const because of our unit tests.
Functions ¶
func RemoveVariable ¶
func RemoveVariable(desc VariableDescriptor) error
RemoveVariable calls remove() on the current efivarfs backend.
func SimpleListVariables ¶
SimpleListVariables is like ListVariables but returns a []string instead of a []VariableDescriptor.
func SimpleRemoveVariable ¶
SimpleRemoveVariable is like RemoveVariable but takes the combined name and guid string of the form name-guid.
func SimpleWriteVariable ¶
func SimpleWriteVariable(v string, attrs VariableAttributes, data *bytes.Buffer) error
SimpleWriteVariable is like WriteVariables but takes the combined name and guid string of the form name-guid and returns a bytes.Buffer instead of a []byte.
func WriteVariable ¶
func WriteVariable(desc VariableDescriptor, attrs VariableAttributes, data []byte) error
WriteVariable calls set() on the current efivarfs backend.
Types ¶
type VariableAttributes ¶
type VariableAttributes uint32
VariableAttributes is an uint32 identifying the variables attributes.
const ( // AttributeNonVolatile indicates a variable is non volatile. AttributeNonVolatile VariableAttributes = 0x00000001 // AttributeBootserviceAccess indicates a variable is accessible during boot service. AttributeBootserviceAccess VariableAttributes = 0x00000002 // AttributeRuntimeAccess indicates a variable is accessible during runtime. AttributeRuntimeAccess VariableAttributes = 0x00000004 // AttributeHardwareErrorRecord indicates a variable holds hardware error records. AttributeHardwareErrorRecord VariableAttributes = 0x00000008 // AttributeAuthenticatedWriteAccess indicates a variable needs authentication before write access. AttributeAuthenticatedWriteAccess VariableAttributes = 0x00000010 // AttributeTimeBasedAuthenticatedWriteAccess indicates a variable needs time based authentication before write access. AttributeTimeBasedAuthenticatedWriteAccess VariableAttributes = 0x00000020 // AttributeAppendWrite indicates data written to this variable is appended. AttributeAppendWrite VariableAttributes = 0x00000040 // AttributeEnhancedAuthenticatedAccess indicate a variable uses the new authentication format. AttributeEnhancedAuthenticatedAccess VariableAttributes = 0x00000080 )
func ReadVariable ¶
func ReadVariable(desc VariableDescriptor) (VariableAttributes, []byte, error)
ReadVariable calls get() on the current efivarfs backend.
func SimpleReadVariable ¶
func SimpleReadVariable(v string) (VariableAttributes, *bytes.Reader, error)
SimpleReadVariable is like ReadVariables but takes the combined name and guid string of the form name-guid and returns a bytes.Reader instead of a []byte.
type VariableDescriptor ¶
VariableDescriptor contains the name and GUID identifying a variable
func ListVariables ¶
func ListVariables() ([]VariableDescriptor, error)
ListVariables calls list() on the current efivarfs backend.