This patch makes the debug system only print out the valid bytes of a
command.  Greg, please apply.

Andries suggested this... while some would think that seeing the extra
bytes might be good, it is kinda noisy.

Matt

# This is a BitKeeper generated patch for the following project:
# Project Name: greg k-h's linux 2.5 USB kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#                  ChangeSet    1.663   -> 1.664  
#       drivers/usb/storage/debug.c     1.10    -> 1.11   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/01/12      [EMAIL PROTECTED]       1.664
# Change debug prints to only show cmd_len bytes of the command.
# --------------------------------------------
#
diff -Nru a/drivers/usb/storage/debug.c b/drivers/usb/storage/debug.c
--- a/drivers/usb/storage/debug.c       Sun Jan 12 18:01:39 2003
+++ b/drivers/usb/storage/debug.c       Sun Jan 12 18:01:39 2003
@@ -49,6 +49,7 @@
 void usb_stor_show_command(Scsi_Cmnd *srb)
 {
        char *what = NULL;
+       int i;
 
        switch (srb->cmnd[0]) {
        case TEST_UNIT_READY: what = "TEST_UNIT_READY"; break;
@@ -143,29 +144,25 @@
        default: what = "(unknown command)"; break;
        }
        US_DEBUGP("Command %s (%d bytes)\n", what, srb->cmd_len);
-       US_DEBUGP("%02x %02x %02x %02x "
-                 "%02x %02x %02x %02x "
-                 "%02x %02x %02x %02x\n",
-                 srb->cmnd[0], srb->cmnd[1], srb->cmnd[2], srb->cmnd[3],
-                 srb->cmnd[4], srb->cmnd[5], srb->cmnd[6], srb->cmnd[7],
-                 srb->cmnd[8], srb->cmnd[9], srb->cmnd[10],
-                 srb->cmnd[11]);
+       US_DEBUGP("");
+       for (i = 0; i < srb->cmd_len && i < 16; i++)
+               US_DEBUGPX(" %02x", srb->cmnd[i]);
+       US_DEBUGPX("\n");
 }
 
-void usb_stor_print_Scsi_Cmnd( Scsi_Cmnd* cmd )
+void usb_stor_print_Scsi_Cmnd(Scsi_Cmnd *cmd)
 {
        int i=0, bufferSize = cmd->request_bufflen;
-       u8* buffer = cmd->request_buffer;
-       struct scatterlist* sg = (struct scatterlist*)cmd->request_buffer;
+       u8 *buffer = cmd->request_buffer;
+       struct scatterlist *sg = (struct scatterlist*)cmd->request_buffer;
 
-       US_DEBUGP("Dumping information about %p.\n", cmd );
-       US_DEBUGP("cmd->cmnd[0] value is %d.\n", cmd->cmnd[0] );
+       US_DEBUGP("Dumping information about %p.\n", cmd);
+       US_DEBUGP("cmd->cmnd[0] value is %d.\n", cmd->cmnd[0]);
        US_DEBUGP("(MODE_SENSE is %d and MODE_SENSE_10 is %d)\n",
-                 MODE_SENSE, MODE_SENSE_10 );
+                 MODE_SENSE, MODE_SENSE_10);
 
-       US_DEBUGP("buffer is %p with length %d.\n", buffer, bufferSize );
-       for ( i=0; i<bufferSize; i+=16 )
-       {
+       US_DEBUGP("buffer is %p with length %d.\n", buffer, bufferSize);
+       for (i=0; i<bufferSize; i+=16) {
                US_DEBUGP("%02x %02x %02x %02x %02x %02x %02x %02x\n"
                          "%02x %02x %02x %02x %02x %02x %02x %02x\n",
                          buffer[i],
@@ -187,8 +184,7 @@
        }
 
        US_DEBUGP("Buffer has %d scatterlists.\n", cmd->use_sg );
-       for ( i=0; i<cmd->use_sg; i++ )
-       {
+       for (i=0; i<cmd->use_sg; i++) {
                char *adr = sg_address(sg[i]);
                
                US_DEBUGP("Length of scatterlist %d is %d.\n",i,sg[i].length);

-- 
Matthew Dharm                              Home: [EMAIL PROTECTED] 
Maintainer, Linux USB Mass Storage Driver

Pitr!  That's brilliant!  Funded by Microsoft refunds.  What sweet irony!
                                        -- A.J.
User Friendly, 2/15/1999

Attachment: msg10613/pgp00000.pgp
Description: PGP signature

Reply via email to