diff mbox series

EFI: some easy constification

Message ID c2995533-7a14-e83a-9a2a-7f0346c161b0@suse.com (mailing list archive)
State New, archived
Headers show
Series EFI: some easy constification | expand

Commit Message

Jan Beulich Sept. 17, 2020, 11:27 a.m. UTC
Inspired by some of Trammell's suggestions, this harvests some low
hanging fruit, without needing to be concerned about the definitions of
the EFI interfaces themselves.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Roger Pau Monné Sept. 17, 2020, 11:40 a.m. UTC | #1
On Thu, Sep 17, 2020 at 01:27:12PM +0200, Jan Beulich wrote:
> Inspired by some of Trammell's suggestions, this harvests some low
> hanging fruit, without needing to be concerned about the definitions of
> the EFI interfaces themselves.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

This is purely a non-functional change AFAICT?

Acked-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.
Jan Beulich Sept. 17, 2020, 11:42 a.m. UTC | #2
On 17.09.2020 13:40, Roger Pau Monné wrote:
> On Thu, Sep 17, 2020 at 01:27:12PM +0200, Jan Beulich wrote:
>> Inspired by some of Trammell's suggestions, this harvests some low
>> hanging fruit, without needing to be concerned about the definitions of
>> the EFI interfaces themselves.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> This is purely a non-functional change AFAICT?
> 
> Acked-by: Roger Pau Monné <roger.pau@citrix.com>

Indeed. Merely adding const with no other changes hardly can have
any functional effect, I think. Unless it broke the build in some
way, in which case I wouldn't [knowingly] have sent the patch.

Jan
Wei Liu Sept. 17, 2020, 4:49 p.m. UTC | #3
On Thu, Sep 17, 2020 at 01:27:12PM +0200, Jan Beulich wrote:
> Inspired by some of Trammell's suggestions, this harvests some low
> hanging fruit, without needing to be concerned about the definitions of
> the EFI interfaces themselves.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 

Reviewed-by: Wei Liu <wl@xen.org>
Julien Grall Sept. 23, 2020, 8:38 a.m. UTC | #4
Hi Jan,

On 17/09/2020 12:27, Jan Beulich wrote:
> Inspired by some of Trammell's suggestions, this harvests some low
> hanging fruit, without needing to be concerned about the definitions of
> the EFI interfaces themselves.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,

> 
> --- a/xen/arch/arm/efi/efi-boot.h
> +++ b/xen/arch/arm/efi/efi-boot.h
> @@ -420,7 +420,7 @@ static void __init efi_arch_memory_setup
>   
>   static void __init efi_arch_handle_cmdline(CHAR16 *image_name,
>                                              CHAR16 *cmdline_options,
> -                                           char *cfgfile_options)
> +                                           const char *cfgfile_options)
>   {
>       union string name;
>       char *buf;
> @@ -481,8 +481,9 @@ static void __init efi_arch_handle_cmdli
>       efi_bs->FreePool(buf);
>   }
>   
> -static void __init efi_arch_handle_module(struct file *file, const CHAR16 *name,
> -                                          char *options)
> +static void __init efi_arch_handle_module(const struct file *file,
> +                                          const CHAR16 *name,
> +                                          const char *options)
>   {
>       int node;
>       int chosen;
> --- a/xen/arch/x86/efi/efi-boot.h
> +++ b/xen/arch/x86/efi/efi-boot.h
> @@ -294,7 +294,7 @@ static void __init efi_arch_cfg_file_lat
>   
>   static void __init efi_arch_handle_cmdline(CHAR16 *image_name,
>                                              CHAR16 *cmdline_options,
> -                                           char *cfgfile_options)
> +                                           const char *cfgfile_options)
>   {
>       union string name;
>   
> @@ -635,8 +635,9 @@ static void __init efi_arch_memory_setup
>   #undef l2_4G_offset
>   }
>   
> -static void __init efi_arch_handle_module(struct file *file, const CHAR16 *name,
> -                                          char *options)
> +static void __init efi_arch_handle_module(const struct file *file,
> +                                          const CHAR16 *name,
> +                                          const char *options)
>   {
>       union string local_name;
>       void *ptr;
> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -119,7 +119,7 @@ static char *split_string(char *s);
>   static CHAR16 *s2w(union string *str);
>   static char *w2s(const union string *str);
>   static bool read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,
> -                      struct file *file, char *options);
> +                      struct file *file, const char *options);
>   static size_t wstrlen(const CHAR16 * s);
>   static int set_color(u32 mask, int bpp, u8 *pos, u8 *sz);
>   static bool match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2);
> @@ -539,7 +539,7 @@ static char * __init split_string(char *
>   }
>   
>   static bool __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,
> -                             struct file *file, char *options)
> +                             struct file *file, const char *options)
>   {
>       EFI_FILE_HANDLE FileHandle = NULL;
>       UINT64 size;
> @@ -1100,7 +1100,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
>       EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
>       union string section = { NULL }, name;
>       bool base_video = false;
> -    char *option_str;
> +    const char *option_str;
>       bool use_cfg_file;
>   
>       __set_bit(EFI_BOOT, &efi_flags);
>
diff mbox series

Patch

--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -420,7 +420,7 @@  static void __init efi_arch_memory_setup
 
 static void __init efi_arch_handle_cmdline(CHAR16 *image_name,
                                            CHAR16 *cmdline_options,
-                                           char *cfgfile_options)
+                                           const char *cfgfile_options)
 {
     union string name;
     char *buf;
@@ -481,8 +481,9 @@  static void __init efi_arch_handle_cmdli
     efi_bs->FreePool(buf);
 }
 
-static void __init efi_arch_handle_module(struct file *file, const CHAR16 *name,
-                                          char *options)
+static void __init efi_arch_handle_module(const struct file *file,
+                                          const CHAR16 *name,
+                                          const char *options)
 {
     int node;
     int chosen;
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -294,7 +294,7 @@  static void __init efi_arch_cfg_file_lat
 
 static void __init efi_arch_handle_cmdline(CHAR16 *image_name,
                                            CHAR16 *cmdline_options,
-                                           char *cfgfile_options)
+                                           const char *cfgfile_options)
 {
     union string name;
 
@@ -635,8 +635,9 @@  static void __init efi_arch_memory_setup
 #undef l2_4G_offset
 }
 
-static void __init efi_arch_handle_module(struct file *file, const CHAR16 *name,
-                                          char *options)
+static void __init efi_arch_handle_module(const struct file *file,
+                                          const CHAR16 *name,
+                                          const char *options)
 {
     union string local_name;
     void *ptr;
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -119,7 +119,7 @@  static char *split_string(char *s);
 static CHAR16 *s2w(union string *str);
 static char *w2s(const union string *str);
 static bool read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,
-                      struct file *file, char *options);
+                      struct file *file, const char *options);
 static size_t wstrlen(const CHAR16 * s);
 static int set_color(u32 mask, int bpp, u8 *pos, u8 *sz);
 static bool match_guid(const EFI_GUID *guid1, const EFI_GUID *guid2);
@@ -539,7 +539,7 @@  static char * __init split_string(char *
 }
 
 static bool __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,
-                             struct file *file, char *options)
+                             struct file *file, const char *options)
 {
     EFI_FILE_HANDLE FileHandle = NULL;
     UINT64 size;
@@ -1100,7 +1100,7 @@  efi_start(EFI_HANDLE ImageHandle, EFI_SY
     EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
     union string section = { NULL }, name;
     bool base_video = false;
-    char *option_str;
+    const char *option_str;
     bool use_cfg_file;
 
     __set_bit(EFI_BOOT, &efi_flags);