diff mbox series

[v3,2/3] block: export block_class for use by the blkdev LED trigger

Message ID 20210914201713.14922-3-arequipeno@gmail.com
State New
Headers show
Series Introduce block device LED trigger | expand

Commit Message

Ian Pilcher Sept. 14, 2021, 8:17 p.m. UTC
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 <arequipeno@gmail.com>
---
 block/genhd.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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,
 };
+EXPORT_SYMBOL_NS_GPL(block_class, LEDTRIG_BLKDEV);
 
 static char *block_devnode(struct device *dev, umode_t *mode,
 			   kuid_t *uid, kgid_t *gid)