archive mirror
 help / color / mirror / Atom feed
From: Ian Pilcher <>
Subject: [PATCH v3 2/3] block: export block_class for use by the blkdev LED trigger
Date: Tue, 14 Sep 2021 15:17:12 -0500	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Export block_class to the LEDTRIG_BLKDEV namespace.

The block device (blkdev) LED trigger periodically checks the activity
counters of block devices and blinks LEDs to reflect that activity.

The specific block device(s) checked can be configured through a
sysfs API.  Once an LED has been associated with the blkdev trigger,
the LED can be "linked" to a block device by writing that device's
name to the LED's link_device attribute.  For example:

  echo sda > /sys/class/leds/<led>/link_device

When a block device name is written to the sysfs attribute, the
trigger uses class_find_device_by_name() to resolve the actual
block_device structure:

  dev = class_find_device_by_name(&block_class, name);

Exporting the block_class symbol makes it possible to build the LED
trigger as a module.

Signed-off-by: Ian Pilcher <>
 block/genhd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/genhd.c b/block/genhd.c
index 7b6e5e1cf956..ebea496bc283 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1076,6 +1076,7 @@ struct class block_class = {
 	.name		= "block",
 	.dev_uevent	= block_uevent,
 static char *block_devnode(struct device *dev, umode_t *mode,
 			   kuid_t *uid, kgid_t *gid)

  parent reply	other threads:[~2021-09-14 20:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 20:17 [PATCH v3 0/3] Introduce block device LED trigger Ian Pilcher
2021-09-14 20:17 ` [PATCH v3 1/3] docs: Add block device (blkdev) LED trigger documentation Ian Pilcher
2021-09-14 20:17 ` Ian Pilcher [this message]
2021-09-15  7:07   ` [PATCH v3 2/3] block: export block_class for use by the blkdev LED trigger Christoph Hellwig
2021-09-14 20:17 ` [PATCH v3 3/3] leds: trigger: Add block device " Ian Pilcher
2021-09-15  5:24   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).