ChangeSet 1.889.26.17, 2003/01/12 23:01:58-08:00, [EMAIL PROTECTED]
[PATCH] USB storage: clean up debugging
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.
diff -Nru a/drivers/usb/storage/debug.c b/drivers/usb/storage/debug.c
--- a/drivers/usb/storage/debug.c Mon Jan 13 14:24:33 2003
+++ b/drivers/usb/storage/debug.c Mon Jan 13 14:24:33 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);
-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel