linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: Mimi Zohar <zohar@linux.ibm.com>,
	David Howells <dhowells@redhat.com>,
	Paul Moore <paul@paul-moore.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	linux-integrity@vger.kernel.org, keyrings@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KEYS: encrypted: Use designated initializers for match_table_t structs
Date: Fri, 10 Oct 2025 07:01:50 +0300	[thread overview]
Message-ID: <aOiFLjI9iqtEPDdk@kernel.org> (raw)
In-Reply-To: <aOiDqjEyowUkegbd@kernel.org>

On Fri, Oct 10, 2025 at 06:55:26AM +0300, Jarkko Sakkinen wrote:
> 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 <thorsten.blum@linux.dev>
> > ---
> >  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.

If we had struct initializers I would equally nak "convert struct
initializers to tuple initializers" type of change.

BR, Jarkko

      reply	other threads:[~2025-10-10  4:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09 11:58 [PATCH] KEYS: encrypted: Use designated initializers for match_table_t structs Thorsten Blum
2025-10-09 12:44 ` James Bottomley
2025-10-09 13:30   ` Thorsten Blum
2025-10-09 13:51     ` James Bottomley
2025-10-23 13:35       ` Roberto Sassu
2025-10-10  3:55 ` Jarkko Sakkinen
2025-10-10  4:01   ` Jarkko Sakkinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aOiFLjI9iqtEPDdk@kernel.org \
    --to=jarkko@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=serge@hallyn.com \
    --cc=thorsten.blum@linux.dev \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).