public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Pat LaVarre <p.lavarre@ieee.org>
To: dougg@torque.net
Cc: linux-scsi@vger.kernel.org
Subject: Re: sg_scan -i /dev/sg[0123] /dev/hd[abcd] /dev/scd[0123]
Date: 11 Dec 2003 13:02:21 -0700	[thread overview]
Message-ID: <1071172941.2868.26.camel@patibmrh9> (raw)
In-Reply-To: <1070908146.2263.121.camel@patibmrh9>

Doug G:

Thank you, I see sg_scan now lets me name the devices to scan, including
lk 2.6 block devices:

The inline patch of this e-mail then also omits and scans past the
"Stopping because there are too many error" message in configurations
with few devices present, for example:

$ cd sg3_utils-1.06
$
$ grep Ch CHANGELOG | head -1
Changelog for sg3_utils-1.06 [20031210]
$
$ sudo ./sg_scan -i /dev/hd[abcd] /dev/scd[0123]
sg_scan: device /dev/hda failed on scsi ioctl, skip: Invalid argument
/dev/hdc: scsi0 channel=0 id=0 lun=0 [em]
    LITE-ON   COMBO LTC-48161H  KH0K [wide=0 sync=0 cmdq=0 sftre=0 pq=0x0]
/dev/hdd: scsi0 channel=0 id=0 lun=0 [em]
    Iomega    RRD               11.A [wide=0 sync=0 cmdq=0 sftre=0 pq=0x0]
/dev/scd0: scsi0 channel=0 id=0 lun=0 [em]
    Iomega    RRD               11.U [wide=0 sync=0 cmdq=0 sftre=0 pq=0x0]
/dev/scd1: scsi1 channel=0 id=0 lun=0 [em]
    Iomega    RRD               11.U [wide=0 sync=0 cmdq=0 sftre=0 pq=0x0]
Stopping because there are too many error
$

Pat LaVarre

diff -Nurp sg3_utils-1.06/sg_scan.c sg3_utils/sg_scan.c
--- sg3_utils-1.06/sg_scan.c	2003-12-09 20:24:21.000000000 -0700
+++ sg3_utils/sg_scan.c	2003-12-11 12:56:09.956934904 -0700
@@ -187,7 +187,7 @@ int main(int argc, char * argv[])
     flags = writeable ? O_RDWR : O_RDONLY;
 
     for (k = 0, res = 0, j = 0; 
-	 (k < max_file_args)  && (num_errors < MAX_ERRORS);
+	 (k < max_file_args)  && (has_file_args || (num_errors < MAX_ERRORS));
          ++k, res = (sg_fd >= 0) ? close(sg_fd) : 0) {
         if (res < 0) {
             snprintf(ebuff, EBUFF_SZ, ME "Error closing %s ", fname);
@@ -283,7 +283,8 @@ int main(int argc, char * argv[])
                 res = sg3_inq(sg_fd, inqBuff, do_extra);
         }
     }
-    if ((num_errors >= MAX_ERRORS) && (num_silent < num_errors)) {
+    if ((num_errors >= MAX_ERRORS) && (num_silent < num_errors) &&
+            !has_file_args) {
         printf("Stopping because there are too many error\n");
         if (eacces_err)
             printf("    root access may be required\n");



  reply	other threads:[~2003-12-11 20:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-06  0:27 sg_scan -i /dev/sg[0123] /dev/hd[abcd] /dev/scd[0123] Pat LaVarre
2003-12-08  8:11 ` Douglas Gilbert
2003-12-08 17:39   ` Pat LaVarre
2003-12-08 17:58   ` Pat LaVarre
2003-12-08 18:29     ` Pat LaVarre
2003-12-11 20:02       ` Pat LaVarre [this message]
2003-12-12 13:00         ` Douglas Gilbert
2003-12-14 22:30           ` Pat LaVarre
2003-12-10 18:14     ` Pat LaVarre
2003-12-11  1:07   ` Willem Riede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1071172941.2868.26.camel@patibmrh9 \
    --to=p.lavarre@ieee.org \
    --cc=dougg@torque.net \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox