Re: [PATCH v5 1/9] block: Keyslot Manager for Inline Encryption

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

 



On Mon, Oct 28, 2019 at 12:20:24AM -0700, Satya Tangirala wrote:
> +/*
> + * keyslot-manager.c

Never mention the file name in top of the file comments, it is going
to be out of data sooner than you'll get the series merged..

> +EXPORT_SYMBOL(keyslot_manager_create);

please use EXPORT_SYMBOL_GPL like all new low-level block layer exports.

> +EXPORT_SYMBOL(keyslot_manager_get_slot_for_key);

This is only used in block/bio-crypt-ctx.c, no need for an export.

> +void keyslot_manager_get_slot(struct keyslot_manager *ksm, unsigned int slot)
> +{
> +	if (WARN_ON(slot >= ksm->num_slots))
> +		return;
> +
> +	WARN_ON(atomic_inc_return(&ksm->slots[slot].slot_refs) < 2);
> +}
> +EXPORT_SYMBOL(keyslot_manager_get_slot);

Same here.

> +EXPORT_SYMBOL(keyslot_manager_put_slot);

And here.

> +bool keyslot_manager_crypto_mode_supported(struct keyslot_manager *ksm,
> +					   enum blk_crypto_mode_num crypto_mode,
> +					   unsigned int data_unit_size)
> +{
> +	if (!ksm)
> +		return false;
> +	return ksm->ksm_ll_ops.crypto_mode_supported(ksm->ll_priv_data,
> +						     crypto_mode,
> +						     data_unit_size);
> +}
> +EXPORT_SYMBOL(keyslot_manager_crypto_mode_supported);

And here as well.  In fact this one is so trivial that it is better
open coded into the two callers.

> +bool keyslot_manager_rq_crypto_mode_supported(struct request_queue *q,
> +					enum blk_crypto_mode_num crypto_mode,
> +					unsigned int data_unit_size)
> +{
> +	return keyslot_manager_crypto_mode_supported(q->ksm, crypto_mode,
> +						     data_unit_size);
> +}
> +EXPORT_SYMBOL(keyslot_manager_rq_crypto_mode_supported);

And this one is entirely unused.

> +EXPORT_SYMBOL(keyslot_manager_evict_key);

No used outside blk-crypto.c either.

In fact given how small block/blk-crypto.c and block/keyslot-manager.c
are, and given that all but two functions in the latter are only called
from the former you should seriously consider merging the two files.

> diff --git a/include/linux/bio.h b/include/linux/bio.h
> index 3cdb84cdc488..d0cb7c350cdc 100644
> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -564,6 +564,11 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
>  }
>  #endif
>  
> +enum blk_crypto_mode_num {
> +	BLK_ENCRYPTION_MODE_INVALID	= 0,
> +	BLK_ENCRYPTION_MODE_AES_256_XTS	= 1,
> +};

This one moves to include/linux/bio-crypt-ctx.h later in the series,
please introduce it in the right place from the start.  Also is there
a need to explicitly assign code points here?

> +extern struct keyslot_manager *keyslot_manager_create(unsigned int num_slots,
> +				const struct keyslot_mgmt_ll_ops *ksm_ops,
> +				void *ll_priv_data);

There is no nee for externs on function declarations in headers.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux