Skip to contentSkip to conversation

sysfs support for sg

DISCUSSION Olaf Hering 3 participants 5 messages Jan 7, 2004 – Jan 8, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

Hello,

are there any plans to add sysfs support to the sg driver? I see no 'dev' nodes for it.
Can stuff like 'sg_start /dev/sg2 0' be done in another way?

Signature · 7 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 5 lines · Olaf Hering

Hello,

are there any plans to add sysfs support to the sg driver? I see no 'dev' nodes for it.
Can stuff like 'sg_start /dev/sg2 0' be done in another way?

I missed the /sys/block/sda/device/generic symlink. But still, no dev node. Is that supposed to work that way?

Signature · 7 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 5 lines · Olaf Hering
Quoted 2 lines · Olaf Hering

Hello,

Quoted 7 lines
Quoted 3 lines

are there any plans to add sysfs support to the sg driver? I see no 'dev' nodes for it.
Can stuff like 'sg_start /dev/sg2 0' be done in another way?

I missed the /sys/block/sda/device/generic symlink. But still, no dev node. Is that supposed to work that way?

Olaf,
lk 2.6.0-rc1 has added sysfs support for sg with /sys/cdev/major/sg<n> . In that directory
is a symlink to the corresponding SCSI device. When that symlink is followed the target directory has a symlink called 'generic' back to /sys/cdev/major/sg<n>. The st driver has similar cdev bidirectional mapping (and hopefully osst will soon follow).

An example is attached. [BTW 'getcwd' returns the "true" path as described in "man 3 getcwd".]

The "cdev" changes in the sg and st drivers allow more than 256 devices to be handled. The sg driver limits the number of devices to 8192. I believe sd is still limited to 128 devices and I not sure about the device limits of sr.

Currently the sg driver lacks driver parameter support within sysfs (e.g. 'allow_dio' as found in the /proc/scsi/sg directory). Interestingly the st and osst drivers have /sys/bus/scsi/drivers/st and osst directories (sd and st drivers also get directories if their drivers are loaded). It is useful to be able to access ULDs _prior_ to any (scsi) devices being attached which is not possible under lk 2.4 .

I have been looking at the lsscsi program again which has been dormant for 6 months. A symlink that I miss is from a scsi host (enumerated in the /sys/class/scsi_host directory) to the driver (and its name) that controls it.

BTW Is there a definitive libsysfs site anywhere? I noticed that scsi_id provided in the "extras" directory of udev-009 doesn't build with the libsysfs provided by udev-009.

Doug Gilbert

# cd /sys/cdev/major/sg0
# ls
device
# tree
.
`-- device -> ../../../devices/pci0000:00/0000:00:0e.0/host0/0:0:1:0

1 directory, 0 files

# cd device/
# ls
block   detach_state    generic  online  queue_depth  rev         type
delete  device_blocked  model    power   rescan       scsi_level  vendor
# cd generic/
# getcwd
/sys/cdev/major/sg0
#3 lore raw
Quoted 7 lines · Douglas Gilbert

Currently the sg driver lacks driver parameter support within sysfs (e.g. 'allow_dio' as found in the /proc/scsi/sg directory). Interestingly the st and osst drivers have /sys/bus/scsi/drivers/st and osst directories (sd and st drivers also get directories if their drivers are loaded). It is useful to be able to access ULDs _prior_ to any (scsi) devices being attached which is not possible under lk 2.4 .

... and I missed the most glaring omission from /sys/bus/scsi/drivers which is the scsi mid level driver itself. Many interesting potential parameters come to mind, 'no_scan' for example.

Doug Gilbert