Re: [PATCH 2/5] blk-crypto-fallback: consolidate static variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> > 
> > 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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux