block: show crypto capabilities in sysfs
Subsystems (5)
PATCH v2 1/3 block: simplify calling convention of elv_unregister_queue()
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Make elv_unregister_queue() a no-op if q->elevator is NULL or is not registered.
This simplifies the existing callers, as well as the future caller in the error path of blk_register_queue().
Also don't bother checking whether q is NULL, since it never is.
--- block/blk-sysfs.c | 3 +-- block/elevator.c | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-)
block/blk-sysfs.c +1 -2
@@ -957,8 +957,7 @@ void blk_unregister_queue(struct gendisk *disk)blk_trace_remove_sysfs (disk_to_dev (disk));mutex_lock (&q->sysfs_lock); -if (q->elevator) -elv_unregister_queue (q); +elv_unregister_queue (q);disk_unregister_independent_access_ranges (disk);mutex_unlock (&q->sysfs_lock);mutex_unlock (&q->sysfs_dir_lock);
block/elevator.c +4 -4
@@ -516,9 +516,11 @@ int elv_register_queue(struct request_queue *q, bool uevent)void elv_unregister_queue (struct request_queue *q) { +struct elevator_queue *e = q->elevator; +lockdep_assert_held (&q->sysfs_lock); -if (q) { +if (e && e->registered) {struct elevator_queue *e = q->elevator;kobject_uevent (&e->kobj,KOBJ_REMOVE );
@@ -593,9 +595,7 @@ int elevator_switch_mq(struct request_queue *q,lockdep_assert_held (&q->sysfs_lock);if (q->elevator) { -if (q->elevator->registered) -elv_unregister_queue (q); - +elv_unregister_queue (q);ioc_clear_queue (q);blk_mq_sched_free_rqs (q);elevator_exit (q);
Signature · 1 line
2.34.1
PATCH v2 2/3 block: don't delete queue kobject before its children
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
kobjects aren't supposed to be deleted before their child kobjects are deleted. Apparently this is usually benign; however, a WARN will be triggered if one of the child kobjects has a named attribute group:
sysfs group 'modes' not found for kobject 'crypto'
WARNING: CPU: 0 PID: 1 at fs/sysfs/group.c:278 sysfs_remove_group+0x72/0x80
...
Call Trace:
sysfs_remove_groups+0x29/0x40 fs/sysfs/group.c:312
__kobject_del+0x20/0x80 lib/kobject.c:611
kobject_cleanup+0xa4/0x140 lib/kobject.c:696
kobject_release lib/kobject.c:736 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x53/0x70 lib/kobject.c:753
blk_crypto_sysfs_unregister+0x10/0x20 block/blk-crypto-sysfs.c:159
blk_unregister_queue+0xb0/0x110 block/blk-sysfs.c:962
del_gendisk+0x117/0x250 block/genhd.c:610Fix this by moving the kobject_del() and the corresponding kobject_uevent() to the correct place.
--- block/blk-sysfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
block/blk-sysfs.c +5 -3
@@ -951,15 +951,17 @@ void blk_unregister_queue(struct gendisk *disk)*/ if (queue_is_mq (q))blk_mq_unregister_dev (disk_to_dev (disk), q); - -kobject_uevent (&q->kobj,KOBJ_REMOVE ); -kobject_del (&q->kobj);blk_trace_remove_sysfs (disk_to_dev (disk));mutex_lock (&q->sysfs_lock);elv_unregister_queue (q);disk_unregister_independent_access_ranges (disk);mutex_unlock (&q->sysfs_lock); + +/* Now that all child objects were deleted, the queue can be deleted. */ +kobject_uevent (&q->kobj,KOBJ_REMOVE ); +kobject_del (&q->kobj); +mutex_unlock (&q->sysfs_dir_lock);kobject_put (&disk_to_dev (disk)->kobj);
Signature · 1 line
2.34.1
PATCH v2 3/3 blk-crypto: show crypto capabilities in sysfs
In reply to Eric BiggersFrom: Eric Biggers <[email protected]>
Add sysfs files that expose the inline encryption capabilities of request queues:
/sys/class/block/$disk/queue/crypto/max_dun_bits /sys/class/block/$disk/queue/crypto/modes/$mode /sys/class/block/$disk/queue/crypto/num_keyslots
Userspace can use these new files to decide what encryption settings to use, or whether to use inline encryption at all. This also brings the crypto capabilities in line with the other queue properties, which are already discoverable via the queue directory in sysfs.
Design notes:
- Place the new files in a new subdirectory "crypto" to group them together and to avoid complicating the main "queue" directory. This also makes it possible to replace "crypto" with a symlink later if we ever make the blk_crypto_profiles into real kobjects (see below).
- It was necessary to define a new kobject that corresponds to the crypto subdirectory. For now, this kobject just contains a pointer to the blk_crypto_profile. Note that multiple queues (and hence multiple such kobjects) may refer to the same blk_crypto_profile.
An alternative design would more closely match the current kernel data structures: the blk_crypto_profile could be a kobject itself, located directly under the host controller device's kobject, while /sys/class/block/$disk/queue/crypto would be a symlink to it.
I decided not to do that for now because it would require a lot more changes, such as no longer embedding blk_crypto_profile in other structures, and also because I'm not sure we can rule out moving the crypto capabilities into 'struct queue_limits' in the future. (Even if multiple queues share the same crypto engine, maybe the supported data unit sizes could differ due to other queue properties.) It would also still be possible to switch to that design later without breaking userspace, by replacing the directory with a symlink.
- Use "max_dun_bits" instead of "max_dun_bytes". Currently, the kernel internally stores this value in bytes, but that's an implementation detail. It probably makes more sense to talk about this value in bits, and choosing bits is more future-proof.
- "modes" is a sub-subdirectory, since there may be multiple supported crypto modes, and sysfs is supposed to have one value per file.
- Each mode had to be named. The crypto API names like "xts(aes)" are not appropriate because they don't specify the key size. Therefore, I assigned new names. The exact names chosen are arbitrary, but they happen to match the names used in log messages in fs/crypto/.
- The "num_keyslots" file is a bit different from the others in that it is only useful to know for performance reasons. However, it's included as it can still be useful. For example, a user might not want to use inline encryption if there aren't very many keyslots.
--- Documentation/block/queue-sysfs.rst | 30 +++++ block/Makefile | 3 +- block/blk-crypto-internal.h | 12 ++ block/blk-crypto-sysfs.c | 172 ++++++++++++++++++++++++++++ block/blk-crypto.c | 3 + block/blk-sysfs.c | 6 + include/linux/blkdev.h | 1 + 7 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 block/blk-crypto-sysfs.c
Documentation/block/queue-sysfs.rst +30 -0
@@ -24,6 +24,36 @@ or host-managed, chunk_sectors indicates the size in 512B sectors of the zones of the device, with the eventual exception of the last zone of the device which may be smaller. +crypto +------ +This subdirectory is present if the device supports inline encryption. +(See :ref:`Documentation/block/inline-encryption.rst <inline_encryption>`.) +This subdirectory contains the following files and subdirectories which describe +the inline encryption capabilities of the device: + +max_dun_bits (RO) +~~~~~~~~~~~~~~~~~ +The maximum length, in bits, of data unit numbers (DUNs) accepted by the device. + +modes +~~~~~ +This subdirectory contains one file (RO) per crypto mode the device supports. +Each such file contains a hexadecimal number that is a bitmask of the supported +data unit sizes, in bytes, for the crypto mode. + +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 with data unit sizes of 512 and +4096 bytes, the file "AES-256-XTS" will be present and will contain "0x1200". + +num_keyslots (RO) +~~~~~~~~~~~~~~~~~ +The number of crypto keyslots the device has. + dax (RO) -------- This file indicates whether the device supports Direct Access (DAX),
block/Makefile +2 -1
@@ -36,6 +36,7 @@ obj-$(CONFIG_BLK_DEBUG_FS) += blk-mq-debugfs.o obj-$(CONFIG_BLK_DEBUG_FS_ZONED)+= blk-mq-debugfs-zoned.o obj-$(CONFIG_BLK_SED_OPAL) += sed-opal.o obj-$(CONFIG_BLK_PM) += blk-pm.o -obj-$(CONFIG_BLK_INLINE_ENCRYPTION) += blk-crypto.o blk-crypto-profile.o +obj-$(CONFIG_BLK_INLINE_ENCRYPTION) += blk-crypto.o blk-crypto-profile.o \ + blk-crypto-sysfs.o obj-$(CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK) += blk-crypto-fallback.o obj-$(CONFIG_BLOCK_HOLDER_DEPRECATED) += holder.o
block/blk-crypto-internal.h +12 -0
@@ -11,6 +11,7 @@/* Represents a crypto mode supported by blk-crypto */ struct blk_crypto_mode { +const char *name;/* name of this mode, shown in sysfs */ const char *cipher_str;/* crypto API name (for fallback case) */ unsigned int keysize;/* key size in bytes */ unsigned int ivsize;/* iv size in bytes */
@@ -20,6 +21,10 @@ extern const struct blk_crypto_mode blk_crypto_modes[];#ifdef CONFIG_BLK_INLINE_ENCRYPTION +int blk_crypto_sysfs_register (struct request_queue *q); + +void blk_crypto_sysfs_unregister (struct request_queue *q); +void bio_crypt_dun_increment (u64 dun[BLK_CRYPTO_DUN_ARRAY_SIZE ],unsigned int inc);
@@ -62,6 +67,13 @@ static inline bool blk_crypto_rq_is_encrypted(struct request *rq)#else /* CONFIG_BLK_INLINE_ENCRYPTION */ +static inline int blk_crypto_sysfs_register (struct request_queue *q) +{ +return 0 ; +} + +static inline void blk_crypto_sysfs_unregister (struct request_queue *q) { } +static inline bool bio_crypt_rq_ctx_compatible (struct request *rq,struct bio *bio) {
block/blk-crypto-sysfs.c new file +172 -0
172 lines not on this page · raw message
block/blk-crypto.c +3 -0
@@ -19,16 +19,19 @@const struct blk_crypto_mode blk_crypto_modes[] = { [BLK_ENCRYPTION_MODE_AES_256_XTS ] = { + .name ="AES-256-XTS" , .cipher_str ="xts(aes)" , .keysize =64 , .ivsize =16 , }, [BLK_ENCRYPTION_MODE_AES_128_CBC_ESSIV ] = { + .name ="AES-128-CBC-ESSIV" , .cipher_str ="essiv(cbc(aes),sha256)" , .keysize =16 , .ivsize =16 , }, [BLK_ENCRYPTION_MODE_ADIANTUM ] = { + .name ="Adiantum" , .cipher_str ="adiantum(xchacha12,aes)" , .keysize =32 , .ivsize =32 ,
block/blk-sysfs.c +6 -0
@@ -876,6 +876,10 @@ int blk_register_queue(struct gendisk *disk) goto put_dev; } + ret =blk_crypto_sysfs_register (q); +if (ret) + goto put_dev; +blk_queue_flag_set (QUEUE_FLAG_REGISTERED , q);wbt_enable_default (q);blk_throtl_register_queue (q);
@@ -907,6 +911,7 @@ int blk_register_queue(struct gendisk *disk)return ret; put_dev: +elv_unregister_queue (q);disk_unregister_independent_access_ranges (disk);mutex_unlock (&q->sysfs_lock);mutex_unlock (&q->sysfs_dir_lock);
@@ -951,6 +956,7 @@ void blk_unregister_queue(struct gendisk *disk)*/ if (queue_is_mq (q))blk_mq_unregister_dev (disk_to_dev (disk), q); +blk_crypto_sysfs_unregister (q);blk_trace_remove_sysfs (disk_to_dev (disk));mutex_lock (&q->sysfs_lock);
include/linux/blkdev.h +1 -0
@@ -261,6 +261,7 @@ struct request_queue {#ifdef CONFIG_BLK_INLINE_ENCRYPTION struct blk_crypto_profile *crypto_profile; +struct kobject *crypto_kobject;#endif unsigned int rq_timeout;
Signature · 1 line
2.34.1
v2 cover block: show crypto capabilities in sysfs
This series adds sysfs files that expose the inline encryption capabilities of request queues.
Patches 1 and 2 are some related cleanups for existing blk-sysfs code. Patch 3 is the real change; see there for more details.
This applies to linux-block/for-next.
Changed v1 => v2:
- Use sysfs_emit() instead of sprintf().
- Use __ATTR_RO().
Eric Biggers (3):
block: simplify calling convention of elv_unregister_queue()
block: don't delete queue kobject before its children
blk-crypto: show crypto capabilities in sysfs
Documentation/block/queue-sysfs.rst | 30 +++++ block/Makefile | 3 +- block/blk-crypto-internal.h | 12 ++ block/blk-crypto-sysfs.c | 172 ++++++++++++++++++++++++++++ block/blk-crypto.c | 3 + block/blk-sysfs.c | 17 ++- block/elevator.c | 8 +- include/linux/blkdev.h | 1 + 8 files changed, 236 insertions(+), 10 deletions(-) create mode 100644 block/blk-crypto-sysfs.c
base-commit: c2626d30f312afc341158e07bf088f5a23b4eeeb
Signature · 1 line
2.34.1
Re: [PATCH v2 1/3] block: simplify calling convention of elv_unregister_queue()
In reply to Eric BiggersQuoted 8 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Make
elv_unregister_queue()a no-op ifq->elevatoris NULL or is not registered.This simplifies the existing callers, as well as the future caller in the error path of
blk_register_queue().
Quoted 8 lines
Also don't bother checking whether q is NULL, since it never is.
Signed-off-by Eric Biggers <[email protected]>--- block/blk-sysfs.c | 3 +-- block/elevator.c | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 2/3] block: don't delete queue kobject before its children
In reply to Eric BiggersQuoted 20 lines · Eric Biggers
From: Eric Biggers <[email protected]>
kobjects aren't supposed to be deleted before their child kobjects are deleted. Apparently this is usually benign; however, a WARN will be triggered if one of the child kobjects has a named attribute group:
sysfs group 'modes' not found for kobject 'crypto' WARNING: CPU: 0 PID: 1 at fs/sysfs/group.c:278 sysfs_remove_group+0x72/0x80 ... Call Trace: sysfs_remove_groups+0x29/0x40 fs/sysfs/group.c:312 __kobject_del+0x20/0x80 lib/kobject.c:611 kobject_cleanup+0xa4/0x140 lib/kobject.c:696 kobject_release lib/kobject.c:736 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x53/0x70 lib/kobject.c:753 blk_crypto_sysfs_unregister+0x10/0x20 block/blk-crypto-sysfs.c:159 blk_unregister_queue+0xb0/0x110 block/blk-sysfs.c:962 del_gendisk+0x117/0x250 block/genhd.c:610
Quoted 9 lines
Fix this by moving the
kobject_del()and the correspondingkobject_uevent()to the correct place.Fixes 2c2086afc2b8 ("block: Protect less code with sysfs_lock in blk_{un,}register_queue()")Signed-off-by Eric Biggers <[email protected]>--- block/blk-sysfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 3/3] blk-crypto: show crypto capabilities in sysfs
In reply to Eric BiggersQuoted 40 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Add sysfs files that expose the inline encryption capabilities of request queues:
/sys/class/block/$disk/queue/crypto/max_dun_bits/sys/class/block/$disk/queue/crypto/modes/$mode/sys/class/block/$disk/queue/crypto/num_keyslotsUserspace can use these new files to decide what encryption settings to use, or whether to use inline encryption at all. This also brings the crypto capabilities in line with the other queue properties, which are already discoverable via the queue directory in sysfs.
Design notes:
- Place the new files in a new subdirectory "crypto" to group them together and to avoid complicating the main "queue" directory. This also makes it possible to replace "crypto" with a symlink later if we ever make the
blk_crypto_profilesinto real kobjects (see below).- It was necessary to define a new kobject that corresponds to the crypto subdirectory. For now, this kobject just contains a pointer to the
blk_crypto_profile. Note that multiple queues (and hence multiple such kobjects) may refer to the sameblk_crypto_profile.An alternative design would more closely match the current kernel data structures: the
blk_crypto_profilecould be a kobject itself, located directly under the host controller device's kobject, while/sys/class/block/$disk/queue/cryptowould be a symlink to it.I decided not to do that for now because it would require a lot more changes, such as no longer embedding
blk_crypto_profilein other structures, and also because I'm not sure we can rule out moving the crypto capabilities into 'structqueue_limits' in the future. (Even if multiple queues share the same crypto engine, maybe the supported data unit sizes could differ due to other queue properties.) It would also still be possible to switch to that design later without breaking userspace, by replacing the directory with a symlink.
Quoted 8 lines
- Use "
max_dun_bits" instead of "max_dun_bytes". Currently, the kernel internally stores this value in bytes, but that's an implementation detail. It probably makes more sense to talk about this value in bits, and choosing bits is more future-proof.- "modes" is a sub-subdirectory, since there may be multiple supported crypto modes, and sysfs is supposed to have one value per file.
Why do you have a sub-directory here?
From what I can see, that subdirectory just contains the supported modes, so wouldn't it be easier to create individual files like 'mode_<modename>' instead of a subdirectory?
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Re: [PATCH v2 2/3] block: don't delete queue kobject before its children
In reply to Eric BiggersQuoted 57 lines · Eric Biggers
From: Eric Biggers <[email protected]>
kobjects aren't supposed to be deleted before their child kobjects are deleted. Apparently this is usually benign; however, a WARN will be triggered if one of the child kobjects has a named attribute group:
sysfs group 'modes' not found for kobject 'crypto' WARNING: CPU: 0 PID: 1 at fs/sysfs/group.c:278 sysfs_remove_group+0x72/0x80 ... Call Trace: sysfs_remove_groups+0x29/0x40 fs/sysfs/group.c:312 __kobject_del+0x20/0x80 lib/kobject.c:611 kobject_cleanup+0xa4/0x140 lib/kobject.c:696 kobject_release lib/kobject.c:736 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x53/0x70 lib/kobject.c:753 blk_crypto_sysfs_unregister+0x10/0x20 block/blk-crypto-sysfs.c:159 blk_unregister_queue+0xb0/0x110 block/blk-sysfs.c:962 del_gendisk+0x117/0x250 block/genhd.c:610Fix this by moving the
kobject_del()and the correspondingkobject_uevent()to the correct place.Fixes 2c2086afc2b8 ("block: Protect less code with sysfs_lock in blk_{un,}register_queue()")Signed-off-by Eric Biggers <[email protected]>--- block/blk-sysfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)block/blk-sysfs.c +5
-3@@ -951,15 +951,17 @@ void blk_unregister_queue(struct gendisk *disk)*/ if (queue_is_mq (q))blk_mq_unregister_dev (disk_to_dev (disk), q); - -kobject_uevent (&q->kobj,KOBJ_REMOVE ); -kobject_del (&q->kobj);blk_trace_remove_sysfs (disk_to_dev (disk));mutex_lock (&q->sysfs_lock);elv_unregister_queue (q);disk_unregister_independent_access_ranges (disk);mutex_unlock (&q->sysfs_lock); + +/* Now that all child objects were deleted, the queue can be deleted. */ +kobject_uevent (&q->kobj,KOBJ_REMOVE ); +kobject_del (&q->kobj); +mutex_unlock (&q->sysfs_dir_lock);kobject_put (&disk_to_dev (disk)->kobj);Signature · 1 line
2.34.1
Re: [PATCH v2 3/3] blk-crypto: show crypto capabilities in sysfs
In reply to Eric BiggersQuoted 53 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Add sysfs files that expose the inline encryption capabilities of request queues:
/sys/class/block/$disk/queue/crypto/max_dun_bits/sys/class/block/$disk/queue/crypto/modes/$mode/sys/class/block/$disk/queue/crypto/num_keyslotsUserspace can use these new files to decide what encryption settings to use, or whether to use inline encryption at all. This also brings the crypto capabilities in line with the other queue properties, which are already discoverable via the queue directory in sysfs.
Design notes:
- Place the new files in a new subdirectory "crypto" to group them together and to avoid complicating the main "queue" directory. This also makes it possible to replace "crypto" with a symlink later if we ever make the
blk_crypto_profilesinto real kobjects (see below).- It was necessary to define a new kobject that corresponds to the crypto subdirectory. For now, this kobject just contains a pointer to the
blk_crypto_profile. Note that multiple queues (and hence multiple such kobjects) may refer to the sameblk_crypto_profile.An alternative design would more closely match the current kernel data structures: the
blk_crypto_profilecould be a kobject itself, located directly under the host controller device's kobject, while/sys/class/block/$disk/queue/cryptowould be a symlink to it.I decided not to do that for now because it would require a lot more changes, such as no longer embedding
blk_crypto_profilein other structures, and also because I'm not sure we can rule out moving the crypto capabilities into 'structqueue_limits' in the future. (Even if multiple queues share the same crypto engine, maybe the supported data unit sizes could differ due to other queue properties.) It would also still be possible to switch to that design later without breaking userspace, by replacing the directory with a symlink.- Use "
max_dun_bits" instead of "max_dun_bytes". Currently, the kernel internally stores this value in bytes, but that's an implementation detail. It probably makes more sense to talk about this value in bits, and choosing bits is more future-proof.- "modes" is a sub-subdirectory, since there may be multiple supported crypto modes, and sysfs is supposed to have one value per file.
- Each mode had to be named. The crypto API names like "xts(aes)" are not appropriate because they don't specify the key size. Therefore, I assigned new names. The exact names chosen are arbitrary, but they happen to match the names used in log messages in
fs/crypto/.
Quoted 8 lines
- The "
num_keyslots" file is a bit different from the others in that it is only useful to know for performance reasons. However, it's included as it can still be useful. For example, a user might not want to use inline encryption if there aren't very many keyslots.Signed-off-by Eric Biggers <[email protected]>--- Documentation/block/queue-sysfs.rst | 30 +++++
Same objection as before. Please add these to Documentation/ABI/ otherwise when running 'scripts/get_abi undefined' will show these new sysfs files you are adding as having no documentation :(
thanks,
greg k-h
Re: [PATCH v2 3/3] blk-crypto: show crypto capabilities in sysfs
Quoted 3 lines · Greg Kroah-Hartman
Quoted 1 line
Documentation/block/queue-sysfs.rst | 30 +++++Same objection as before. Please add these to
Documentation/ABI/
As I said before, this is where all the blk-sysfs stuff is documented currently. If you consider this a hard requirement, then I'll get started on a patch that moves all of queue-sysfs.rst into Documentation/ABI/, as it's silly to change it for just this one and not the 23 other blk-sysfs attributes with exactly the same issue.
Quoted 2 lines
otherwise when running '
scripts/get_abiundefined' will show these new sysfs files you are adding as having no documentation :(
Perhaps this should be part of checkpatch?
- Eric
Re: [PATCH v2 3/3] blk-crypto: show crypto capabilities in sysfs
In reply to Hannes ReineckeQuoted 7 lines · Hannes Reinecke
Quoted 3 lines
- "modes" is a sub-subdirectory, since there may be multiple supported crypto modes, and sysfs is supposed to have one value per file.
Why do you have a sub-directory here?
From what I can see, that subdirectory just contains the supported modes, so wouldn't it be easier to create individual files like 'mode_<modename>' instead of a subdirectory?
It is a group of attributes, so it makes sense to group them together rather than put them all in the parent directory alongside other attributes. It also allows the use of proper names like "AES-256-XTS" rather than weird names like "mode_AES-256-XTS" or "mode_aes_256_xts".
- Eric
Re: [PATCH v2 3/3] blk-crypto: show crypto capabilities in sysfs
In reply to Eric BiggersQuoted 10 lines · Eric Biggers
Quoted 3 lines · Greg Kroah-Hartman
Quoted 1 line
Documentation/block/queue-sysfs.rst | 30 +++++Same objection as before. Please add these to
Documentation/ABI/As I said before, this is where all the blk-sysfs stuff is documented currently. If you consider this a hard requirement, then I'll get started on a patch that moves all of
queue-sysfs.rstintoDocumentation/ABI/, as it's silly to change it for just this one and not the 23 other blk-sysfs attributes with exactly the same issue.
If I don't complain about it, nothing will ever change :)
Quoted 4 lines
Quoted 2 lines
otherwise when running '
scripts/get_abiundefined' will show these new sysfs files you are adding as having no documentation :(Perhaps this should be part of checkpatch?
It's hard as that requires the code that the patch is checking to be running on the system you run checkpatch on.
thanks,
greg k-h
Hannes Reinecke
Reviewed-byRe: [PATCH v2 3/3] blk-crypto: show crypto capabilities in sysfs
In reply to Eric BiggersQuoted 9 lines · Eric Biggers
Quoted 7 lines · Hannes Reinecke
Quoted 3 lines
- "modes" is a sub-subdirectory, since there may be multiple supported crypto modes, and sysfs is supposed to have one value per file.
Why do you have a sub-directory here?
From what I can see, that subdirectory just contains the supported modes, so
wouldn't it be easier to create individual files like 'mode_<modename>' instead of a subdirectory?
Quoted 5 lines
It is a group of attributes, so it makes sense to group them together rather than put them all in the parent directory alongside other attributes. It also allows the use of proper names like "AES-256-XTS" rather than weird names like "mode_AES-256-XTS" or "
mode_aes_256_xts".
Right.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer