From: Matthew Wilcox <matthew@wil.cx>
To: linux-scsi@vger.kernel.org
Subject: [PATCH 2/2] Print SCSI Inquiry data more compactly
Date: Wed, 21 Jun 2006 11:14:16 -0600 [thread overview]
Message-ID: <20060621171416.GY1630@parisc-linux.org> (raw)
In-Reply-To: <20060621165300.GX1630@parisc-linux.org>
print_inquiry is rather verbose, both in implementation and in output.
This patch reduces the output from two lines to one and reduces the
implementation to a single printk.
Sample output:
Vendor: HP 18.2G Model: ATLAS10K3_18_SCA Rev: HP05
Type: Direct-Access ANSI SCSI revision: 02
becomes:
scsi 2:0:1:0: Direct-Access HP 18.2G ATLAS10K3_18_SCA HP05 ANSI ver: 02
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Index: drivers/scsi/scsi_scan.c
===================================================================
RCS file: /var/cvs/linux-2.6/drivers/scsi/scsi_scan.c,v
retrieving revision 1.41
diff -u -p -r1.41 scsi_scan.c
--- ./drivers/scsi/scsi_scan.c 29 May 2006 02:51:18 -0000 1.41
+++ ./drivers/scsi/scsi_scan.c 21 Jun 2006 15:49:24 -0000
@@ -186,56 +186,6 @@ static void scsi_unlock_floptical(struct
}
/**
- * print_inquiry - printk the inquiry information
- * @inq_result: printk this SCSI INQUIRY
- *
- * Description:
- * printk the vendor, model, and other information found in the
- * INQUIRY data in @inq_result.
- *
- * Notes:
- * Remove this, and replace with a hotplug event that logs any
- * relevant information.
- **/
-static void print_inquiry(unsigned char *inq_result)
-{
- int i;
-
- printk(KERN_NOTICE " Vendor: ");
- for (i = 8; i < 16; i++)
- if (inq_result[i] >= 0x20 && i < inq_result[4] + 5)
- printk("%c", inq_result[i]);
- else
- printk(" ");
-
- printk(" Model: ");
- for (i = 16; i < 32; i++)
- if (inq_result[i] >= 0x20 && i < inq_result[4] + 5)
- printk("%c", inq_result[i]);
- else
- printk(" ");
-
- printk(" Rev: ");
- for (i = 32; i < 36; i++)
- if (inq_result[i] >= 0x20 && i < inq_result[4] + 5)
- printk("%c", inq_result[i]);
- else
- printk(" ");
-
- printk("\n");
-
- i = inq_result[0] & 0x1f;
-
- printk(KERN_NOTICE " Type: %s ", scsi_device_type(i));
- printk(" ANSI SCSI revision: %02x",
- inq_result[2] & 0x07);
- if ((inq_result[2] & 0x07) == 1 && (inq_result[3] & 0x0f) == 1)
- printk(" CCS\n");
- else
- printk("\n");
-}
-
-/**
* scsi_alloc_sdev - allocate and setup a scsi_Device
*
* Description:
@@ -703,9 +653,8 @@ static int scsi_add_lun(struct scsi_devi
if (*bflags & BLIST_ISROM) {
/*
* It would be better to modify sdev->type, and set
- * sdev->removable, but then the print_inquiry() output
- * would not show TYPE_ROM; if print_inquiry() is removed
- * the issue goes away.
+ * sdev->removable; this can now be done since
+ * print_inquiry has gone away.
*/
inq_result[0] = TYPE_ROM;
inq_result[1] |= 0x80; /* removable */
@@ -734,7 +683,11 @@ static int scsi_add_lun(struct scsi_devi
printk(KERN_INFO "scsi: unknown device type %d\n", sdev->type);
}
- print_inquiry(inq_result);
+ sdev_printk(KERN_NOTICE "scsi", sdev, "%s %.8s %.16s %.4s "
+ "ANSI ver: %02x%s\n", scsi_device_type(sdev->type),
+ sdev->vendor, sdev->model,
+ sdev->rev, inq_result[2] & 0x07,
+ (inq_result[3] & 0x0f) == 1 ? " CCS" : "");
/*
* For a peripheral qualifier (PQ) value of 1 (001b), the SCSI
next prev parent reply other threads:[~2006-06-21 17:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-21 16:53 [PATCH 1/2] Improve SCSI device type decoding Matthew Wilcox
2006-06-21 17:14 ` Matthew Wilcox [this message]
2006-06-21 18:02 ` Douglas Gilbert
2006-06-21 18:48 ` Matthew Wilcox
2006-06-22 2:42 ` Douglas Gilbert
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=20060621171416.GY1630@parisc-linux.org \
--to=matthew@wil.cx \
--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;
as well as URLs for NNTP newsgroup(s).