Skip to contentSkip to conversation

sg: char_devs + seq_file lk2.6.0t6

PATCH+RFC Douglas Gilbert 1 participant 3 messages Oct 7, 2003 – Nov 7, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

Changes to scsi generic (sg) driver [gzipped patch against lk 2.6.0-test6]:
- add "struct cdev" [char_devs] objects to increase maximum number of sg devices from 256 to 8192
- use seq_file interface for /proc/scsi/sg/* pseudo files

The first change re-introduces sg devices into sysfs. Each sg device has a directory (currently empty) with a name of the form: "/sys/cdev/major/sg<n>". When I tried adding 280 scsi "devices" with scsi_debug all the expected sg directories appeared (sg0..sg279). However sd registered the first 256 "disks" (up to /dev/sdiv) and failed thereafter with error "-16" (is anybody working on extending sd's disk and partition range?).

Would it be possible to put a symbolic link in the /sys/cdev/major/sg<n> directory to the corresponding sysfs scsi device (and vice versa)?

Doug Gilbert

#1 lore raw
Quoted 16 lines · Douglas Gilbert

Changes to scsi generic (sg) driver [gzipped patch against lk 2.6.0-test6]:
- add "struct cdev" [char_devs] objects to increase maximum number of sg devices from 256 to 8192
- use seq_file interface for /proc/scsi/sg/* pseudo files

The first change re-introduces sg devices into sysfs. Each sg device has a directory (currently empty) with a name of the form: "/sys/cdev/major/sg<n>". When I tried adding 280 scsi "devices" with scsi_debug all the expected sg directories appeared (sg0..sg279). However sd registered the first 256 "disks" (up to /dev/sdiv) and failed thereafter with error "-16" (is anybody working on extending sd's disk and partition range?).

Quoted 3 lines

Would it be possible to put a symbolic link in the /sys/cdev/major/sg<n> directory to the corresponding sysfs scsi device (and vice versa)?

Well nobody objected so attached is another patch on sg (as found in lk 2.6.0-test7) that additionally sets up two symlinks from /sys/cdev/major/sg<n> to the corresponding scsi device in sysfs and back again. A pruned sysfs "tree" is also attached to illustrate.

Now I need to find somewhere in sysfs to place sg's driver attributes (e.g. "allow_dio"). char_devs seem to be deficient in this respect.

Doug Gilbert

.

|-- block
|   ...
|   |-- sda
|       |-- dev
|       |-- device -> ../../devices/pseudo_0/adapter0/host1/1:0:0:0
|       |-- queue
|        .......
|-- bus
|   ......
|   |-- pseudo
|   |   |-- devices
|   |   |   `-- adapter0 -> ../../../devices/pseudo_0/adapter0
|   |   `-- drivers
|   |       `-- scsi_debug
|   |           |-- adapter0 -> ../../../../devices/pseudo_0/adapter0
|   |           |-- add_host
|   |           .....
|   |-- scsi
|       |-- devices
|       |   `-- 1:0:0:0 -> ../../../devices/pseudo_0/adapter0/host1/1:0:0:0
|       `-- drivers
|           `-- sd
|               `-- 1:0:0:0 -> ../../../../devices/pseudo_0/adapter0/host1/1:0:0:0
|-- cdev
|   ....
|   |-- major
|       |-- sg0
|       |   `-- device -> ../../../devices/pseudo_0/adapter0/host1/1:0:0:0
|-- class
|   ...
|   |-- scsi_device
|   |   `-- 1:0:0:0
|   |       |-- device -> ../../../devices/pseudo_0/adapter0/host1/1:0:0:0
|   |       `-- driver -> ../../../bus/scsi/drivers/sd
|   |-- scsi_host
|       `-- host1
|           |-- cmd_per_lun
|           |-- device -> ../../../devices/pseudo_0/adapter0/host1
|           ....
|-- devices
    ....
    |-- pseudo_0
        |-- adapter0
            |-- detach_state
            |-- host1
                |-- 1:0:0:0
                    |-- block -> ../../../../../block/sda
                    |-- delete
                    |-- detach_state
                    |-- device_blocked
                    |-- generic -> ../../../../../cdev/major/sg0
                    .....
#2 lore raw

[PATCH+RFC] sg: char_devs + seq_file lk2.6.0t9

This is an updated patch for the sg driver that takes into account Patrick LaVarre's fix for negative reserved buffer sizes found in lk 2.6.0-test9.

So it has the same changelog to the patch I sent on 2003/10/11:
- add "struct cdev" [char_devs] objects to increase maximum number of sg devices from 256 to 8192
- use seq_file interface for /proc/scsi/sg/* pseudo files
- sysfs symlinks between the sysfs scsi device and the corresponding sg cdev node (and vice versa)

An edited "tree" output showing an example of these symlinks was included in my previous post.

As noted in another thread, st (and osst) may need "cdevs" and sysfs symlinks so SCSI tape devices have sysfs visibility in lk 2.6 .

Also if both st and sg had sysfs visibility then Patrick Mansfield's scsi_id program could be made to work for tape drives (enclosures, tape robots, etc) by following these symlinks.

Doug Gilbert