From: Ian Pilcher <arequipeno@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: linux-leds@vger.kernel.org, kabel@kernel.org
Subject: Re: [PATCH v11 1/2] docs: Add block device (blkdev) LED trigger documentation
Date: Sat, 24 Sep 2022 12:28:19 -0500 [thread overview]
Message-ID: <ee73f8b1-8c5d-b24d-459c-e972efeeeeae@gmail.com> (raw)
In-Reply-To: <20220921110547.GC22654@duo.ucw.cz>
On 9/21/22 06:05, Pavel Machek wrote:
>> +What: /sys/class/leds/<led>/check_interval
>> +Date: September 2022
>> +Contact: Ian Pilcher <arequipeno@gmail.com>
>> +Description:
>> + Frequency (in milliseconds) with which block devices linked to
>> + this LED will be checked for activity and the LED will
>> + (potentially) be blinked.
>
> Frequency -> interval.
Will do.
>> +What: /sys/class/leds/<led>/link_dev_by_path
>> +Date: September 2022
>> +Contact: Ian Pilcher <arequipeno@gmail.com>
>> +Description:
>> + Associate a block device with this LED by writing the path to
>> + the device special file (e.g. /dev/sda) to this attribute.
>> + Symbolic links are followed.
>
> Following symbolic links to paths written to file is "interesting".
This is the behavior of blkdev_get_by_path(), and I haven't been able to
find any other way to "resolve" a block device (struct block_device *)
from a name (and I have asked for suggestions multiple times).
>> +What: /sys/class/leds/<led>/linked_devices
>> +Date: September 2022
>> +Contact: Ian Pilcher <arequipeno@gmail.com>
>> +Description:
>> + Directory containing links to all block devices that are
>> + associated with this LED. (Note that the names of the
>> + symbolic links in this directory are *kernel* names, which
>> + may not match the device special file paths written to
>> + link_device and unlink_device.)
>
> As is mismatch between kernel names here and what names the other file
> expects.
>
> Can we get something more reasonable?
The real problem is that there is no way to use a kernel name in the
first place. I did think about using the last element of the path that
was used to create the link, but it doesn't really solve the problem
(because you still need to pass the whole path when you unlink the
device) and it introduces the possibility of duplicate names.
The cover letter for these patches say this:
> (I hope that if this module is accepted, it might provide a case for
> adding a "by name" API to the block subsystem. link_dev_by_name and
> unlink_dev_by_name could then be added to this trigger.)
The one thing that I can think of is to go ahead and add an
unlink_dev_by_name attribute, so the kernel names in an LED's
linked_devices directory could be use to unlink them. (Once a device
is "linked", I can access its name.)
So there would be both _by_path and _by_name variants for unlinking
block devices from LEDs, but linking would would still require using a
path.
How does that sound?
--
========================================================================
Google Where SkyNet meets Idiocracy
========================================================================
next prev parent reply other threads:[~2022-09-24 17:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 20:50 [PATCH v11 0/2] Introduce block device LED trigger Ian Pilcher
2022-09-15 20:50 ` [PATCH v11 1/2] docs: Add block device (blkdev) LED trigger documentation Ian Pilcher
2022-09-21 11:05 ` Pavel Machek
2022-09-24 17:28 ` Ian Pilcher [this message]
2022-09-15 20:50 ` [PATCH v11 2/2] leds: trigger: Add block device LED trigger Ian Pilcher
2022-09-20 8:34 ` [PATCH v11 0/2] Introduce " Lee Jones
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ee73f8b1-8c5d-b24d-459c-e972efeeeeae@gmail.com \
--to=arequipeno@gmail.com \
--cc=kabel@kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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).