linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Pilcher <arequipeno@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: hch@infradead.org, pavel@ucw.cz, linux-leds@vger.kernel.org,
	linux-kernel@vger.kernel.org, kabel@kernel.org
Subject: Re: [PATCH v4 1/2] docs: Add block device (blkdev) LED trigger documentation
Date: Sat, 18 Sep 2021 09:43:31 -0500	[thread overview]
Message-ID: <27568193-170d-af8e-9667-b6cce97c27df@gmail.com> (raw)
In-Reply-To: <YUWQSlXjIb58eCJZ@kroah.com>

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!
========================================================================

  reply	other threads:[~2021-09-18 14:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 20:21 [PATCH v4 0/2] Introduce block device LED trigger Ian Pilcher
2021-09-16 20:21 ` [PATCH v4 1/2] docs: Add block device (blkdev) LED trigger documentation Ian Pilcher
2021-09-17  6:19   ` Greg KH
2021-09-17 20:46     ` Ian Pilcher
2021-09-18  7:07       ` Greg KH
2021-09-18 14:43         ` Ian Pilcher [this message]
2021-09-20  6:43         ` Christoph Hellwig
2021-10-05 12:24           ` Marek Behún
2021-09-16 20:21 ` [PATCH v4 2/2] leds: trigger: Add block device LED trigger Ian Pilcher
2021-09-17  5:53   ` Christoph Hellwig

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=27568193-170d-af8e-9667-b6cce97c27df@gmail.com \
    --to=arequipeno@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=kabel@kernel.org \
    --cc=linux-kernel@vger.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).