mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Neil Brown <neilb@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: sysfs question:  how to map major:minor to name under /sys
Date: Thu, 15 Dec 2005 17:33:43 -0800	[thread overview]
Message-ID: <20051216013343.GD23832@kroah.com> (raw)
In-Reply-To: <17312.57214.612405.261796@cse.unsw.edu.au>

On Thu, Dec 15, 2005 at 02:14:06PM +1100, Neil Brown wrote:
> 
> Hi,
>  I have a question about sysfs related usage.
> 
>  Suppose I have a major:minor number for a block device - maybe from
>  fstat of a filedescriptor I was given, or stat of a name in /dev.
>  How do I find the directory in /sys/block that contains relevant
>  information? 
> 
>  It seems to me that there is no direct way, and maybe there should
>  be. (I can do a find of 'dev' file and compare, which is fine in a
>  one-off shell script, but sub-optimal in general).

So you want this info from userspace, not from within the kernel, right?

>  The most obvious solution would be to have a directory somewhere full
>  of symlinks:
>         /sys/block_dev/8:0 -> ../block/sda
>  or whatever.
>  Is this reasonable?  Should I try it?

It seems a bit md specific to add a lot of kernel code for something
that can be solved with a userspace shell script :)

But if you want to try it, use a class, and a class_device for this, not
raw kobjects.  It should be a bit easier that way.

thanks,

greg k-h

  reply	other threads:[~2005-12-16  3:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-15  3:14 Neil Brown
2005-12-16  1:33 ` Greg KH [this message]
2005-12-16  3:36   ` Neil Brown

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=20051216013343.GD23832@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    /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

all inboxes | Powered by JetHome®