1EFI_GET_VARIABLE(3) Library Functions Manual EFI_GET_VARIABLE(3)
2
3
4
6 efi_variables_supported, efi_del_variable, efi_get_variable,
7 efi_get_variable_attributes, efi_get_variable_size, efi_set_variable -
8 manipulate UEFI variables
9
11 #include <efivar.h>
12
13 int efi_variables_supported(void);
14 int efi_del_variable(efi_guid_t guid, const char *name);
15
16 int efi_get_variable(efi_guid_t guid, const char *name,
17 void **data, ssize_t *data_size,
18 uint32_t *attributes);
19
20 int efi_get_variable_attributes(efi_guid_t guid, const char *name,
21 uint32_t *attributes);
22
23 int efi_get_variable_exists(efi_guid_t guid, const char *name);
24
25 int efi_get_variable_size(efi_guid_t guid, const char *name,
26 size_t *size);
27
28 int efi_append_variable(efi_guid_t guid, const char *name,
29 void *data, size_t data_size,
30 uint32_t attributes);
31
32 int efi_set_variable(efi_guid_t guid, const char *name,
33 void *data, size_t data_size,
34 uint32_t attributes, mode_t mode);
35
36 int efi_get_next_variable_name(efi_guid_t **guid, char **name);
37
38 int efi_str_to_guid(const char *s, efi_guid_t *guid);
39
40 int efi_guid_to_str(const efi_guid_t *guid, char **sp);
41
42 int efi_name_to_guid(const char *name, efi_guid_t *guid);
43
44 int efi_id_guid_to_guid(const char *id_guid, efi_guid_t *guid);
45
46 int efi_guid_to_name(efi_guid_t *guid, char **name);
47
48 int efi_guid_to_id_guid(efi_guid_t *guid, char **id_guid);
49
50 int efi_guid_to_symbol(efi_guid_t *guid, char **symbol);
51 int efi_symbol_to_guid(const char *symbol, efi_guid_t *guid);
52
54 efi_variables_supported() tests if the UEFI variable facility is sup‐
55 ported on the current machine.
56
57 efi_del_variable() deletes the variable specified by guid and name.
58
59 efi_get_variable() gets the variable specified by guid and name. The
60 value is stored in data, its size in data_size, and its attributes are
61 stored in attributes.
62
63 efi_get_variable_attributes() gets attributes for the variable speci‐
64 fied by guid and name.
65
66 efi_get_variable_exists() gets if the variable specified by guid and
67 name exists.
68
69 efi_get_variable_size() gets the size of the data for the variable
70 specified by guid and name.
71
72 efi_append_variable() appends data of size size to the variable speci‐
73 fied by guid and name.
74
75 efi_set_variable() sets the variable specified by guid and name, and
76 sets the file mode to mode, subject to umask. Note that the mode will
77 not persist across a reboot, and that the permissions only apply if on
78 systems using efivarfs.
79
80 efi_get_next_variable_name() iterates across the currently extant vari‐
81 ables, passing back a guid and name.
82
83 efi_str_to_guid() parses a UEFI GUID from string form to an efi_guid_t
84 the caller provides
85
86 efi_guid_to_str() Creates a string representation of a UEFI GUID. If
87 sp is NULL, it returns how big the string would be. If sp is not NULL
88 but *sp is NULL, it allocates a string and returns it with. It is the
89 caller's responsibility to free this string. If sp is not NULL and *sp
90 is not NULL, efi_guid_to_str() assumes there is an allocation of suit‐
91 able size and uses it.
92
93 efi_name_to_guid() translates from a well known name to an efi_guid_t
94 the caller provides.
95
96 efi_guid_to_name() translates from an efi_guid_t to a well known name.
97 If the supplied GUID does not have a well known name, this function is
98 equivalent to efi_guid_to_str().
99
100 efi_guid_to_id_guid() translates from an efi_guid_t to an {ID GUID}.
101 If the supplied GUID has a well known name, the {ID GUID} will be of
102 the form "{name_here}". If not, it will be of the form
103 "{66b2af1c-6211-4082-95cb-9f73a4795a7e}".
104
105 efi_id_guid_to_guid() translates from an {ID GUID} to an efi_guid_t the
106 caller provides.
107
108 efi_guid_to_symbol() translates from an efi_guid_t to a unique (within
109 libefivar) C-sytle symbol name. These symbol names are useful for
110 printing as a unique, easily parsed identifier, and are also provide by
111 the library and its header files.
112
113 efi_symbol_to_guid() translates from a libefivar efi_guid_$FOO symbol
114 name to an efi_guid_t the caller provides.
115
117 efi_variables_supported() returns true if variables are supported on
118 the running hardware, and false if they are not.
119
120 efi_get_next_variable_name() returns 0 when iteration has completed, 1
121 when iteration has not completed, and -1 on error. In the event of an
122 error, errno(3) is set appropriately.
123
124 efi_del_variable(), efi_get_variable(), efi_get_variable_attributes(),
125 efi_get_variable_exists(), efi_get_variable_size(), efi_append_vari‐
126 able(), efi_set_variable(), efi_str_to_guid(), efi_guid_to_str(),
127 efi_name_to_guid(), and efi_guid_to_name() return negative on error and
128 zero on success.
129
131 Peter Jones <pjones@redhat.com>
132
133
134
135 Thu Aug 20 2012 EFI_GET_VARIABLE(3)