Re: [PATCH v3 3/3] blk-crypto: show crypto capabilities in sysfs

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

 



On Thu, Dec 09, 2021 at 03:40:46PM -0800, Eric Biggers wrote:
> On Thu, Dec 09, 2021 at 02:51:59PM -0800, Bart Van Assche wrote:
> > On 12/7/21 5:35 PM, Eric Biggers wrote:
> > > +What:		/sys/block/<disk>/queue/crypto/modes/<mode>
> > > +Date:		December 2021
> > > +Contact:	linux-block@xxxxxxxxxxxxxxx
> > > +Description:
> > > +		[RO] For each crypto mode (i.e., encryption/decryption
> > > +		algorithm) the device supports with inline encryption, a file
> > > +		will exist at this location.  It will contain a hexadecimal
> > > +		number that is a bitmask of the supported data unit sizes, in
> > > +		bytes, for that crypto mode.
> > > +
> > > +		Currently, the crypto modes that may be supported are:
> > > +
> > > +		   * AES-256-XTS
> > > +		   * AES-128-CBC-ESSIV
> > > +		   * Adiantum
> > > +
> > > +		For example, if a device supports AES-256-XTS inline encryption
> > > +		with data unit sizes of 512 and 4096 bytes, the file
> > > +		/sys/block/<disk>/queue/crypto/modes/AES-256-XTS will exist and
> > > +		will contain "0x1200".
> > 
> > So a bitmask is used to combine multiple values into a single number?
> 
> You could think of it that way, yes.
> 
> > Has it been considered to report each value separately, e.g. 512\n4096\n
> > instead of 0x1200\n?  I think the former approach is more friendly for shell
> > scripts.

No multi-line outputs in sysfs please.  If you have to do a "selection
from an array", that is not how to do it.

Look at the output of /sys/power/pm_test/ as one way you can do it if
you have to choose one option from a list:
$ cat /sys/power/pm_test
[none] core processors platform devices freezer

But I don't think that applies here, right?

> I don't think that would be acceptable to the sysfs folks, as they only allow
> one value per file.  I suppose a bitmask could be viewed as unacceptable too,
> but it seemed to make sense here, given that the data unit sizes are always
> powers of 2, and the hardware reports them as bitmasks.
> 
> Greg already reviewed this patch, but maybe he wasn't looking at this part.
> 
> Greg, any opinion on the best way to report a set of power-of-2 values via
> sysfs?

A single hex value makes sense to me.

thanks,

greg k-h



[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