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 - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html