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

dpt_i2o: switch to ->show_info()

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

Al Viro ff98f7ce 8c986544

+12 -90
+12 -90
drivers/scsi/dpt_i2o.c
··· 553 553 return (char *) (pHba->detail); 554 554 } 555 555 556 - static int adpt_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, 557 - int length, int inout) 556 + static int adpt_show_info(struct seq_file *m, struct Scsi_Host *host) 558 557 { 559 558 struct adpt_device* d; 560 559 int id; 561 560 int chan; 562 - int len = 0; 563 - int begin = 0; 564 - int pos = 0; 565 561 adpt_hba* pHba; 566 562 int unit; 567 - 568 - *start = buffer; 569 - if (inout == TRUE) { 570 - /* 571 - * The user has done a write and wants us to take the 572 - * data in the buffer and do something with it. 573 - * proc_scsiwrite calls us with inout = 1 574 - * 575 - * Read data from buffer (writing to us) - NOT SUPPORTED 576 - */ 577 - return -EINVAL; 578 - } 579 - 580 - /* 581 - * inout = 0 means the user has done a read and wants information 582 - * returned, so we write information about the cards into the buffer 583 - * proc_scsiread() calls us with inout = 0 584 - */ 585 563 586 564 // Find HBA (host bus adapter) we are looking for 587 565 mutex_lock(&adpt_configuration_lock); ··· 574 596 } 575 597 host = pHba->host; 576 598 577 - len = sprintf(buffer , "Adaptec I2O RAID Driver Version: %s\n\n", DPT_I2O_VERSION); 578 - len += sprintf(buffer+len, "%s\n", pHba->detail); 579 - len += sprintf(buffer+len, "SCSI Host=scsi%d Control Node=/dev/%s irq=%d\n", 599 + seq_printf(m, "Adaptec I2O RAID Driver Version: %s\n\n", DPT_I2O_VERSION); 600 + seq_printf(m, "%s\n", pHba->detail); 601 + seq_printf(m, "SCSI Host=scsi%d Control Node=/dev/%s irq=%d\n", 580 602 pHba->host->host_no, pHba->name, host->irq); 581 - len += sprintf(buffer+len, "\tpost fifo size = %d\n\treply fifo size = %d\n\tsg table size = %d\n\n", 603 + seq_printf(m, "\tpost fifo size = %d\n\treply fifo size = %d\n\tsg table size = %d\n\n", 582 604 host->can_queue, (int) pHba->reply_fifo_size , host->sg_tablesize); 583 605 584 - pos = begin + len; 585 - 586 - /* CHECKPOINT */ 587 - if(pos > offset + length) { 588 - goto stop_output; 589 - } 590 - if(pos <= offset) { 591 - /* 592 - * If we haven't even written to where we last left 593 - * off (the last time we were called), reset the 594 - * beginning pointer. 595 - */ 596 - len = 0; 597 - begin = pos; 598 - } 599 - len += sprintf(buffer+len, "Devices:\n"); 606 + seq_printf(m, "Devices:\n"); 600 607 for(chan = 0; chan < MAX_CHANNEL; chan++) { 601 608 for(id = 0; id < MAX_ID; id++) { 602 609 d = pHba->channel[chan].device[id]; 603 - while(d){ 604 - len += sprintf(buffer+len,"\t%-24.24s", d->pScsi_dev->vendor); 605 - len += sprintf(buffer+len," Rev: %-8.8s\n", d->pScsi_dev->rev); 606 - pos = begin + len; 607 - 608 - 609 - /* CHECKPOINT */ 610 - if(pos > offset + length) { 611 - goto stop_output; 612 - } 613 - if(pos <= offset) { 614 - len = 0; 615 - begin = pos; 616 - } 610 + while(d) { 611 + seq_printf(m,"\t%-24.24s", d->pScsi_dev->vendor); 612 + seq_printf(m," Rev: %-8.8s\n", d->pScsi_dev->rev); 617 613 618 614 unit = d->pI2o_dev->lct_data.tid; 619 - len += sprintf(buffer+len, "\tTID=%d, (Channel=%d, Target=%d, Lun=%d) (%s)\n\n", 615 + seq_printf(m, "\tTID=%d, (Channel=%d, Target=%d, Lun=%d) (%s)\n\n", 620 616 unit, (int)d->scsi_channel, (int)d->scsi_id, (int)d->scsi_lun, 621 617 scsi_device_online(d->pScsi_dev)? "online":"offline"); 622 - pos = begin + len; 623 - 624 - /* CHECKPOINT */ 625 - if(pos > offset + length) { 626 - goto stop_output; 627 - } 628 - if(pos <= offset) { 629 - len = 0; 630 - begin = pos; 631 - } 632 - 633 618 d = d->next_lun; 634 619 } 635 620 } 636 621 } 637 - 638 - /* 639 - * begin is where we last checked our position with regards to offset 640 - * begin is always less than offset. len is relative to begin. It 641 - * is the number of bytes written past begin 642 - * 643 - */ 644 - stop_output: 645 - /* stop the output and calculate the correct length */ 646 - *(buffer + len) = '\0'; 647 - 648 - *start = buffer + (offset - begin); /* Start of wanted data */ 649 - len -= (offset - begin); 650 - if(len > length) { 651 - len = length; 652 - } else if(len < 0){ 653 - len = 0; 654 - **start = '\0'; 655 - } 656 - return len; 622 + return 0; 657 623 } 658 624 659 625 /* ··· 3561 3639 .module = THIS_MODULE, 3562 3640 .name = "dpt_i2o", 3563 3641 .proc_name = "dpt_i2o", 3564 - .proc_info = adpt_proc_info, 3642 + .show_info = adpt_show_info, 3565 3643 .info = adpt_info, 3566 3644 .queuecommand = adpt_queue, 3567 3645 .eh_abort_handler = adpt_abort,