On 9/18/21 02:07, Greg KH wrote:
On Fri, Sep 17, 2021 at 03:46:55PM -0500, Ian Pilcher wrote:
As far as using kernel names, that would be my preference, but I simply
don't know of any way to do so with the existing block API. To my
knowledge, there simply isn't anything like a blkdev_get_by_name() API.
...
Just use the kernel block device name and that way you do not have to
parse anything as it is unique and no paths are having to be followed.
That's the way that other LED apis are working, right?
Greg -
There are 2 existing LED triggers that have similar functionality (i.e.
they allow LEDs to be "associated" with devices by name), and they both
use subsystem-specific APIs to "resolve" those names to the actual
kernel objects on which they operate.
* The *netdev* trigger uses dev_get_by_name(), which is specific to
network devices (despite its name).
* The *tty* trigger uses tty_dev_name_to_number() and
tty_kopen_shared().
As I've been saying, I simply don't know of any similar API for block
devices. The block API provides blkdev_get_by_path(), which I am using,
and blkdev_get_by_dev(), which takes the device number (dev_t).
If you know of an API that will allow me to resolve a block device (or
dev_t) by its kernel name, please share that information.
Thanks!
--
========================================================================
In Soviet Russia, Google searches you!
========================================================================