From: Patrick Mansfield <patmans@us.ibm.com>
To: Edward Falk <efalk@google.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: map gendisk (or blockdev) -> scsi_device
Date: Wed, 13 Jul 2005 16:46:54 -0700 [thread overview]
Message-ID: <20050713234654.GA7222@us.ibm.com> (raw)
In-Reply-To: <db3nei$nrs$1@sea.gmane.org>
On Wed, Jul 13, 2005 at 11:44:34AM -0700, Edward Falk wrote:
>
> >You should revisit your code to not need access to the scsi_device
> >structure, and follow the layering of the block and scsi subsystems.
>
> Maybe I should explain what I'm trying to do here.
>
> Some of our software reads some of the values in /proc/ide/hda/. We're
> porting this facility to libata-based drivers in 2.6 and moving it to
> /sysfs/block/sda/. The sysfs show() functions will be given pointers to
> gendisk structures but will need to obtain information from the
> associated scsi_device structure.
>
> Does anybody have any suggestions as to the "right" way to proceed?
Add or use the attributes under the scsi_device, then use the
/sysfs/block/sd/device symlink to find the corresponding scsi_device.
This is similar to what udev and lsscsi use to find device attributes.
udev uses libsysfs (included with udev).
[elm3b79 patman]$ ls -l /sys/block/sdo/device
lrwxrwxrwx 1 root root 0 Jul 13 16:44 /sys/block/sdo/device -> ../../devices/pci0000:01/0000:01:0c.0/host2/rport-2:0-8/target2:0:8/2:0:8:0
[elm3b79 patman]$ ls /sys/block/sdo/device/
block device_blocked iodone_cnt model rescan state vendor
bus driver ioerr_cnt queue_depth rev timeout
delete iocounterbits iorequest_cnt queue_type scsi_level type
-- Patrick Mansfield
next prev parent reply other threads:[~2005-07-13 23:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-13 0:38 map gendisk (or blockdev) -> scsi_device Edward Falk
2005-07-13 1:31 ` Chen, Kenneth W
2005-07-13 14:38 ` Christoph Hellwig
2005-07-13 18:44 ` Edward Falk
2005-07-13 23:46 ` Patrick Mansfield [this message]
2005-07-14 18:38 ` Edward Falk
2005-07-14 19:56 ` Christoph Hellwig
2005-07-14 22:54 ` Edward Falk
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=20050713234654.GA7222@us.ibm.com \
--to=patmans@us.ibm.com \
--cc=efalk@google.com \
--cc=linux-scsi@vger.kernel.org \
/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