From: Arjan van de Ven <arjan@infradead.org>
To: Neil Brown <neilb@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH/RFC] allow mapping from block-device-file to sysfs entry.
Date: Mon, 06 Aug 2007 23:37:03 -0700 [thread overview]
Message-ID: <1186468623.2700.4.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <18104.3098.696484.970773@notabene.brown>
On Tue, 2007-08-07 at 16:07 +1000, Neil Brown wrote:
> Suppose that in a program I have an open file descriptor for a device,
> and I want to find the /sys/block information for this device.
> There is currently no direct way to do this. I need to read
> /sys/block/*/dev, /sys/block/*/*/dev
> and match major/minor numbers with the result from fstat.
>
> I would like a more direct mechanism.
>
> The following patch is a proposal for such a mechanism.
>
> It provides an 'ioctl' which returns then 'name' of the device, as
> generated by bdevname. This is the same name that is used to create
> entries in sysfs.
> For a partition of a device, it returns 'device/partition'.
how about returning the entire path relative to the start of sysfs? That
way, if things move or something you're tolerant against that....
(I'd not be against making this a generic IOCTL for every device, a
SYSFSLOCATION kind of ioctl... it's by no means block specific...)
next prev parent reply other threads:[~2007-08-07 6:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-07 6:07 Neil Brown
2007-08-07 6:37 ` Arjan van de Ven [this message]
2007-08-07 7:13 ` Neil Brown
2007-08-07 7:41 ` Kay Sievers
2007-08-09 6:50 ` Neil Brown
2007-08-09 9:54 ` Kay Sievers
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=1186468623.2700.4.camel@laptopd505.fenrus.org \
--to=arjan@infradead.org \
--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®