Skip to contentSkip to conversation

Update lsscsi to cope with upcoming SCSI sysfs rework

PATCH In review Hannes Reinecke 2 participants 2 messages Mar 18, 2008 – Mar 19, 2008 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Update lsscsi to cope with upcoming SCSI sysfs rework

Hi Doug,

I'm preparing a set of patches to update the SCSI midlayer to play more nicely with the ongoing driver core rework. Part of the patchset is to move every SCSI entity (ie hosts, targets, and devices) into the scsi bus. So /sys/bus/scsi/devices will look like:

hare@yarrow:/tmp> ls /sys/bus/scsi/devices 2:0:4:0 host0 host1 host2 host3 host4 target2:0:4

Currently 'lsscsi' doesn't handle this properly; it needs a simple fix to handle it properly. And as this fix doesn't affect normal parsing we can as well apply it now :-)

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
lsscsi.c renamed from lsscsi.c.orig +4 -0
@@ -1650,6 +1650,10 @@ static int sdev_scandir_select(const str
         if (strstr(s->d_name, "gen"))
                 return 0;
 /* Above no longer needed but leave for early lk 2.6 series */
+	if (!strncmp(s->d_name, "host", 4)) /* SCSI host */
+		return 0;
+	if (!strncmp(s->d_name, "target", 6)) /* SCSI target */
+		return 0;
         if (strchr(s->d_name, ':')) {
                 if (filter_active) {
                         struct addr_hctl s_hctl;
#1 lore raw
Quoted 7 lines · Hannes Reinecke

Hi Doug,

I'm preparing a set of patches to update the SCSI midlayer to
play more nicely with the ongoing driver core rework.
Part of the patchset is to move every SCSI entity (ie hosts, targets, and devices) into the scsi bus. So /sys/bus/scsi/devices will look like:

Quoted 6 lines

hare@yarrow:/tmp> ls /sys/bus/scsi/devices 2:0:4:0 host0 host1 host2 host3 host4 target2:0:4

Currently 'lsscsi' doesn't handle this properly; it needs a simple fix to handle it properly. And as this fix doesn't affect normal parsing we can as well apply it now :-)

Hannes,
I have placed a lssci-0.20beta.tgz tarball on
http://sg.torque.net/scsi/lsscsi.html
It includes your patch.

Doug Gilbert