efi_loader: use const efi_guid_t * for variable services
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 30 Dec 2018 19:53:51 +0000 (20:53 +0100)
committerAlexander Graf <agraf@suse.de>
Wed, 13 Feb 2019 08:40:05 +0000 (09:40 +0100)
The runtime variable services never change GUIDs. So we should declare
the GUID parameters as constant.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
include/efi_api.h
include/efi_loader.h
lib/efi_loader/efi_variable.c
lib/efi_selftest/efi_selftest_variables.c

index 4389dbeddcb1c1147097679bc120cb028b9547ce..83fd12b685d5fd25964530c008472b9872d05f50 100644 (file)
@@ -221,13 +221,15 @@ struct efi_runtime_services {
                        struct efi_mem_desc *virtmap);
        efi_status_t (*convert_pointer)(unsigned long dbg, void **address);
        efi_status_t (EFIAPI *get_variable)(u16 *variable_name,
-                                           efi_guid_t *vendor, u32 *attributes,
+                                           const efi_guid_t *vendor,
+                                           u32 *attributes,
                                            efi_uintn_t *data_size, void *data);
        efi_status_t (EFIAPI *get_next_variable_name)(
                        efi_uintn_t *variable_name_size,
-                       u16 *variable_name, efi_guid_t *vendor);
+                       u16 *variable_name, const efi_guid_t *vendor);
        efi_status_t (EFIAPI *set_variable)(u16 *variable_name,
-                                           efi_guid_t *vendor, u32 attributes,
+                                           const efi_guid_t *vendor,
+                                           u32 attributes,
                                            efi_uintn_t data_size, void *data);
        efi_status_t (EFIAPI *get_next_high_mono_count)(
                        uint32_t *high_count);
index 6323686f9d37f5cbe767eb4f3d8673544fb30776..5420c99e0c31a419aa774a66d0a86be889615b04 100644 (file)
@@ -510,15 +510,15 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
                                 struct efi_system_table *systab);
 #endif
 
-efi_status_t EFIAPI efi_get_variable(u16 *variable_name, efi_guid_t *vendor,
-                                    u32 *attributes, efi_uintn_t *data_size,
-                                    void *data);
+efi_status_t EFIAPI efi_get_variable(u16 *variable_name,
+                                    const efi_guid_t *vendor, u32 *attributes,
+                                    efi_uintn_t *data_size, void *data);
 efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size,
                                               u16 *variable_name,
-                                              efi_guid_t *vendor);
-efi_status_t EFIAPI efi_set_variable(u16 *variable_name, efi_guid_t *vendor,
-                                    u32 attributes, efi_uintn_t data_size,
-                                    void *data);
+                                              const efi_guid_t *vendor);
+efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
+                                    const efi_guid_t *vendor, u32 attributes,
+                                    efi_uintn_t data_size, void *data);
 
 /*
  * See section 3.1.3 in the v2.7 UEFI spec for more details on
index 19d9cb865f25ba35938ec42c08bdb9b571d63c27..4e6a04e614550b0b8d76d4766b29c0357243d99b 100644 (file)
@@ -99,7 +99,7 @@ static char *mem2hex(char *hexstr, const u8 *mem, int count)
 }
 
 static efi_status_t efi_to_native(char **native, const u16 *variable_name,
-                                 efi_guid_t *vendor)
+                                 const efi_guid_t *vendor)
 {
        size_t len;
        char *pos;
@@ -163,9 +163,9 @@ static const char *parse_attr(const char *str, u32 *attrp)
 }
 
 /* http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES#GetVariable.28.29 */
-efi_status_t EFIAPI efi_get_variable(u16 *variable_name, efi_guid_t *vendor,
-                                    u32 *attributes, efi_uintn_t *data_size,
-                                    void *data)
+efi_status_t EFIAPI efi_get_variable(u16 *variable_name,
+                                    const efi_guid_t *vendor, u32 *attributes,
+                                    efi_uintn_t *data_size, void *data)
 {
        char *native_name;
        efi_status_t ret;
@@ -244,7 +244,7 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name, efi_guid_t *vendor,
 /* http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES#GetNextVariableName.28.29 */
 efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size,
                                               u16 *variable_name,
-                                              efi_guid_t *vendor)
+                                              const efi_guid_t *vendor)
 {
        EFI_ENTRY("%p \"%ls\" %pUl", variable_name_size, variable_name, vendor);
 
@@ -252,9 +252,9 @@ efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size,
 }
 
 /* http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES#SetVariable.28.29 */
-efi_status_t EFIAPI efi_set_variable(u16 *variable_name, efi_guid_t *vendor,
-                                    u32 attributes, efi_uintn_t data_size,
-                                    void *data)
+efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
+                                    const efi_guid_t *vendor, u32 attributes,
+                                    efi_uintn_t data_size, void *data)
 {
        char *native_name = NULL, *val = NULL, *s;
        efi_status_t ret = EFI_SUCCESS;
index e4c389a872fa4634a5458654e7afdfc46fbd29fd..ffc8cad329505b9ca1ad03ab7a9cc29582ad22c4 100644 (file)
 
 static struct efi_boot_services *boottime;
 static struct efi_runtime_services *runtime;
-static efi_guid_t guid_vendor0 =
+static const efi_guid_t guid_vendor0 =
        EFI_GUID(0x67029eb5, 0x0af2, 0xf6b1,
                 0xda, 0x53, 0xfc, 0xb5, 0x66, 0xdd, 0x1c, 0xe6);
-static efi_guid_t guid_vendor1 =
+static const efi_guid_t guid_vendor1 =
        EFI_GUID(0xff629290, 0x1fc1, 0xd73f,
                 0x8f, 0xb1, 0x32, 0xf9, 0x0c, 0xa0, 0x42, 0xea);