All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-block@vger.kernel.org,
	Satya Tangirala <satyaprateek2357@gmail.com>,
	dm-devel@redhat.com, linux-mmc@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: Re: [dm-devel] [PATCH 2/5] blk-crypto-fallback: consolidate static variables
Date: Wed, 15 Sep 2021 10:50:13 -0700	[thread overview]
Message-ID: <YUIyVajIjZdkPO7F@sol.localdomain> (raw)
In-Reply-To: <YUGjSR1g+EH0o2xo@infradead.org>

On Wed, Sep 15, 2021 at 08:39:53AM +0100, Christoph Hellwig wrote:
> On Sun, Sep 12, 2021 at 06:31:32PM -0700, Eric Biggers wrote:
> > From: Eric Biggers <ebiggers@google.com>
> > 
> > blk-crypto-fallback.c has many static variables with inconsistent names,
> > e.g. "blk_crypto_*", "crypto_*", and some unprefixed names.  This is
> > confusing.  Consolidate them all into a struct named
> > "blk_crypto_fallback" so that it's clear what they are.
> 
> I always find this pattern of a single instance global struct rather
> confusing.  What is the advantage over just using a consistent prefix?

Using "blk_crypto_fallback_*" for all these variables results in some pretty
long names, e.g. "blk_crypto_fallback_crypt_ctx_cache" and
"blk_crypto_fallback_num_prealloc_crypt_ctxs".  This proposal gives the best of
both worlds; the names are properly "namespaced" but there is also a shortcut to
refer to them (struct blk_crypto_fallback *fallback = &blk_crypto_fallback).

If this is going to be controversial I can just drop this patch, but I was
hoping there would be a way to make things more consistent.

- Eric

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-block@vger.kernel.org, linux-mmc@vger.kernel.org,
	linux-scsi@vger.kernel.org, dm-devel@redhat.com,
	Satya Tangirala <satyaprateek2357@gmail.com>
Subject: Re: [PATCH 2/5] blk-crypto-fallback: consolidate static variables
Date: Wed, 15 Sep 2021 10:50:13 -0700	[thread overview]
Message-ID: <YUIyVajIjZdkPO7F@sol.localdomain> (raw)
In-Reply-To: <YUGjSR1g+EH0o2xo@infradead.org>

On Wed, Sep 15, 2021 at 08:39:53AM +0100, Christoph Hellwig wrote:
> On Sun, Sep 12, 2021 at 06:31:32PM -0700, Eric Biggers wrote:
> > From: Eric Biggers <ebiggers@google.com>
> > 
> > blk-crypto-fallback.c has many static variables with inconsistent names,
> > e.g. "blk_crypto_*", "crypto_*", and some unprefixed names.  This is
> > confusing.  Consolidate them all into a struct named
> > "blk_crypto_fallback" so that it's clear what they are.
> 
> I always find this pattern of a single instance global struct rather
> confusing.  What is the advantage over just using a consistent prefix?

Using "blk_crypto_fallback_*" for all these variables results in some pretty
long names, e.g. "blk_crypto_fallback_crypt_ctx_cache" and
"blk_crypto_fallback_num_prealloc_crypt_ctxs".  This proposal gives the best of
both worlds; the names are properly "namespaced" but there is also a shortcut to
refer to them (struct blk_crypto_fallback *fallback = &blk_crypto_fallback).

If this is going to be controversial I can just drop this patch, but I was
hoping there would be a way to make things more consistent.

- Eric

  reply	other threads:[~2021-09-15 17:50 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13  1:31 [dm-devel] [PATCH 0/5] blk-crypto cleanups Eric Biggers
2021-09-13  1:31 ` Eric Biggers
2021-09-13  1:31 ` [dm-devel] [PATCH 1/5] blk-crypto-fallback: properly prefix function and struct names Eric Biggers
2021-09-13  1:31   ` Eric Biggers
2021-09-15  7:36   ` [dm-devel] " Christoph Hellwig
2021-09-15  7:36     ` Christoph Hellwig
2021-09-13  1:31 ` [dm-devel] [PATCH 2/5] blk-crypto-fallback: consolidate static variables Eric Biggers
2021-09-13  1:31   ` Eric Biggers
2021-09-15  7:39   ` [dm-devel] " Christoph Hellwig
2021-09-15  7:39     ` Christoph Hellwig
2021-09-15 17:50     ` Eric Biggers [this message]
2021-09-15 17:50       ` Eric Biggers
2021-09-16  7:39       ` [dm-devel] " Christoph Hellwig
2021-09-16  7:39         ` Christoph Hellwig
2021-09-16 17:28         ` [dm-devel] " Eric Biggers
2021-09-16 17:28           ` Eric Biggers
2021-09-13  1:31 ` [dm-devel] [PATCH 3/5] blk-crypto: rename keyslot-manager files to blk-crypto-profile Eric Biggers
2021-09-13  1:31   ` Eric Biggers
2021-09-14  9:04   ` [dm-devel] " Ulf Hansson
2021-09-14  9:04     ` Ulf Hansson
2021-09-15  7:45   ` [dm-devel] " Christoph Hellwig
2021-09-15  7:45     ` Christoph Hellwig
2021-09-15 17:40     ` [dm-devel] " Eric Biggers
2021-09-15 17:40       ` Eric Biggers
2021-09-16  7:42       ` [dm-devel] " Christoph Hellwig
2021-09-16  7:42         ` Christoph Hellwig
2021-09-13  1:31 ` [dm-devel] [PATCH 4/5] blk-crypto: rename blk_keyslot_manager to blk_crypto_profile Eric Biggers
2021-09-13  1:31   ` Eric Biggers
2021-09-14  9:04   ` [dm-devel] " Ulf Hansson
2021-09-14  9:04     ` Ulf Hansson
2021-09-14 21:52   ` [dm-devel] " Eric Biggers
2021-09-14 21:52     ` Eric Biggers
2021-09-13  1:31 ` [dm-devel] [PATCH 5/5] blk-crypto: update inline encryption documentation Eric Biggers
2021-09-13  1:31   ` Eric Biggers

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=YUIyVajIjZdkPO7F@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=dm-devel@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=satyaprateek2357@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.