Thread (19 messages) 19 messages, 4 authors, 2021-12-14

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

From: Eric Biggers <ebiggers@kernel.org>
Date: 2021-12-10 00:12:26
Also in: linux-block, linux-mmc, linux-scsi, lkml

On Thu, Dec 09, 2021 at 04:02:07PM -0800, Bart Van Assche wrote:
On 12/9/21 3:40 PM, Eric Biggers wrote:
quoted
On Thu, Dec 09, 2021 at 02:51:59PM -0800, Bart Van Assche wrote:
quoted
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.
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.
In case Greg wouldn't have the time to reply, I think the following quote from
Documentation/filesystems/sysfs.txt is relevant in this context: "Attributes
should be ASCII text files, preferably with only one value per file. It is
noted that it may not be efficient to contain only one value per file, so it is
socially acceptable to express an array of values of the same type."

Thanks,
It should be, but I thought that Greg had complained about people doing that
before, and required strictly one value per file.  So we would need his opinion.

Note that a bitmask isn't hard to handle in a shell script:

	mask=$(</sys/block/sda/queue/crypto/modes/AES-256-XTS)
	if (( mask & 4096 )); then
		echo "4096-byte data units supported"
	fi

But I could see how someone could prefer something like

	if grep -q '\<4096\>' /sys/block/sda/queue/crypto/modes/AES-256-XTS; then
		echo "4096-byte data units supported"
	fi

- Eric
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help