On Thu, Oct 09, 2025 at 01:58:17PM +0200, Thorsten Blum wrote:
> Use designated initializers for 'key_format_tokens' and 'key_tokens' to
> allow struct fields to be reordered more easily and to improve
> readability.
> 
> Signed-off-by: Thorsten Blum <[email protected]>
> ---
>  security/keys/encrypted-keys/encrypted.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/security/keys/encrypted-keys/encrypted.c 
> b/security/keys/encrypted-keys/encrypted.c
> index aef438d18da8..76a6dab2f4d2 100644
> --- a/security/keys/encrypted-keys/encrypted.c
> +++ b/security/keys/encrypted-keys/encrypted.c
> @@ -62,17 +62,17 @@ enum {
>  };
>  
>  static const match_table_t key_format_tokens = {
> -     {Opt_default, "default"},
> -     {Opt_ecryptfs, "ecryptfs"},
> -     {Opt_enc32, "enc32"},
> -     {Opt_error, NULL}
> +     { .token = Opt_default, .pattern = "default"},
> +     { .token = Opt_ecryptfs, .pattern = "ecryptfs"},
> +     { .token = Opt_enc32, .pattern = "enc32"},
> +     { .token = Opt_error, .pattern = NULL}
>  };
>  
>  static const match_table_t key_tokens = {
> -     {Opt_new, "new"},
> -     {Opt_load, "load"},
> -     {Opt_update, "update"},
> -     {Opt_err, NULL}
> +     { .token = Opt_new, .pattern = "new"},
> +     { .token = Opt_load, .pattern = "load"},
> +     { .token = Opt_update, .pattern = "update"},
> +     { .token = Opt_err, .pattern = NULL}
>  };
>  
>  static bool user_decrypted_data = IS_ENABLED(CONFIG_USER_DECRYPTED_DATA);
> -- 
> 2.51.0
> 

For me this look like a "convert tuple alike initializations into struct
alike initializations" type of change :-)

In a context the change would make sense. E.g., if an optional field was
required.

BR, Jarkko

Reply via email to