Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sun3_scsi: add ->show_info()

Based on Al's changes to atari_scsi.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Geert Uytterhoeven and committed by
Al Viro
9dcc26cf e765acb4

+80 -106
+78 -105
drivers/scsi/sun3_NCR5380.c
··· 661 661 * Inputs : instance, pointer to this instance. 662 662 */ 663 663 664 - static void NCR5380_print_status (struct Scsi_Host *instance) 664 + static void lprint_Scsi_Cmnd(Scsi_Cmnd *cmd) 665 665 { 666 - char *pr_bfr; 667 - char *start; 668 - int len; 669 - 670 - NCR_PRINT(NDEBUG_ANY); 671 - NCR_PRINT_PHASE(NDEBUG_ANY); 672 - 673 - pr_bfr = (char *) __get_free_page(GFP_ATOMIC); 674 - if (!pr_bfr) { 675 - printk("NCR5380_print_status: no memory for print buffer\n"); 676 - return; 677 - } 678 - len = NCR5380_proc_info(instance, pr_bfr, &start, 0, PAGE_SIZE, 0); 679 - pr_bfr[len] = 0; 680 - printk("\n%s\n", pr_bfr); 681 - free_page((unsigned long) pr_bfr); 666 + int i, s; 667 + unsigned char *command; 668 + printk("scsi%d: destination target %d, lun %d\n", 669 + H_NO(cmd), cmd->device->id, cmd->device->lun); 670 + printk(KERN_CONT " command = "); 671 + command = cmd->cmnd; 672 + printk(KERN_CONT "%2d (0x%02x)", command[0], command[0]); 673 + for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) 674 + printk(KERN_CONT " %02x", command[i]); 675 + printk("\n"); 682 676 } 683 677 684 - 685 - /******************************************/ 686 - /* 687 - * /proc/scsi/[dtc pas16 t128 generic]/[0-ASC_NUM_BOARD_SUPPORTED] 688 - * 689 - * *buffer: I/O buffer 690 - * **start: if inout == FALSE pointer into buffer where user read should start 691 - * offset: current offset 692 - * length: length of buffer 693 - * hostno: Scsi_Host host_no 694 - * inout: TRUE - user is writing; FALSE - user is reading 695 - * 696 - * Return the number of bytes read from or written 697 - */ 698 - 699 - #undef SPRINTF 700 - #define SPRINTF(fmt,args...) \ 701 - do { if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \ 702 - pos += sprintf(pos, fmt , ## args); } while(0) 703 - static 704 - char *lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, char *pos, char *buffer, 705 - int length); 706 - 707 - static int NCR5380_proc_info(struct Scsi_Host *instance, char *buffer, 708 - char **start, off_t offset, int length, int inout) 678 + static void NCR5380_print_status(struct Scsi_Host *instance) 709 679 { 710 - char *pos = buffer; 711 - struct NCR5380_hostdata *hostdata; 712 - struct scsi_cmnd *ptr; 713 - unsigned long flags; 714 - off_t begin = 0; 715 - #define check_offset() \ 716 - do { \ 717 - if (pos - buffer < offset - begin) { \ 718 - begin += pos - buffer; \ 719 - pos = buffer; \ 720 - } \ 721 - } while (0) 680 + struct NCR5380_hostdata *hostdata; 681 + Scsi_Cmnd *ptr; 682 + unsigned long flags; 722 683 723 - hostdata = (struct NCR5380_hostdata *)instance->hostdata; 684 + NCR_PRINT(NDEBUG_ANY); 685 + NCR_PRINT_PHASE(NDEBUG_ANY); 724 686 725 - if (inout) { /* Has data been written to the file ? */ 726 - return(-ENOSYS); /* Currently this is a no-op */ 727 - } 728 - SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); 729 - check_offset(); 730 - local_irq_save(flags); 731 - SPRINTF("NCR5380: coroutine is%s running.\n", main_running ? "" : "n't"); 732 - check_offset(); 733 - if (!hostdata->connected) 734 - SPRINTF("scsi%d: no currently connected command\n", HOSTNO); 735 - else 736 - pos = lprint_Scsi_Cmnd ((struct scsi_cmnd *) hostdata->connected, 737 - pos, buffer, length); 738 - SPRINTF("scsi%d: issue_queue\n", HOSTNO); 739 - check_offset(); 740 - for (ptr = (struct scsi_cmnd *) hostdata->issue_queue; ptr; ptr = NEXT(ptr)) 741 - { 742 - pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length); 743 - check_offset(); 744 - } 687 + hostdata = (struct NCR5380_hostdata *)instance->hostdata; 745 688 746 - SPRINTF("scsi%d: disconnected_queue\n", HOSTNO); 747 - check_offset(); 748 - for (ptr = (struct scsi_cmnd *) hostdata->disconnected_queue; ptr; 749 - ptr = NEXT(ptr)) { 750 - pos = lprint_Scsi_Cmnd (ptr, pos, buffer, length); 751 - check_offset(); 752 - } 689 + printk("\nNCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); 690 + local_irq_save(flags); 691 + printk("NCR5380: coroutine is%s running.\n", 692 + main_running ? "" : "n't"); 693 + if (!hostdata->connected) 694 + printk("scsi%d: no currently connected command\n", HOSTNO); 695 + else 696 + lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected); 697 + printk("scsi%d: issue_queue\n", HOSTNO); 698 + for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr = NEXT(ptr)) 699 + lprint_Scsi_Cmnd(ptr); 753 700 754 - local_irq_restore(flags); 755 - *start = buffer + (offset - begin); 756 - if (pos - buffer < offset - begin) 701 + printk("scsi%d: disconnected_queue\n", HOSTNO); 702 + for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; 703 + ptr = NEXT(ptr)) 704 + lprint_Scsi_Cmnd(ptr); 705 + 706 + local_irq_restore(flags); 707 + printk("\n"); 708 + } 709 + 710 + static void show_Scsi_Cmnd(Scsi_Cmnd *cmd, struct seq_file *m) 711 + { 712 + int i, s; 713 + unsigned char *command; 714 + seq_printf(m, "scsi%d: destination target %d, lun %d\n", 715 + H_NO(cmd), cmd->device->id, cmd->device->lun); 716 + seq_printf(m, " command = "); 717 + command = cmd->cmnd; 718 + seq_printf(m, "%2d (0x%02x)", command[0], command[0]); 719 + for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) 720 + seq_printf(m, " %02x", command[i]); 721 + seq_printf(m, "\n"); 722 + } 723 + 724 + static int NCR5380_show_info(struct seq_file *m, struct Scsi_Host *instance) 725 + { 726 + struct NCR5380_hostdata *hostdata; 727 + Scsi_Cmnd *ptr; 728 + unsigned long flags; 729 + 730 + hostdata = (struct NCR5380_hostdata *)instance->hostdata; 731 + 732 + seq_printf(m, "NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); 733 + local_irq_save(flags); 734 + seq_printf(m, "NCR5380: coroutine is%s running.\n", 735 + main_running ? "" : "n't"); 736 + if (!hostdata->connected) 737 + seq_printf(m, "scsi%d: no currently connected command\n", HOSTNO); 738 + else 739 + show_Scsi_Cmnd((Scsi_Cmnd *) hostdata->connected, m); 740 + seq_printf(m, "scsi%d: issue_queue\n", HOSTNO); 741 + for (ptr = (Scsi_Cmnd *)hostdata->issue_queue; ptr; ptr = NEXT(ptr)) 742 + show_Scsi_Cmnd(ptr, m); 743 + 744 + seq_printf(m, "scsi%d: disconnected_queue\n", HOSTNO); 745 + for (ptr = (Scsi_Cmnd *) hostdata->disconnected_queue; ptr; 746 + ptr = NEXT(ptr)) 747 + show_Scsi_Cmnd(ptr, m); 748 + 749 + local_irq_restore(flags); 757 750 return 0; 758 - else if (pos - buffer - (offset - begin) < length) 759 - return pos - buffer - (offset - begin); 760 - return length; 761 751 } 762 - 763 - static char *lprint_Scsi_Cmnd(struct scsi_cmnd *cmd, char *pos, char *buffer, 764 - int length) 765 - { 766 - int i, s; 767 - unsigned char *command; 768 - SPRINTF("scsi%d: destination target %d, lun %d\n", 769 - H_NO(cmd), cmd->device->id, cmd->device->lun); 770 - SPRINTF(" command = "); 771 - command = cmd->cmnd; 772 - SPRINTF("%2d (0x%02x)", command[0], command[0]); 773 - for (i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) 774 - SPRINTF(" %02x", command[i]); 775 - SPRINTF("\n"); 776 - return pos; 777 - } 778 - 779 752 780 753 /* 781 754 * Function : void NCR5380_init (struct Scsi_Host *instance)
+1
drivers/scsi/sun3_scsi.c
··· 626 626 #include "sun3_NCR5380.c" 627 627 628 628 static struct scsi_host_template driver_template = { 629 + .show_info = sun3scsi_show_info, 629 630 .name = SUN3_SCSI_NAME, 630 631 .detect = sun3scsi_detect, 631 632 .release = sun3scsi_release,
+1 -1
drivers/scsi/sun3_scsi.h
··· 100 100 #define NCR5380_queue_command sun3scsi_queue_command 101 101 #define NCR5380_bus_reset sun3scsi_bus_reset 102 102 #define NCR5380_abort sun3scsi_abort 103 - #define NCR5380_proc_info sun3scsi_proc_info 103 + #define NCR5380_show_info sun3scsi_show_info 104 104 #define NCR5380_dma_xfer_len(i, cmd, phase) \ 105 105 sun3scsi_dma_xfer_len(cmd->SCp.this_residual,cmd,((phase) & SR_IO) ? 0 : 1) 106 106