Hello community,
here is the log from the commit of package lsscsi for openSUSE:Factory
checked in at Thu Jan 7 13:00:31 CET 2010.
--------
--- lsscsi/lsscsi.changes 2008-10-31 10:25:53.000000000 +0100
+++ /mounts/work_src_done/STABLE/lsscsi/lsscsi.changes 2009-12-07 16:00:29.000000000 +0100
@@ -1,0 +2,10 @@
+Mon Dec 7 15:57:51 CET 2009 - jdelvare@suse.de
+
+- Update to lsscsi-0.23:
+ * Show protection information with '--protection' option, ATA,
+ SATA and USB transport information.
+ * Stop scanning /proc/mounts; assume /sys unless overridden by
+ '--sysfsroot=PATH' option.
+- This update fixes bnc#556180.
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
lsscsi-0.21-usb-transport
lsscsi-0.21.tar.bz2
New:
----
lsscsi-0.23.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ lsscsi.spec ++++++
--- /var/tmp/diff_new_pack.xwiXKq/_old 2010-01-07 13:00:24.000000000 +0100
+++ /var/tmp/diff_new_pack.xwiXKq/_new 2010-01-07 13:00:24.000000000 +0100
@@ -1,7 +1,7 @@
#
-# spec file for package lsscsi (Version 0.21)
+# spec file for package lsscsi (Version 0.23)
#
-# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -20,16 +20,15 @@
Url: http://sg.danny.cz/scsi/lsscsi.html
Name: lsscsi
-%define lsscsiver 0.21
-License: GPL v2 or later
+%define lsscsiver 0.23
+License: GPLv2+
Group: Hardware/Other
AutoReqProv: on
Provides: scsi:/usr/bin/lsscsi
-Version: 0.21
-Release: 13
+Version: 0.23
+Release: 1
Summary: List all SCSI devices in the system
-Source: http://sg.torque.net/scsi/lsscsi-%{lsscsiver}.tar.bz2
-Patch1: %{name}-%{version}-usb-transport
+Source: lsscsi-%{lsscsiver}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@@ -43,7 +42,6 @@
%prep
%setup
-%patch1
%build
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix} --mandir=%{_mandir}
++++++ lsscsi-0.21.tar.bz2 -> lsscsi-0.23.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsscsi-0.21/CREDITS new/lsscsi-0.23/CREDITS
--- old/lsscsi-0.21/CREDITS 2008-07-09 21:07:00.000000000 +0200
+++ new/lsscsi-0.23/CREDITS 2009-12-01 01:25:55.000000000 +0100
@@ -8,12 +8,21 @@
proposed additional code so lsscsi would work with lk 2.6.26
(when CONFIG_SYSFS_DEPRECATED_V2 not defined) [20080318]
+Ihab Hamadi <ihab dot hamadi at emulex dot com>
+ co-author of protection information addition [20081206]
+
James Smart <James dot Smart at Emulex dot Com>
transport help, especially for FC [20061128]
+Jean Delvare
+ retire /proc/mounts scan for sysfs mount point;
+
Luben Tuikov <ltuikov at yahoo dot com>
transport help [20061127]
+Martin K. Petersen <martin dot petersen at oracle dot com>
+ co-author of protection information addition [20081206]
+
Mike Christie <michaelc at cs dot wisc dot edu>
iSCSI transport help [20070104]
@@ -27,4 +36,4 @@
transport help with ieee1394 [20061231]
Doug Gilbert
-9th July 2008
+30th November 2009
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsscsi-0.21/ChangeLog new/lsscsi-0.23/ChangeLog
--- old/lsscsi-0.21/ChangeLog 2008-07-10 06:09:41.000000000 +0200
+++ new/lsscsi-0.23/ChangeLog 2009-12-03 02:27:40.000000000 +0100
@@ -1,4 +1,13 @@
+Version 0.23 2009/12/01 [svn: r76]
+ - remove /proc/mounts scan for sysfs mount point, assume
+ /sys unless overridden by re-instated '--sysfsroot' option
+
+Version 0.22 2008/12/26 [svn: r71]
+ - add protection information (see CREDITS file)
+ - add USB transport type with USB device name
+ - add ATA and SATA transport types (crude: by driver name)
+
Version 0.21 2008/7/10 [svn: r64]
- more sysfs scanning work needed for lk 2.6.26
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsscsi-0.21/README new/lsscsi-0.23/README
--- old/lsscsi-0.21/README 2008-03-19 20:46:46.000000000 +0100
+++ new/lsscsi-0.23/README 2008-12-27 01:41:45.000000000 +0100
@@ -1,7 +1,7 @@
Installation instructions are in the INSTALL file.
For a description of this utility see:
-http://www.torque.net/scsi/lsscsi.html
+http://sg.danny.cz/scsi/lsscsi.html
a copy of this web page is in doc/lsscsi.html
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsscsi-0.21/configure new/lsscsi-0.23/configure
--- old/lsscsi-0.21/configure 2008-07-09 22:19:19.000000000 +0200
+++ new/lsscsi-0.23/configure 2009-01-04 18:35:49.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for lsscsi 0.21.
+# Generated by GNU Autoconf 2.61 for lsscsi 0.23.
#
# Report bugs to .
#
@@ -574,8 +574,8 @@
# Identity of this package.
PACKAGE_NAME='lsscsi'
PACKAGE_TARNAME='lsscsi'
-PACKAGE_VERSION='0.21'
-PACKAGE_STRING='lsscsi 0.21'
+PACKAGE_VERSION='0.23'
+PACKAGE_STRING='lsscsi 0.23'
PACKAGE_BUGREPORT='dgilbert@interlog.com'
ac_subst_vars='SHELL
@@ -1166,7 +1166,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures lsscsi 0.21 to adapt to many kinds of systems.
+\`configure' configures lsscsi 0.23 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1232,7 +1232,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of lsscsi 0.21:";;
+ short | recursive ) echo "Configuration of lsscsi 0.23:";;
esac
cat <<\_ACEOF
@@ -1315,7 +1315,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-lsscsi configure 0.21
+lsscsi configure 0.23
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1329,7 +1329,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by lsscsi $as_me 0.21, which was
+It was created by lsscsi $as_me 0.23, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2020,7 +2020,7 @@
# Define the identity of the package.
PACKAGE='lsscsi'
- VERSION='0.21'
+ VERSION='0.23'
cat >>confdefs.h <<_ACEOF
@@ -3751,7 +3751,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by lsscsi $as_me 0.21, which was
+This file was extended by lsscsi $as_me 0.23, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -3804,7 +3804,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-lsscsi config.status 0.21
+lsscsi config.status 0.23
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsscsi-0.21/configure.ac new/lsscsi-0.23/configure.ac
--- old/lsscsi-0.21/configure.ac 2008-07-09 22:17:32.000000000 +0200
+++ new/lsscsi-0.23/configure.ac 2009-01-04 18:35:49.000000000 +0100
@@ -1,4 +1,4 @@
-AC_INIT(lsscsi, 0.21, dgilbert@interlog.com)
+AC_INIT(lsscsi, 0.23, dgilbert@interlog.com)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsscsi-0.21/debian/changelog new/lsscsi-0.23/debian/changelog
--- old/lsscsi-0.21/debian/changelog 2008-07-10 06:10:10.000000000 +0200
+++ new/lsscsi-0.23/debian/changelog 2009-12-03 02:27:40.000000000 +0100
@@ -1,38 +1,50 @@
+lsscsi (0.23-0.1) unstable; urgency=low
+
+ * new upstream version
+
+ -- Douglas Gilbert Thu, 03 Dec 2009 02:00:00 +0100
+
+lsscsi (0.22-0.1) unstable; urgency=low
+
+ * new upstream version
+
+ -- Douglas Gilbert Fri, 26 Dec 2008 19:30:00 -0500
+
lsscsi (0.21-0.1) unstable; urgency=low
* new upstream version
- -- Douglas Gilbert Thu, 10 Jul 2008 01:00:00 -0400
+ -- Douglas Gilbert Thu, 10 Jul 2008 01:00:00 -0400
lsscsi (0.20-0.1) unstable; urgency=low
* new upstream version
- -- Douglas Gilbert Wed, 9 Jul 2008 15:00:00 -0400
+ -- Douglas Gilbert Wed, 9 Jul 2008 15:00:00 -0400
lsscsi (0.19-0.1) unstable; urgency=low
* new upstream version
- -- Douglas Gilbert Wed, 25 Jan 2007 14:00:00 -0500
+ -- Douglas Gilbert Wed, 25 Jan 2007 14:00:00 -0500
lsscsi (0.18-0.1) unstable; urgency=low
* new upstream version
- -- Douglas Gilbert Fri, 24 Mar 2006 22:00:00 -0500
+ -- Douglas Gilbert Fri, 24 Mar 2006 22:00:00 -0500
lsscsi (0.17-0.1) unstable; urgency=low
* new upstream version
- -- Douglas Gilbert Mon, 06 Feb 2006 16:00:00 +1000
+ -- Douglas Gilbert Mon, 06 Feb 2006 16:00:00 +1000
lsscsi (0.16-0.1) unstable; urgency=low
* add debian build directory
- -- Douglas Gilbert Fri, 30 Dec 2005 16:00:00 +1000
+ -- Douglas Gilbert Fri, 30 Dec 2005 16:00:00 +1000
lsscsi (0.15-1) unstable; urgency=low
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsscsi-0.21/debian/copyright new/lsscsi-0.23/debian/copyright
--- old/lsscsi-0.21/debian/copyright 2008-03-19 20:46:18.000000000 +0100
+++ new/lsscsi-0.23/debian/copyright 2008-12-27 01:41:45.000000000 +0100
@@ -1,9 +1,9 @@
This package was debianized by Matt Taggart on
Wed, 2 Feb 2005 00:27:11 -0800.
-It was downloaded from http://www.torque.net/scsi/lsscsi.html
+It was downloaded from http://sg.danny.cz/scsi/lsscsi.html
-Copyright: Copyright (C) 2003-2005 D. Gilbert
+Copyright: Copyright (C) 2003-2008 D. Gilbert
Upstream Author: Doug Gilbert
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsscsi-0.21/doc/lsscsi.html new/lsscsi-0.23/doc/lsscsi.html
--- old/lsscsi-0.21/doc/lsscsi.html 2008-07-10 06:22:22.000000000 +0200
+++ new/lsscsi-0.23/doc/lsscsi.html 2008-12-27 01:41:45.000000000 +0100
@@ -22,15 +22,18 @@
<li><a href="#mozTocId473619">Command line interface</a></li>
<li><a href="#mozTocId782775">Transports</a>
<ol>
+ <li><a href="#mozTocId961094">ATA</a></li>
<li><a href="#mozTocId339163">FC</a></li>
<li><a href="#mozTocId419863">1394</a></li>
<li><a href="#mozTocId194875">iSCSI</a></li>
<li><a href="#mozTocId80471">SAS</a></li>
+ <li><a href="#mozTocId348880">SATA</a></li>
<li><a href="#mozTocId798449">SPI</a></li>
+ <li><a href="#mozTocId607245">USB</a></li>
</ol>
</li>
<li><a href="#mozTocId908089">lsscsi version 0.15
-to 0.21 notes</a></li>
+to 0.22 notes</a></li>
<li><a href="#mozTocId856130"> Download and Build
information</a></li>
</ol>
@@ -88,7 +91,7 @@
Linux scsi_debug
0004 /dev/sdb</tt><br>
<br>
-The first entry on each line is the scsi_host,channel,target_number,lun
+The first entry on each line is the scsi_host,channel,target_number,
tuple. It is placed in brackets and each element is colon separated.
When there are multiple SCSI devices their entries are sorted in
ascending tuple order.
@@ -226,7 +229,7 @@
spaces; alternatively it can be of the form "host<n>" where
<n> is a host number. The four numbers represent host number,
channel (or bus) number, target number and logical unit number (i.e.
-lun) respectively. The "-" symbol is used to represent a wildcard. For
+LUN) respectively. The "-" symbol is used to represent a wildcard. For
device listings, no filter argument is equivalent to "-:-:-:-". Numbers
missing from the filter are treated as wildcards: hence "5:0:1" and
"5:0:1:-" are the same.<br>
@@ -339,6 +342,17 @@
</td>
</tr>
<tr>
+ <td style="vertical-align: top;">--protection<br>
+ </td>
+ <td style="vertical-align: top;">-p<br>
+ </td>
+ <td style="vertical-align: top;">0.22<br>
+ </td>
+ <td style="vertical-align: top;">show protection information
+(T10-DIF).<br>
+ </td>
+ </tr>
+ <tr>
<td style="vertical-align: top;">--transport<br>
</td>
<td style="vertical-align: top;">-t<br>
@@ -386,6 +400,7 @@
wide unique name or identifier. The transports for which extra
information is provided are:<br>
<ul>
+ <li>ATA</li>
<li>Fibre channel (FC): substantial amount both for target and host<br>
</li>
<li>IEEE 1394 (SBP): target and host<br>
@@ -395,7 +410,9 @@
<li>SCSI Parallel Interface (SPI): trivial<br>
</li>
<li>Serial Attached SCSI (SAS): substantial amount for both target
-and host<br>
+and host</li>
+ <li>SATA</li>
+ <li>USB<br>
</li>
</ul>
Even though <span style="font-weight: bold;">lsscsi</span>, in the
@@ -419,6 +436,64 @@
href="http://www.t10.org/ftp/t10/drafts/sam4/sam4r08.pdf">SAM-4</a>
document has been used as a guide for the appropriate initiator (i.e.
host) and target names and identifiers to display.<br>
+<h3><a class="mozTocH3" name="mozTocId961094"></a>ATA</h3>
+The detection of parallel ATA devices is somewhat crude and is
+performed after checks are made for more traditional SCSI transports.
+The identification of an ATA transport is made on the basis of the low
+level driver name that the device or host uses. A similar mechanism is
+used to detect SATA devices and there is some overlap since some
+drivers support both SATA and PATA devices. No other attributes are
+provided. For example:<br>
+<span style="font-family: monospace;">$ lsscsi</span>
+<span style="font-family: monospace;">[0:0:0:0]
+disk ATA FUJITSU
+MHY2160B 0000 /dev/sda</span><br style="font-family: monospace;">
+<span style="font-family: monospace;">[3:0:0:0]
+cd/dvd MATSHITA DVD/CDRW UJDA775 CB03 /dev/scd0</span>
+<span style="font-family: monospace;">[5:0:0:0]
+disk USB 2.0 SD/MMC
+Reader /dev/sdb</span>
+<span style="font-family: monospace;">[6:0:0:0]
+disk JetFlash TS2GJFVxx
+ 8.01 /dev/sdc</span>
+<span style="font-family: monospace;">$ lsscsi -t</span>
+<span style="font-family: monospace;">[0:0:0:0]
+disk
+sata:
+/dev/sda</span><br style="font-family: monospace;">
+<span style="font-family: monospace;">[3:0:0:0]
+cd/dvd
+ata:
+/dev/scd0</span><br style="font-family: monospace;">
+<span style="font-family: monospace;">[5:0:0:0]
+disk usb:
+7-1:1.0
+/dev/sdb</span><br style="font-family: monospace;">
+<span style="font-family: monospace;">[6:0:0:0]
+disk usb:
+7-2.4:1.0
+/dev/sdc<br>
+$ lsscsi -Ht<br>
+[0]
+ahci sata:<br>
+[1]
+ahci sata:<br>
+[2]
+ahci sata:<br>
+[3] ata_piix ata:<br>
+[4] ata_piix ata:<br>
+[5] usb-storage usb: 7-1:1.0<br>
+[6] usb-storage usb: 7-2.4:1.0<br>
+</span><br>
+In this case the device at 3:0:0:0 (and device node /dev/scd0) is a
+DVD/CD drive whose transport is (parallel) ATA. That device is attached
+to host3 which is associated with the ata_piix driver.<br>
+<br>
<h3><a class="mozTocH3" name="mozTocId339163"></a>FC</h3>
For FC devices (logical units), the '--transport' option will show the
port name and the port identifier instead of the SCSI INQUIRY
@@ -734,6 +809,16 @@
<br>
Adding a '--list' option will print multiple 'name=value' pair lines,
each indented with two or more spaces.<br>
+<h3><a class="mozTocH3" name="mozTocId348880"></a>SATA</h3>
+The detection of serial ATA (SATA) devices is somewhat crude and is
+performed after checks are made for more traditional SCSI transports.
+The identification of an SATA transport is made on the basis of the low
+level driver name that the device or host uses. A similar mechanism is
+used to detect parallel ATA devices and there is some overlap
+since some
+drivers support both SATA and PATA devices. No other attributes are
+provided. See the example in the <a href="#mozTocId961094">ATA</a>
+section, specifically device 0:0:0:0 and the associated host0.<br>
<h3><a class="mozTocH3" name="mozTocId798449"></a>SPI</h3>
The SCSI parallel interface (SPI) can be detected (as indicated by the
"spi:" prefix) but sysfs provides no world wide unique names (there may
@@ -794,9 +879,25 @@
style="font-family: monospace;">
<span style="font-family: monospace;"> transport=spi</span><br
style="font-family: monospace;">
-<span style="font-family: monospace;"> signalling=unknown</span><br>
+<span style="font-family: monospace;"> signalling=unknown<br>
+<br>
+</span>
+<h3><a class="mozTocH3" name="mozTocId607245"></a>USB</h3>
+When a USB transport is detected the device or host summary line will
+contain "usb:" followed by a USB device name. The USB device name has
+the form "<b>-<p1>[.<p2>]+:<c>.<i>" where
+<b> is the USB bus number, <p1> is the port on the host.
+<p2> is a port on a host connected hub, if present. If
+needed <p3> is another USB hub port closer to the USB storage
+device. <c> refers to the configuration number while <i> is
+the interface number. There is a separate USB SCSI host for each USB
+logical unit. Thus the same "usb: <device_name>" appears for both
+the device (logical unit) and the corresponding SCSI host. See the
+example in the <a href="lsscsi.html#mozTocId961094">ATA</a> section,
+specifically devices 5:0:0:0 and 6:0:0:0 . 5:0:0:0 is connected
+directly to a laptop while 6:0:0:0 is connected via an external hub.
<h2><a class="mozTocH2" name="mozTocId908089"></a>lsscsi version 0.15
-to 0.21 notes</h2>
+to 0.22 notes</h2>
These versions attempt to find the device name
used in the <span style="font-family: monospace;">/dev</span>
directory rather than the kernel generated name. The kernel generated
@@ -825,7 +926,7 @@
<br>
By default lsscsi lists all SCSI devices (or hosts). This version
allows select arguments to reduce the number of devices listed. For
-example "lsscsi 1" will list all channels, targets and luns within
+example "lsscsi 1" will list all channels, targets and LUNs within
host1. A single SCSI device can be listed with 'lsscsi 1 0 0 0' (or
'lsscsi 1:0:0:0' or 'lsscsi [1:0:0:0]'). See man page for more
information. This version of lsscsi uses the facilities of the
@@ -976,6 +1077,18 @@
<td style="vertical-align: top;">more changes for lk 2.6.26<br>
</td>
</tr>
+ <tr>
+ <td style="vertical-align: top;"><a href="lsscsi-0.22.tgz">lsscsi-0.22.tgz</a><br>
+20081226</td>
+ <td style="vertical-align: top;"><a href="lsscsi-0.22-1.i386.rpm">lsscsi-0.22-1.i386.rpm</a><br>
+ <a href="lsscsi_0.22-0.1_i386.deb">lsscsi_0.22-0.1_i386.deb</a><br>
+ </td>
+ <td style="vertical-align: top;"><a href="lsscsi-0.22-1.src.rpm">lsscsi-0.22-1.src.rpm</a>
+ </td>
+ <td style="vertical-align: top;">show protection information with
+'--protection' option, ATA, SATA and USB transport information<br>
+ </td>
+ </tr>
</tbody>
</table>
<p>Here is the most recent <a href="lsscsi.ChangeLog">ChangeLog</a> .<br>
@@ -987,7 +1100,7 @@
</p>
<p> </p>
<div style="text-align: center;">Doug Gilbert (dgilbert@interlog.com) <br>
-Last updated: 10th july 2008<br>
+Last updated: 26th December 2008<br>
</div>
<p> </p>
</body>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsscsi-0.21/lsscsi.8 new/lsscsi-0.23/lsscsi.8
--- old/lsscsi-0.21/lsscsi.8 2008-07-09 21:01:44.000000000 +0200
+++ new/lsscsi-0.23/lsscsi.8 2009-12-01 01:25:55.000000000 +0100
@@ -1,12 +1,12 @@
-.TH lsscsi "8" "July 2008" "lsscsi\-0.20" LSSCSI
+.TH lsscsi "8" "November 2009" "lsscsi\-0.23" LSSCSI
.SH NAME
lsscsi \- list SCSI devices (or hosts) and their attributes
.SH SYNOPSIS
.B lsscsi
[\fI\-\-classic\fR] [\fI\-\-device\fR] [\fI\-\-generic\fR] [\fI\-\-help\fR]
[\fI\-\-hosts\fR] [\fI\-\-kname\fR] [\fI\-\-list\fR] [\fI\-\-long\fR]
-[\fI\-\-transport\fR] [\fI\-\-verbose\fR] [\fI\-\-version\fR]
-[\fIH:C:T:L\fR]
+[\fI\-\-protection\fR] [\fI\-\-sysfsroot=PATH\fR] [\fI\-\-transport\fR]
+[\fI\-\-verbose\fR] [\fI\-\-version\fR] [\fIH:C:T:L\fR]
.SH DESCRIPTION
.\" Add any additional description here
.PP
@@ -38,7 +38,7 @@
report disk error messages using the disk's default kernel name.
.PP
Information about this utility including examples can also be found at:
-http://www.torque.net/scsi/lsscsi.html .
+http://sg.danny.cz/scsi/lsscsi.html .
.SH OPTIONS
.TP
\fB\-c\fR, \fB\-\-classic\fR
@@ -75,6 +75,9 @@
outputs SCSI device (host) attributes one per line; preceded by
two spaces; in the form "=<value>".
.TP
+\fB\-p\fR, \fB\-\-protection\fR
+Output additional data integrity (protection) information.
+.TP
\fB\-t\fR, \fB\-\-transport\fR
Output transport information. This will be a target related information or,
if \fI\-\-hosts\fR is given, initiator related information. When used without
@@ -91,9 +94,14 @@
.TP
\fB\-V\fR, \fB\-\-version\fR
outputs version information then exits.
+.TP
+\fB\-y\fR, \fB\-\-sysfsroot\fR=\fIPATH\fR
+assumes sysfs is mounted at PATH instead of the default '/sys' . If this
+option is given PATH should be an absolute path (i.e. start with '/').
.SH NOTES
-Information for this command is derived from the sysfs file system
-whose mount point is found by examining the contents of /proc/mounts .
+Information for this command is derived from the sysfs file system,
+which is assumed to be mounted at /sys unless specified otherwise
+by the user.
SCSI (pseudo) devices that have been detected by the SCSI mid level
will be listed even if the required upper level drivers (i.e. sd, sr,
st, osst or ch) have not been loaded. If the appropriate upper level
@@ -103,8 +111,8 @@
level driver and can only be accessed via a scsi generic (sg) device
name.
.PP
-This version of lsscsi (0.20) or later is required to correctly display
-SCSI devices in linux kernel 2.6.26 (and possibly later) when the
+lsscsi version 0.21 or later is required to correctly display SCSI devices
+in linux kernel 2.6.26 (and possibly later) when the
CONFIG_SYSFS_DEPRECATED_V2 kernel option is not defined.
.SH TRANSPORTS
This utility lists SCSI devices which are known as logical units (lu) in
@@ -133,8 +141,8 @@
Using a filter argument will reduce the volume of output if a lot of
devices or hosts are present.
.PP
-The transports that are currently recognized are: IEEE 1394, FC, iSCSI, SAS
-and SPI.
+The transports that are currently recognized are: IEEE 1394, ATA, FC,
+iSCSI, SAS, SATA, SPI and USB.
.PP
For IEEE 1394 (a.k.a. Firewire and "SBP" when storage is involved), the
EUI-64 based target port name is output when \fI\-\-transport\fR is given,
@@ -142,6 +150,13 @@
option is given then the EUI-64 initiator port name is output. Output on
the summary line specific to the IEEE 1394 transport is prefixed by "sbp:".
.PP
+to detect ATA and SATA a crude check is performed on the driver
+name (after the checks for other transports are exhausted). Based on the
+driver name either ATA or SATA transport type is chosen. Output on the
+summary line is either "ata:" or "sata:". No other attributes are given.
+Most device and hosts flagged as "ata:" will use the parallel ATA
+transport (PATA).
+.PP
For Fibre Channel (FC) the port name and port identifier are output
when \fI\-\-transport\fR is given. In the absence of the \fI\-\-hosts\fR
option these ids will be for the target port associated with the
@@ -169,12 +184,23 @@
a number between 0 and 15 inclusive) is output when \fI\-\-transport\fR is
given, in the absence of the \fI\-\-hosts\fR option. When the \fI\-\-hosts\fR
option is given then only "spi:" is output on the summary line.
+.PP
+When a USB transport is detected, the summary line will contain "usb:"
+followed by a USB device name. The USB device name has the
+form "<b>-<p1>[.<p2>[.<p3>]]:<c>.<i>" where <b> is the USB bus number, <p1>
+is the port on the host. <p2> is a port on a host connected hub, if present.
+If needed <p3> is a USB hub port closer to the USB storage device. <c>
+refers to the configuration number while <i> is the interface number. There
+is a separate SCSI host for each USB (SCSI) target. A USB SCSI target may
+contain multiple logical units. Thus the same "usb: " string
+appears for a USB SCSI host and all logical units that belong to the USB
+SCSI target associated with that USB SCSI host.
.SH AUTHOR
Written by Doug Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2003\-2008 Douglas Gilbert
+Copyright \(co 2003\-2009 Douglas Gilbert
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsscsi-0.21/lsscsi.c new/lsscsi-0.23/lsscsi.c
--- old/lsscsi-0.21/lsscsi.c 2008-07-10 06:14:05.000000000 +0200
+++ new/lsscsi-0.23/lsscsi.c 2009-12-03 02:27:40.000000000 +0100
@@ -1,7 +1,7 @@
/* This is a utility program for listing SCSI devices and hosts (HBAs)
* in the Linux operating system. It is applicable to kernel versions
* 2.6.1 and greater.
- * Copyright (C) 2003-2007 D. Gilbert
+ * Copyright (C) 2003-2009 D. Gilbert
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
@@ -26,7 +26,7 @@
#include
#include
-static const char * version_str = "0.21 2008/07/10";
+static const char * version_str = "0.23 2009/12/03";
#define NAME_LEN_MAX 260
#define FT_OTHER 0
@@ -40,18 +40,17 @@
#define TRANSPORT_SAS_CLASS 4
#define TRANSPORT_ISCSI 5
#define TRANSPORT_SBP 6
+#define TRANSPORT_USB 7
+#define TRANSPORT_ATA 8 /* probably PATA, could be SATA */
+#define TRANSPORT_SATA 9 /* most likely SATA */
static int transport_id = TRANSPORT_UNKNOWN;
-static char sysfsroot[NAME_LEN_MAX];
-static const char * sysfs_name = "sysfs";
-static const char * sysfs_test_dir = "/sys/class";
-static const char * sysfs_test_top = "/sys";
-static const char * proc_mounts = "/proc/mounts";
+static const char * sysfsroot = "/sys";
static const char * bus_scsi_devs = "/bus/scsi/devices";
static const char * class_scsi_dev = "/class/scsi_device/";
-static const char * scsi_host = "/class/scsi_host";
+static const char * scsi_host = "/class/scsi_host/";
static const char * spi_host = "/class/spi_host/";
static const char * spi_transport = "/class/spi_transport/";
static const char * sas_host = "/class/sas_host/";
@@ -83,6 +82,7 @@
int kname;
int transport;
int verbose;
+ int protection; /* data integrity */
};
@@ -135,7 +135,8 @@
{"long", 0, 0, 'l'},
{"list", 0, 0, 'L'},
/* {"name", 0, 0, 'n'}, */
-/* {"sysfsroot", 1, 0, 'y'}, */
+ {"protection", 0, 0, 'p'},
+ {"sysfsroot", 1, 0, 'y'},
{"transport", 0, 0, 't'},
{"verbose", 0, 0, 'v'},
{"version", 0, 0, 'V'},
@@ -160,15 +161,17 @@
};
static struct dev_node_list* dev_node_listhead = NULL;
-struct sg_item_t {
+struct item_t {
char name[NAME_LEN_MAX];
int ft;
int d_type;
};
-static struct sg_item_t non_sg;
-static struct sg_item_t aa_sg;
-static struct sg_item_t aa_first;
+static struct item_t non_sg;
+static struct item_t aa_sg;
+static struct item_t aa_first;
+static struct item_t aa_sd;
+static struct item_t aa_block;
static char sas_low_phy[NAME_LEN_MAX];
static char sas_hold_end_device[NAME_LEN_MAX];
@@ -178,7 +181,36 @@
static int iscsi_tsession_num;
+static const char * usage_message =
+"Usage: lsscsi [--classic] [--device] [--generic] [--help] [--hosts]\n"
+ "\t\t[--kname] [--list] [--long] [--protection] [--sysfsroot=PATH]\n"
+ "\t\t[--transport] [--verbose] [--version] []\n"
+" where:\n"
+" --classic|-c alternate output similar to 'cat /proc/scsi/scsi'\n"
+" --device|-d show device node's major + minor numbers\n"
+" --generic|-g show scsi generic device name\n"
+" --help|-h this usage information\n"
+" --hosts|-H lists scsi hosts rather than scsi devices\n"
+" --kname|-k show kernel name instead of device node name\n"
+" --list|-L additional information output one\n"
+" attribute=value per line\n"
+" --long|-l additional information output\n"
+" --protection|-p show data integrity (protection) information\n"
+" --sysfsroot=PATH|-y PATH set sysfs mount point to PATH (def: /sys)\n"
+" --transport|-t transport information for target or, if '--hosts'\n"
+" given, for initiator\n"
+" --verbose|-v output path names where data is found\n"
+" --version|-V output version string and exit\n"
+" filter output list (def: '- - - -' (all))\n\n"
+"List SCSI devices or hosts, optionally with additional information\n";
+static void
+usage()
+{
+ fprintf(stderr, "%s", usage_message);
+}
+
+/* Compare host:controller:target:lun tuples (aka or hctl) */
static int
cmp_hctl(const struct addr_hctl * le, const struct addr_hctl * ri)
{
@@ -206,43 +238,9 @@
}
}
-static void
-usage()
-{
- fprintf(stderr, "Usage: lsscsi [--classic] [--device] [--generic]"
- " [--help] [--hosts]\n"
- "\t\t[--kname] [--list] [--long] [--transport] "
- "[--verbose]\n"
- "\t\t[--version] []\n");
- fprintf(stderr, " where:\n");
- fprintf(stderr, " --classic|-c alternate output similar "
- "to 'cat /proc/scsi/scsi'\n");
- fprintf(stderr, " --device|-d show device node's major + "
- "minor numbers\n");
- fprintf(stderr, " --generic|-g show scsi generic device "
- "name\n");
- fprintf(stderr, " --help|-h this usage information\n");
- fprintf(stderr, " --hosts|-H lists scsi hosts rather than "
- "scsi devices\n");
- fprintf(stderr, " --kname|-k show kernel name instead of "
- "device node name\n");
- fprintf(stderr, " --list|-L additional information "
- "output one\n");
- fprintf(stderr, " attribute=value per line\n");
- fprintf(stderr, " --long|-l additional information "
- "output\n");
- fprintf(stderr, " --transport|-t transport information for "
- "target or, if '--hosts'\n"
- " given, for initiator\n");
- fprintf(stderr, " --verbose|-v output path names where data "
- "is found\n");
- fprintf(stderr, " --version|-V output version string and "
- "exit\n");
- fprintf(stderr, " filter output list (def: "
- "'- - - -' (all))\n\n");
- fprintf(stderr, "List SCSI devices or hosts\n");
-}
-
+/* Return 1 for directory entry that is link or directory (other than
+ * a directory name starting with dot). Else return 0.
+ */
static int
first_scandir_select(const struct dirent * s)
{
@@ -257,6 +255,80 @@
return 1;
}
+/* Return 1 for directory entry that is link or directory (other than a
+ * directory name starting with dot) that contains "block". Else return 0.
+ */
+static int
+block_scandir_select(const struct dirent * s)
+{
+ if ((DT_LNK != s->d_type) &&
+ ((DT_DIR != s->d_type) || ('.' == s->d_name[0])))
+ return 0;
+ if (strstr(s->d_name, "block")){
+ strncpy(aa_block.name, s->d_name, NAME_LEN_MAX);
+ aa_block.ft = FT_CHAR; /* dummy */
+ aa_block.d_type = s->d_type;
+ }
+ return 1;
+}
+
+/* scan for scsi_disk directory in /sys/bus/scsi/devices/ */
+static int
+block_scan(const char * dir_name, const struct lsscsi_opt_coll * opts)
+{
+ char name[NAME_LEN_MAX];
+ struct dirent ** namelist;
+ int num, k;
+
+ num = scandir(dir_name, &namelist, block_scandir_select, NULL);
+ if (num < 0) {
+ if (opts->verbose > 0) {
+ snprintf(name, NAME_LEN_MAX, "scandir: %s", dir_name);
+ perror(name);
+ }
+ return -1;
+ }
+ for (k = 0; k < num; ++k)
+ free(namelist[k]);
+ free(namelist);
+ return num;
+}
+
+static int
+sd_scandir_select(const struct dirent * s)
+{
+ if ((DT_LNK != s->d_type) &&
+ ((DT_DIR != s->d_type) || ('.' == s->d_name[0])))
+ return 0;
+ if (strstr(s->d_name, "scsi_disk")){
+ strncpy(aa_sd.name, s->d_name, NAME_LEN_MAX);
+ aa_sd.ft = FT_CHAR; /* dummy */
+ aa_sd.d_type = s->d_type;
+ }
+ return 1;
+}
+
+static int
+sd_scan(const char * dir_name, const struct lsscsi_opt_coll * opts)
+{
+ char name[NAME_LEN_MAX];
+ struct dirent ** namelist;
+ int num, k;
+
+ num = scandir(dir_name, &namelist, sd_scandir_select, NULL);
+ if (num < 0) {
+ if (opts->verbose > 0) {
+ snprintf(name, NAME_LEN_MAX, "scandir: %s", dir_name);
+ perror(name);
+ }
+ return -1;
+ }
+ for (k = 0; k < num; ++k)
+ free(namelist[k]);
+ free(namelist);
+ return num;
+}
+
/* scan for directory entry that is either a symlink or a directory */
static int
scan_for_first(const char * dir_name, const struct lsscsi_opt_coll * opts)
@@ -470,50 +542,8 @@
}
-/* Return 1 if found (in /proc/mounts or /sys/class directory exists),
- else 0 if problems */
-static int
-find_sysfsroot()
-{
- char buff[NAME_LEN_MAX];
- char dev[34];
- char fs_type[34];
- FILE * f;
- int res = 0;
- int n;
-
- memset(buff, 0, sizeof(buff));
- memset(dev, 0, sizeof(dev));
- memset(fs_type, 0, sizeof(fs_type));
- if (NULL == (f = fopen(proc_mounts, "r"))) {
- DIR * dirp;
-
- dirp = opendir(sysfs_test_dir);
- if (dirp) {
- closedir(dirp);
- strcpy(sysfsroot, sysfs_test_top);
- return 1;
- }
- fprintf(stderr, "Unable to open %s for reading",
- proc_mounts);
- return 0;
- }
- while (fgets(buff, sizeof(buff) - 2, f)) {
- n = sscanf(buff, "%32s %256s %32s", dev, sysfsroot, fs_type);
- if (3 != n) {
- fprintf(stderr, "unexpected short scan,n=%d\n", n);
- break;
- }
- if (0 == strcmp(fs_type, sysfs_name)) {
- res = 1;
- break;
- }
- }
- fclose(f);
- return res;
-}
-
-/* Return 1 if directory, else 0 */
+/* If 'dir_name'/'base_name' is a directory chdir to it. If that is successful
+ return 1, else 0 */
static int
if_directory_chdir(const char * dir_name, const char * base_name)
{
@@ -533,7 +563,10 @@
return 0;
}
-/* Return 1 if directory, else 0 */
+/* If 'dir_name'/generic is a directory chdir to it. If that is successful
+ return 1. Otherwise look a directory of the form
+ 'dir_name'/scsi_generic:sg<n> and if found chdir to it and return 1.
+ Otherwise return 0. */
static int
if_directory_ch2generic(const char * dir_name)
{
@@ -565,7 +598,9 @@
return 0;
}
-/* Return 1 if found, else 0 if problems */
+/* If 'dir_name'/'base_name' is found places corresponding value in 'value'
+ * and returns 1 . Else returns 0.
+ */
static int
get_value(const char * dir_name, const char * base_name, char * value,
int max_value_len)
@@ -738,8 +773,49 @@
return match_found;
}
+/* Fetch USB device name string (form "<b>-<p1>[.<p2>]+:<c>.<i>") given
+ * either a SCSI host name or devname (i.e. "h:c:t:l") string. If detected
+ * return 'b' (pointer to start of USB device name string which is null
+ * terminated), else return NULL.
+ */
+static char *
+get_usb_devname(const char * hname, const char * devname, char * b, int b_len)
+{
+ char buff[NAME_LEN_MAX];
+ char bf2[NAME_LEN_MAX];
+ int len;
+ const char * np;
+ char * cp;
+ char * c2p;
+
+ strcpy(buff, sysfsroot);
+ if (hname) {
+ strcat(buff, scsi_host);
+ np = hname;
+ } else if (devname) {
+ strcat(buff, class_scsi_dev);
+ np = devname;
+ } else
+ return NULL;
+ if (if_directory_chdir(buff, np) && getcwd(bf2, NAME_LEN_MAX) &&
+ strstr(bf2, "usb")) {
+ if (b_len > 0)
+ b[0] = '\0';
+ if ((cp = strstr(bf2, "/host"))) {
+ len = (cp - bf2) - 1;
+ if ((len > 0) && ((c2p = memrchr(bf2, '/', len)))) {
+ len = cp - ++c2p;
+ snprintf(b, b_len, "%.*s", len, c2p);
+ }
+ }
+ return b;
+ }
+ return NULL;
+}
+
/* Parse colon_list into host/channel/target/lun ("hctl") array,
- * return 1 if successful, else 0 */
+ * return 1 if successful, else 0.
+ */
static int
parse_colon_list(const char * colon_list, struct addr_hctl * outp)
{
@@ -767,14 +843,16 @@
return 1;
}
-/* Fetch initiator (port) wwn(s) or identifier if available. Return 1 if
- successful, 0 otherwise */
+/* Check host associated with 'devname' for known transport types. If so set
+ transport_id, place a string in 'b' and return 1. Otherwise return 0. */
static int
transport_init(const char * devname, /* const struct lsscsi_opt_coll * opts, */
int b_len, char * b)
{
char buff[NAME_LEN_MAX];
+ char wd[NAME_LEN_MAX];
int off;
+ char * cp;
struct stat a_stat;
/* SPI host */
@@ -831,7 +909,6 @@
/* SAS class representation */
strcpy(buff, sysfsroot);
strcat(buff, scsi_host);
- strcat(buff, "/");
strcat(buff, devname);
strcat(buff, "/device/sas/ha");
if ((stat(buff, &a_stat) >= 0) && S_ISDIR(a_stat.st_mode)) {
@@ -852,7 +929,6 @@
/* resolve SCSI host device */
strcpy(buff, sysfsroot);
strcat(buff, scsi_host);
- strcat(buff, "/");
strcat(buff, devname);
strcat(buff, "/device");
if (readlink(buff, buff2, sizeof(buff2)) <= 0)
@@ -876,7 +952,7 @@
strcat(buff, buff2);
/* read the FireWire host's EUI-64 */
- if (!get_value(buff, "host_id/guid", buff2, sizeof(buff)) ||
+ if (!get_value(buff, "host_id/guid", buff2, sizeof(buff2)) ||
strlen(buff2) != 18)
break;
snprintf(b, b_len, "sbp:%s", buff2 + 2);
@@ -895,9 +971,39 @@
// Hmmm, probably would like SAM-4 ",i,0x" notation here.
return 1;
}
+ /* USB host? */
+ cp = get_usb_devname(devname, NULL, wd, sizeof(wd) - 1);
+ if (cp) {
+ transport_id = TRANSPORT_USB;
+ snprintf(b, b_len, "usb: %s", cp);
+ return 1;
+ }
+ /* ATA or SATA host, crude check: driver name */
+ strcpy(buff, sysfsroot);
+ strcat(buff, scsi_host);
+ strcat(buff, devname);
+ if (get_value(buff, "proc_name", wd, sizeof(wd))) {
+ if (0 == strcmp("ahci", wd)) {
+ transport_id = TRANSPORT_SATA;
+ snprintf(b, b_len, "sata:");
+ return 1;
+ } else if (strstr(wd, "ata")) {
+ if (0 == memcmp("sata", wd, 4)) {
+ transport_id = TRANSPORT_SATA;
+ snprintf(b, b_len, "sata:");
+ return 1;
+ }
+ transport_id = TRANSPORT_ATA;
+ snprintf(b, b_len, "ata:");
+ return 1;
+ }
+ }
return 0;
}
+/* Given the transport_id of a SCSI host (initiator) associated with
+ * 'path_name' output additional information.
+ */
static void
transport_init_longer(const char * path_name,
const struct lsscsi_opt_coll * opts)
@@ -1026,11 +1132,23 @@
case TRANSPORT_ISCSI:
printf(" transport=iSCSI\n");
// >>> This is the multi-line host output for iSCSI. Anymore to
-// add here? [From /sys/class/scsi_host/hostN/device/iscsi_host:hostN directory]
+// add here? [From
+// /sys/class/scsi_host/hostN/device/iscsi_host:hostN directory]
break;
case TRANSPORT_SBP:
printf(" transport=sbp\n");
break;
+ case TRANSPORT_USB:
+ printf(" transport=usb\n");
+ printf(" device_name=%s\n", get_usb_devname(cp, NULL,
+ value, NAME_LEN_MAX));
+ break;
+ case TRANSPORT_ATA:
+ printf(" transport=ata\n");
+ break;
+ case TRANSPORT_SATA:
+ printf(" transport=sata\n");
+ break;
default:
if (opts->verbose > 1)
fprintf(stderr, "No transport information\n");
@@ -1038,8 +1156,9 @@
}
}
-/* Fetch target port wwn(s) or identifier if available. Return 1 if
- successful, 0 otherwise */
+/* Attempt to determine the transport type of the SCSI device (LU) associated
+ with 'devname'. If found set transport_id, place string in 'b' and return
+ 1. Otherwise return 0. */
static int
transport_tport(const char * devname,
/* const struct lsscsi_opt_coll * opts, */ int b_len, char * b)
@@ -1055,6 +1174,7 @@
if (! parse_colon_list(devname, &hctl))
return 0;
+
/* SAS host? */
strcpy(buff, sysfsroot);
strcat(buff, sas_host);
@@ -1173,9 +1293,39 @@
// (UTF-8) excluding trailing null.
return 1;
}
+ /* USB device? */
+ cp = get_usb_devname(NULL, devname, wd, sizeof(wd) - 1);
+ if (cp) {
+ transport_id = TRANSPORT_USB;
+ snprintf(b, b_len, "usb: %s", cp);
+ return 1;
+ }
+ /* ATA or SATA device, crude check: driver name */
+ strcpy(buff, sysfsroot);
+ strcat(buff, scsi_host);
+ len = strlen(buff);
+ snprintf(buff + len, NAME_LEN_MAX - len, "host%d", hctl.h);
+ if (get_value(buff, "proc_name", wd, sizeof(wd))) {
+ if (0 == strcmp("ahci", wd)) {
+ transport_id = TRANSPORT_SATA;
+ snprintf(b, b_len, "sata:");
+ return 1;
+ } else if (strstr(wd, "ata")) {
+ if (0 == memcmp("sata", wd, 4)) {
+ transport_id = TRANSPORT_SATA;
+ snprintf(b, b_len, "sata:");
+ return 1;
+ }
+ transport_id = TRANSPORT_ATA;
+ snprintf(b, b_len, "ata:");
+ return 1;
+ }
+ }
return 0;
}
+/* Given the transport_id of the SCSI device (LU) associated with 'devname'
+ output additional information. */
static void
transport_tport_longer(const char * devname,
const struct lsscsi_opt_coll * opts)
@@ -1384,6 +1534,17 @@
if (opts->verbose > 2)
printf("fetched from directory: %s\n", buff);
break;
+ case TRANSPORT_USB:
+ printf(" transport=usb\n");
+ printf(" device_name=%s\n", get_usb_devname(NULL, devname,
+ value, NAME_LEN_MAX));
+ break;
+ case TRANSPORT_ATA:
+ printf(" transport=ata\n");
+ break;
+ case TRANSPORT_SATA:
+ printf(" transport=sata\n");
+ break;
default:
if (opts->verbose > 1)
fprintf(stderr, "No transport information\n");
@@ -1670,7 +1831,7 @@
else if (!get_dev_node(wd, dev_node, typ))
snprintf(dev_node, NAME_MAX, "- ");
- printf("%s", dev_node);
+ printf("%-9s", dev_node);
if (opts->dev_maj_min) {
if (get_value(wd, "dev", value, NAME_LEN_MAX))
printf("[%s]", value);
@@ -1709,6 +1870,58 @@
else
printf(" -");
}
+
+ if (opts->protection) {
+ int kernel_dif_support = 0;
+ if (sd_scan(buff,opts)) {
+ if (if_directory_chdir(buff,aa_sd.name)) {
+ char value[NAME_LEN_MAX];
+ char sddir[NAME_LEN_MAX];
+ strncpy(sddir,buff,NAME_LEN_MAX);
+ strcat(sddir,"/");
+ strcat(sddir,aa_sd.name);
+ if (!get_value(sddir, "protection_type", value,
+ NAME_LEN_MAX)) {
+ /* kernel < 2.6.27 */
+ if (opts->verbose)
+ printf(" No Data Integrity "
+ "Support\n");
+ } else {
+ kernel_dif_support = 1;
+ if (strncmp(value, "0", 1))
+ printf(" DIF/Type%1s ",value);
+ else
+ printf(" - ");
+ }
+ } else {
+ printf(" - ");
+ }
+ }
+
+ if (kernel_dif_support && block_scan(buff,opts)) {
+ if (if_directory_chdir(buff,aa_block.name)) {
+ char value[NAME_LEN_MAX];
+ char blkdir[NAME_LEN_MAX];
+ strncpy(blkdir,buff,NAME_LEN_MAX);
+ strcat(blkdir,"/");
+ strcat(blkdir,aa_block.name);
+ if (if_directory_chdir(blkdir,"integrity")) {
+ if (!get_value(".", "format", value,
+ NAME_LEN_MAX)) {
+ if (opts->verbose)
+ printf(" No Data "
+ "Integrity "
+ "Support\n");
+ } else {
+ printf(" %-17s",value);
+ }
+ } else {
+ printf(" %-17s","- ");
+ }
+ }
+ }
+ }
+
printf("\n");
if (opts->long_opt > 0)
longer_d_entry(buff, devname, opts);
@@ -1764,11 +1977,16 @@
return 0;
}
+/* Returns -1 if (a->d_name < b->d_name) ; 0 if they are equal
+ * and 1 otherwise.
+ * Function signature was more generic before version 0.23 :
+ * static int sdev_scandir_sort(const void * a, const void * b)
+ */
static int
-sdev_scandir_sort(const void * a, const void * b)
+sdev_scandir_sort(const struct dirent ** a, const struct dirent ** b)
{
- const char * lnam = (*(struct dirent **)a)->d_name;
- const char * rnam = (*(struct dirent **)b)->d_name;
+ const char * lnam = (*a)->d_name;
+ const char * rnam = (*b)->d_name;
struct addr_hctl left_hctl;
struct addr_hctl right_hctl;
@@ -1783,6 +2001,7 @@
return cmp_hctl(&left_hctl, &right_hctl);
}
+/* List SCSI devices (LUs). */
static void
list_sdevices(const struct lsscsi_opt_coll * opts)
{
@@ -1818,6 +2037,7 @@
free(namelist);
}
+/* List host (initiator) attributes when --long given (one or more times). */
static void
longer_h_entry(const char * path_name, const struct lsscsi_opt_coll * opts)
{
@@ -1972,11 +2192,16 @@
return 0;
}
+/* Returns -1 if (a->d_name < b->d_name) ; 0 if they are equal
+ * and 1 otherwise.
+ * Function signature was more generic before version 0.23 :
+ * static int host_scandir_sort(const void * a, const void * b)
+ */
static int
-host_scandir_sort(const void * a, const void * b)
+host_scandir_sort(const struct dirent ** a, const struct dirent ** b)
{
- const char * lnam = (*(struct dirent **)a)->d_name;
- const char * rnam = (*(struct dirent **)b)->d_name;
+ const char * lnam = (*a)->d_name;
+ const char * rnam = (*b)->d_name;
unsigned int l, r;
if (1 != sscanf(lnam, "host%u", &l))
@@ -2071,7 +2296,7 @@
return 0;
}
-/* Return 0 if able to decode, otheriwse 1 */
+/* Return 0 if able to decode, otherwise 1 */
static int
decode_filter_arg(const char * a1p, const char * a2p, const char * a3p,
const char * a4p, struct addr_hctl * filtp)
@@ -2142,13 +2367,12 @@
int do_hosts = 0;
struct lsscsi_opt_coll opts;
- sysfsroot[0] = '\0';
invalidate_hctl(&filter);
memset(&opts, 0, sizeof(opts));
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "cdghHklLtvV", long_options,
+ c = getopt_long(argc, argv, "cdghHklLptvVy:", long_options,
&option_index);
if (c == -1)
break;
@@ -2178,6 +2402,9 @@
case 'L':
opts.long_opt += 3;
break;
+ case 'p':
+ ++opts.protection;
+ break;
case 't':
++opts.transport;
break;
@@ -2187,11 +2414,9 @@
case 'V':
fprintf(stderr, "version: %s\n", version_str);
return 0;
-#if 0
case 'y': /* sysfsroot <dir> */
- strncpy(sysfsroot, optarg, sizeof(sysfsroot));
+ sysfsroot = optarg;
break;
-#endif
case '?':
usage();
return 1;
@@ -2237,14 +2462,6 @@
"with --transport\n");
return 1;
}
- if ('\0' == sysfsroot[0]) {
- if (! find_sysfsroot()) {
- fprintf(stderr, "Unable to locate sysfsroot. If "
- "kernel >= 2.6.0\n Try something like"
- " 'mount -t sysfs none /sys'\n");
- return 1;
- }
- }
if (opts.verbose > 1) {
printf(" sysfsroot: %s\n", sysfsroot);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lsscsi-0.21/lsscsi.spec new/lsscsi-0.23/lsscsi.spec
--- old/lsscsi-0.21/lsscsi.spec 2008-07-10 06:09:26.000000000 +0200
+++ new/lsscsi-0.23/lsscsi.spec 2009-12-03 02:27:40.000000000 +0100
@@ -1,5 +1,5 @@
%define name lsscsi
-%define version 0.21
+%define version 0.23
%define release 1
Summary: List SCSI devices (or hosts) and associated information
@@ -8,8 +8,8 @@
Release: %{release}
License: GPL
Group: Utilities/System
-Source0: http://www.torque.net/scsi/%{name}-%{version}.tgz
-Url: http://www.torque.net/scsi/lsscsi.html
+Source0: http://sg.danny.cz/scsi/%{name}-%{version}.tgz
+Url: http://sg.danny.cz/scsi/lsscsi.html
BuildRoot: %{_tmppath}/%{name}-%{version}-root/
Packager: dgilbert at interlog dot com
@@ -28,24 +28,20 @@
%setup -q
%build
-
-./configure --prefix=%{_prefix} --mandir=%{_mandir}
-make
+%configure
%install
-
-[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
+if [ "$RPM_BUILD_ROOT" != "/" ]; then
+ rm -rf $RPM_BUILD_ROOT
+fi
make install \
DESTDIR=$RPM_BUILD_ROOT
-%post
-
-%postun
-
%clean
-
-[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
+if [ "$RPM_BUILD_ROOT" != "/" ]; then
+ rm -rf $RPM_BUILD_ROOT
+fi
%files
%defattr(-,root,root)
@@ -55,7 +51,13 @@
%changelog
-* Thu Jul 10 2008 - dgilbert at interlog dot com
+* Thu Dec 03 2009 - dgilbert at interlog dot com
+- remove /proc/mounts scan for sysfs mount point, assume /sys
+ * lsscsi-0.23
+* Fri Dec 26 2008 - dgilbert at interlog dot com
+- protection (T10-DIF) information, USB, ATA + SATA transports
+ * lsscsi-0.22
+* Tue Jul 29 2008 - dgilbert at interlog dot com
- more changes for lk 2.6.26 (SCSI sysfs)
* lsscsi-0.21
* Wed Jul 9 2008 - dgilbert at interlog dot com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org