On Thu, Dec 09, 2021 at 04:02:07PM -0800, Bart Van Assche wrote: > On 12/9/21 3:40 PM, Eric Biggers wrote: > > On Thu, Dec 09, 2021 at 02:51:59PM -0800, Bart Van Assche wrote: > > > 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