Hello community,
here is the log from the commit of package scsi
checked in at Thu Apr 24 01:54:07 CEST 2008.
--------
--- scsi/scsi.changes 2008-01-19 10:31:00.000000000 +0100
+++ /mounts/work_src_done/STABLE/scsi/scsi.changes 2008-04-23 14:24:39.436423000 +0200
@@ -1,0 +2,6 @@
+Wed Apr 23 14:36:08 CEST 2008 - hare@suse.de
+
+- Include rescan-scsi-bus.sh script from SLES10 SP2
+- Fix lsscsi to work with SYSFS_DEPRECATED setting (bnc#373625)
+
+-------------------------------------------------------------------
New:
----
lsscsi-0.19-sysfs-update
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ scsi.spec ++++++
--- /var/tmp/diff_new_pack.h24131/_old 2008-04-24 01:53:28.000000000 +0200
+++ /var/tmp/diff_new_pack.h24131/_new 2008-04-24 01:53:28.000000000 +0200
@@ -10,6 +10,7 @@
# norootforbuild
+
Name: scsi
BuildRequires: sysfsutils
%define sinfover 1.7
@@ -23,7 +24,7 @@
Provides: scsiinfo sg_utils scsidev
AutoReqProv: on
Version: 1.7_2.38_1.25_0.19_1.02_0.93
-Release: 1
+Release: 18
Summary: SCSI Tools (Text Mode)
Source: scsiinfo-%{sinfover}.tar.bz2
Patch: scsiinfo-%{sinfover}.diff
@@ -38,6 +39,7 @@
Source8: http://sg.torque.net/sg/p/smp_utils-%{smputver}.tar.bz2
Patch8: smp_utils-Makefile.diff
Patch9: sg3_utils.diff
+Patch10: lsscsi-0.19-sysfs-update
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: %fillup_prereq %insserv_prereq
@@ -87,6 +89,7 @@
Kurt Garloff
%package -n xscsi
+License: GPL v2 or later
Summary: A Graphical Front-End for SCSIinfo
Group: Hardware/Other
AutoReqProv: on
@@ -109,6 +112,8 @@
%patch1 -p1
cd ../scsidev-%{sdevver}
%patch2
+cd ../lsscsi-%{lsscsiver}
+%patch10
autoreconf -f
cd ../sg3_utils-%{sgutver}
autoreconf -f
@@ -400,6 +405,9 @@
/sbin/ldconfig
%changelog
+* Wed Apr 23 2008 hare@suse.de
+- Include rescan-scsi-bus.sh script from SLES10 SP2
+- Fix lsscsi to work with SYSFS_DEPRECATED setting (bnc#373625)
* Fri Jan 18 2008 garloff@suse.de
- Update to final sdparm-1.0.2:
* New mode page descriptor format
@@ -461,7 +469,7 @@
* new utility smp_conf_general
* Mon Nov 06 2006 schwab@suse.de
- Don't strip binaries.
-* Sat Oct 28 2006 meissner@suse.de
+* Sun Oct 29 2006 meissner@suse.de
- Use RPM_OPT_FLAGS also in borderline cases.
* Sun Oct 08 2006 aj@suse.de
- Fix build.
@@ -549,7 +557,7 @@
- sg3_utils: Update to latest upstream version.
* Sat Oct 16 2004 lmb@suse.de
- Added sg_emc_trespass command for EMC devices.
-* Fri Oct 15 2004 lmb@suse.de
+* Sat Oct 16 2004 lmb@suse.de
- Added decoding for VPD 0xC0 (Unit Path Report Page) for EMC
CLARiiON to sg_inq.
* Fri Sep 17 2004 olh@suse.de
@@ -581,7 +589,7 @@
* drop SG_GET_VERSION_NUM ioctl guard in most utilities
* Wed Jun 09 2004 garloff@suse.de
- scsidev: Allow longer partition names. (#41783)
-* Tue May 25 2004 garloff@suse.de
+* Wed May 26 2004 garloff@suse.de
- Fix typo in Should-Start (noot->boot). (#41153)
* Tue May 25 2004 garloff@suse.de
- rescan-scsi-bus.sh: Fix another (harmless) error.
@@ -715,7 +723,7 @@
whole disk device instead of partitions.
* Sun Feb 09 2003 garloff@suse.de
- Add sysconfig metadata. [#22683]
-* Wed Jan 15 2003 garloff@suse.de
+* Thu Jan 16 2003 garloff@suse.de
- scsidev: Handle EOF from sscanf
- Update to sg3-utils-1.02:
* Make safe with block SG_IO
@@ -743,7 +751,7 @@
The patch was written by Martin Schwenke
* Mon Aug 19 2002 garloff@suse.de
- Add %%fillup_prereq and %%insserv_prereq (bug #17988)
-* Sat Aug 10 2002 olh@suse.de
+* Sun Aug 11 2002 olh@suse.de
- chmod 755 for boot.scsidev
* Wed Aug 07 2002 garloff@suse.de
- Update to scsidev-2.27:
@@ -809,7 +817,7 @@
* Mon Aug 28 2000 garloff@suse.de
- Update to scsidev-2.21: Prevent overflow for very long host
adapter names (Advansys, thanks to Doug Gilbert for reporting)
-* Sat Aug 05 2000 garloff@suse.de
+* Sun Aug 06 2000 garloff@suse.de
- Update to scsidev-2.20: Include OnStream osst support and minor
fixes
- Update to sg-20000630: Some new commands
++++++ lsscsi-0.19-sysfs-update ++++++
--- lsscsi.c.orig 2008-03-18 13:26:59.733340500 +0100
+++ lsscsi.c 2008-04-23 14:02:16.756511000 +0200
@@ -40,6 +40,7 @@ static const char * version_str = "0.19
#define TRANSPORT_SAS_CLASS 4
#define TRANSPORT_ISCSI 5
#define TRANSPORT_SBP 6
+#define TRANSPORT_USB 6
static int transport_id = TRANSPORT_UNKNOWN;
@@ -50,6 +51,7 @@ static const char * sysfs_test_dir = "/s
static const char * sysfs_test_top = "/sys";
static const char * proc_mounts = "/proc/mounts";
static const char * bus_scsi_devs = "/bus/scsi/devices";
+static const char * bus_usb_devs = "/bus/usb/devices";
static const char * class_scsi_dev = "/class/scsi_device/";
static const char * scsi_host = "/class/scsi_host";
static const char * spi_host = "/class/spi_host/";
@@ -167,6 +169,7 @@ struct sg_item_t {
static struct sg_item_t non_sg;
static struct sg_item_t aa_sg;
+static struct sg_item_t sys_sg;
static char sas_low_phy[NAME_LEN_MAX];
static char sas_hold_end_device[NAME_LEN_MAX];
@@ -244,7 +247,7 @@ static int non_sg_scandir_select(const s
if (FT_OTHER != non_sg.ft)
return 0;
- if (DT_LNK != s->d_type)
+ if (DT_LNK != s->d_type && DT_DIR != s->d_type)
return 0;
if (0 == strncmp("scsi_changer", s->d_name, 12)) {
strncpy(non_sg.name, s->d_name, NAME_LEN_MAX);
@@ -327,6 +330,34 @@ static int sg_scan(const char * dir_name
return num;
}
+static int sys_block_scandir_select(const struct dirent * s)
+{
+ if (DT_DIR != s->d_type)
+ return 0;
+ if (0 == strncmp("sd", s->d_name, 2)) {
+ strncpy(sys_sg.name, s->d_name, NAME_LEN_MAX);
+ sys_sg.ft = FT_BLOCK;
+ return 1;
+ } else
+ return 0;
+}
+
+static int sys_block_scan(const char * dir_name)
+{
+ struct dirent ** namelist;
+ int num, k;
+
+ sys_sg.ft = FT_OTHER;
+ num = scandir(dir_name, &namelist, sys_block_scandir_select, NULL);
+ if (num < 0)
+ return -1;
+
+ for (k = 0; k < num; ++k)
+ free(namelist[k]);
+ free(namelist);
+ return num;
+}
+
static int sas_low_phy_scandir_select(const struct dirent * s)
{
@@ -831,6 +862,48 @@ static int transport_init(const char * d
// Hmmm, probably would like SAM-4 ",i,0x" notation here.
return 1;
}
+
+ /* USB host */
+ do {
+ char *t, buff2[NAME_LEN_MAX];
+
+ /* 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)
+ break;
+
+ /* check if the SCSI host has a USB host as ancestor */
+ if (!(t = strstr(buff2, "/usb")))
+ break;
+ transport_id = TRANSPORT_USB;
+
+ /* Get USB id */
+ if (!(t = strstr(buff2, "/host")))
+ break;
+ /* terminate buff2 after USB host */
+ if (!(t = strchr(t - 1, '/')))
+ break;
+ *t = 0;
+
+ /* resolve USB host device */
+ buff[strlen(buff) - strlen("device")] = 0;
+ if (strlen(buff) + strlen(buff2) + strlen("devnum") + 2
+ > NAME_LEN_MAX)
+ break;
+ strcat(buff, buff2);
+
+ /* read the USB device number */
+ if (!get_value(buff, "devnum", buff2, sizeof(buff)) ||
+ strlen(buff2) < 1)
+ break;
+ snprintf(b, b_len, "usb:%s", buff2);
+ return 1;
+ } while (0);
+
return 0;
}
@@ -1082,7 +1155,7 @@ static int transport_tport(const char *
transport_id = TRANSPORT_SBP;
snprintf(b, b_len, "sbp:%s", wd);
return 1;
- }
+ }
/* iSCSI device? */
strcpy(buff, sysfsroot);
strcat(buff, iscsi_host);
@@ -1108,6 +1181,38 @@ static int transport_tport(const char *
// (UTF-8) excluding trailing null.
return 1;
}
+ /* USB device? */
+ strcpy(buff, sysfsroot);
+ strcat(buff, bus_scsi_devs);
+ if (if_directory_chdir(buff, devname)) {
+ if (NULL == getcwd(wd, NAME_LEN_MAX))
+ return 0;
+ if (!(cp = strstr(wd, "/usb")))
+ return 0;
+ transport_id = TRANSPORT_USB;
+ if (!(cp = strstr(wd, "/host")))
+ return 0;
+ *cp = 0;
+ if (!(cp = strrchr(wd, ':')))
+ return 0;
+ *cp = 0;
+ cp = basename(wd);
+ strcpy(buff, sysfsroot);
+ strcat(buff, bus_usb_devs);
+ strcat(buff, "/");
+ strcat(buff, cp);
+ if (sscanf(cp, "%d-%*d", &n) != 1)
+ return 0;
+
+ snprintf(b, b_len, "usb:%d-", n);
+ off = strlen(b);
+ if (get_value(buff, "devnum", b + off, b_len + off))
+ return 1;
+ else
+ fprintf(stderr, "_tport: no "
+ "usb bus id, wd=%s\n", buff);
+ }
+
return 0;
}
@@ -1577,6 +1682,13 @@ static void one_sdev_entry(const char *
char dev_node[NAME_MAX + 1] = "";
enum dev_type typ;
+ if ((non_sg.ft == FT_BLOCK) &&
+ !strcmp(non_sg.name, "block") &&
+ (1 == sys_block_scan(wd))) {
+ if (if_directory_chdir(wd, sys_sg.name)) {
+ getcwd(wd, NAME_LEN_MAX);
+ }
+ }
typ = (FT_BLOCK == non_sg.ft) ? BLK_DEV : CHR_DEV;
if (opts->kname)
snprintf(dev_node, NAME_MAX, "%s/%s",
@@ -1650,6 +1762,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;
++++++ rescan-scsi-bus.sh ++++++
--- scsi/rescan-scsi-bus.sh 2008-01-18 20:48:31.000000000 +0100
+++ /mounts/work_src_done/STABLE/scsi/rescan-scsi-bus.sh 2008-04-23 14:19:45.122029000 +0200
@@ -3,7 +3,7 @@
# scsi add-single-device mechanism
# (w) 1998-03-19 Kurt Garloff (c) GNU GPL
# (w) 2003-07-16 Kurt Garloff (c) GNU GPL
-# $Id: rescan-scsi-bus.sh,v 1.25 2007/07/18 23:14:04 garloff Exp $
+# $Id: rescan-scsi-bus.sh,v 1.24 2006/07/29 12:34:11 garloff Exp $
setcolor ()
{
@@ -64,6 +64,29 @@
done
}
+printtype ()
+{
+ local type=$1
+
+ case "$type" in
+ 0) echo "Direct-Access " ;;
+ 1) echo "Sequential-Access" ;;
+ 2) echo "Printer " ;;
+ 3) echo "Processor " ;;
+ 4) echo "WORM " ;;
+ 5) echo "CD-ROM " ;;
+ 6) echo "Scanner " ;;
+ 7) echo "Optical Device " ;;
+ 8) echo "Medium Changer " ;;
+ 9) echo "Communications " ;;
+ 10) echo "Unknown " ;;
+ 11) echo "Unknown " ;;
+ 12) echo "RAID " ;;
+ 13) echo "Enclosure " ;;
+ 14) echo "Direct-Access-RBC" ;;
+ *) echo "Unknown " ;;
+ esac
+}
# Get /proc/scsi/scsi info for device $host:$channel:$id:$lun
# Optional parameter: Number of lines after first (default = 2),
# result in SCSISTR, return code 1 means empty.
@@ -88,24 +111,7 @@
if [ "$LN" -gt 1 ] ; then
ILVL=$(cat ${SCSIPATH}/device/scsi_level)
type=$(cat ${SCSIPATH}/device/type)
- case "$type" in
- 0) ITYPE="Direct-Access " ;;
- 1) ITYPE="Sequential-Access" ;;
- 2) ITYPE="Printer " ;;
- 3) ITYPE="Processor " ;;
- 4) ITYPE="WORM " ;;
- 5) ITYPE="CD-ROM " ;;
- 6) ITYPE="Scanner " ;;
- 7) ITYPE="Optical Device " ;;
- 8) ITYPE="Medium Changer " ;;
- 9) ITYPE="Communications " ;;
- 10) ITYPE="Unknown " ;;
- 11) ITYPE="Unknown " ;;
- 12) ITYPE="RAID " ;;
- 13) ITYPE="Enclosure " ;;
- 14) ITYPE="Direct-Access-RBC" ;;
- *) ITYPE="Unknown " ;;
- esac
+ ITYPE=$(printtype $type)
SCSITMP=$(printf ' Type: %-16s ANSI SCSI revision: %02d' "$ITYPE" "$((ILVL - 1))")
SCSISTR="$SCSISTR
$SCSITMP"
@@ -187,12 +193,25 @@
IPROD=`echo "$INQ" | grep 'Product identification:' | sed 's/^[^:]*: \(.*\)$/\1/'`
IPREV=`echo "$INQ" | grep 'Product revision level:' | sed 's/^[^:]*: \(.*\)$/\1/'`
STR=`printf " Vendor: %-08s Model: %-16s Rev: %-4s" "$IVEND" "$IPROD" "$IPREV"`
+ IPTYPE=`echo "$INQ" | sed -n 's/.* Device_type=\([0-9]*\) .*/\1/p'`
+ IPQUAL=`echo "$INQ" | sed -n 's/ *PQual=\([0-9]*\) Device.*/\1/p'`
+ if [ "$IPQUAL" != 0 ] ; then
+ echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nLU not available (PQual $IPQUAL)${norm}\n\n\n"
+ return 1
+ fi
+
+ TYPE=$(printtype $IPTYPE)
procscsiscsi
- SCSISTR=`echo "$SCSISTR" | grep 'Vendor:'`
- if [ "$SCSISTR" != "$STR" ]; then
+ TMPSTR=`echo "$SCSISTR" | grep 'Vendor:'`
+ if [ "$TMPSTR" != "$STR" ]; then
echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${SCSISTR#* } \nto: $STR ${norm}\n\n\n"
return 1
fi
+ TMPSTR=`echo "$SCSISTR" | sed -n 's/.*Type: *\(.*\) *ANSI.*/\1/p'`
+ if [ $TMPSTR != $TYPE ] ; then
+ echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${TMPSTR} \nto: $TYPE ${norm}\n\n\n"
+ return 1
+ fi
return $RC
}
@@ -284,11 +303,11 @@
echo -e "${norm}\e[B\e[B"
if test -e /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device; then
echo 1 > /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/delete
- # Try reading, should fail if device is gone
+ # Try readding, should fail if device is gone
echo "$channel $id $lun" > /sys/class/scsi_host/host${host}/scan
else
echo "scsi remove-single-device $devnr" > /proc/scsi/scsi
- # Try reading, should fail if device is gone
+ # Try readding, should fail if device is gone
echo "scsi add-single-device $devnr" > /proc/scsi/scsi
fi
fi
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org