diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-03-31 03:21:50 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-09 14:13:24 -0400 |
commit | ff98f7ce0ec89a3de50a1920eb8a223bf0a3a6f2 (patch) | |
tree | 003f51ae81dc37e4626b782df8e6b7a482549c56 /drivers/scsi | |
parent | 8c986544562b667766f42e08a206f6c2e21d272c (diff) |
dpt_i2o: switch to ->show_info()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/dpt_i2o.c | 102 |
1 files changed, 12 insertions, 90 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index b6e2700ec1c6..19e1b422260a 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -553,36 +553,14 @@ static const char *adpt_info(struct Scsi_Host *host) | |||
553 | return (char *) (pHba->detail); | 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, | 556 | static int adpt_show_info(struct seq_file *m, struct Scsi_Host *host) |
557 | int length, int inout) | ||
558 | { | 557 | { |
559 | struct adpt_device* d; | 558 | struct adpt_device* d; |
560 | int id; | 559 | int id; |
561 | int chan; | 560 | int chan; |
562 | int len = 0; | ||
563 | int begin = 0; | ||
564 | int pos = 0; | ||
565 | adpt_hba* pHba; | 561 | adpt_hba* pHba; |
566 | int unit; | 562 | int unit; |
567 | 563 | ||
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 | |||
586 | // Find HBA (host bus adapter) we are looking for | 564 | // Find HBA (host bus adapter) we are looking for |
587 | mutex_lock(&adpt_configuration_lock); | 565 | mutex_lock(&adpt_configuration_lock); |
588 | for (pHba = hba_chain; pHba; pHba = pHba->next) { | 566 | for (pHba = hba_chain; pHba; pHba = pHba->next) { |
@@ -596,86 +574,30 @@ static int adpt_proc_info(struct Scsi_Host *host, char *buffer, char **start, of | |||
596 | } | 574 | } |
597 | host = pHba->host; | 575 | host = pHba->host; |
598 | 576 | ||
599 | len = sprintf(buffer , "Adaptec I2O RAID Driver Version: %s\n\n", DPT_I2O_VERSION); | 577 | seq_printf(m, "Adaptec I2O RAID Driver Version: %s\n\n", DPT_I2O_VERSION); |
600 | len += sprintf(buffer+len, "%s\n", pHba->detail); | 578 | seq_printf(m, "%s\n", pHba->detail); |
601 | len += sprintf(buffer+len, "SCSI Host=scsi%d Control Node=/dev/%s irq=%d\n", | 579 | seq_printf(m, "SCSI Host=scsi%d Control Node=/dev/%s irq=%d\n", |
602 | pHba->host->host_no, pHba->name, host->irq); | 580 | pHba->host->host_no, pHba->name, host->irq); |
603 | len += sprintf(buffer+len, "\tpost fifo size = %d\n\treply fifo size = %d\n\tsg table size = %d\n\n", | 581 | seq_printf(m, "\tpost fifo size = %d\n\treply fifo size = %d\n\tsg table size = %d\n\n", |
604 | host->can_queue, (int) pHba->reply_fifo_size , host->sg_tablesize); | 582 | host->can_queue, (int) pHba->reply_fifo_size , host->sg_tablesize); |
605 | 583 | ||
606 | pos = begin + len; | 584 | seq_printf(m, "Devices:\n"); |
607 | |||
608 | /* CHECKPOINT */ | ||
609 | if(pos > offset + length) { | ||
610 | goto stop_output; | ||
611 | } | ||
612 | if(pos <= offset) { | ||
613 | /* | ||
614 | * If we haven't even written to where we last left | ||
615 | * off (the last time we were called), reset the | ||
616 | * beginning pointer. | ||
617 | */ | ||
618 | len = 0; | ||
619 | begin = pos; | ||
620 | } | ||
621 | len += sprintf(buffer+len, "Devices:\n"); | ||
622 | for(chan = 0; chan < MAX_CHANNEL; chan++) { | 585 | for(chan = 0; chan < MAX_CHANNEL; chan++) { |
623 | for(id = 0; id < MAX_ID; id++) { | 586 | for(id = 0; id < MAX_ID; id++) { |
624 | d = pHba->channel[chan].device[id]; | 587 | d = pHba->channel[chan].device[id]; |
625 | while(d){ | 588 | while(d) { |
626 | len += sprintf(buffer+len,"\t%-24.24s", d->pScsi_dev->vendor); | 589 | seq_printf(m,"\t%-24.24s", d->pScsi_dev->vendor); |
627 | len += sprintf(buffer+len," Rev: %-8.8s\n", d->pScsi_dev->rev); | 590 | seq_printf(m," Rev: %-8.8s\n", d->pScsi_dev->rev); |
628 | pos = begin + len; | ||
629 | |||
630 | |||
631 | /* CHECKPOINT */ | ||
632 | if(pos > offset + length) { | ||
633 | goto stop_output; | ||
634 | } | ||
635 | if(pos <= offset) { | ||
636 | len = 0; | ||
637 | begin = pos; | ||
638 | } | ||
639 | 591 | ||
640 | unit = d->pI2o_dev->lct_data.tid; | 592 | unit = d->pI2o_dev->lct_data.tid; |
641 | len += sprintf(buffer+len, "\tTID=%d, (Channel=%d, Target=%d, Lun=%d) (%s)\n\n", | 593 | seq_printf(m, "\tTID=%d, (Channel=%d, Target=%d, Lun=%d) (%s)\n\n", |
642 | unit, (int)d->scsi_channel, (int)d->scsi_id, (int)d->scsi_lun, | 594 | unit, (int)d->scsi_channel, (int)d->scsi_id, (int)d->scsi_lun, |
643 | scsi_device_online(d->pScsi_dev)? "online":"offline"); | 595 | scsi_device_online(d->pScsi_dev)? "online":"offline"); |
644 | pos = begin + len; | ||
645 | |||
646 | /* CHECKPOINT */ | ||
647 | if(pos > offset + length) { | ||
648 | goto stop_output; | ||
649 | } | ||
650 | if(pos <= offset) { | ||
651 | len = 0; | ||
652 | begin = pos; | ||
653 | } | ||
654 | |||
655 | d = d->next_lun; | 596 | d = d->next_lun; |
656 | } | 597 | } |
657 | } | 598 | } |
658 | } | 599 | } |
659 | 600 | return 0; | |
660 | /* | ||
661 | * begin is where we last checked our position with regards to offset | ||
662 | * begin is always less than offset. len is relative to begin. It | ||
663 | * is the number of bytes written past begin | ||
664 | * | ||
665 | */ | ||
666 | stop_output: | ||
667 | /* stop the output and calculate the correct length */ | ||
668 | *(buffer + len) = '\0'; | ||
669 | |||
670 | *start = buffer + (offset - begin); /* Start of wanted data */ | ||
671 | len -= (offset - begin); | ||
672 | if(len > length) { | ||
673 | len = length; | ||
674 | } else if(len < 0){ | ||
675 | len = 0; | ||
676 | **start = '\0'; | ||
677 | } | ||
678 | return len; | ||
679 | } | 601 | } |
680 | 602 | ||
681 | /* | 603 | /* |
@@ -3639,7 +3561,7 @@ static struct scsi_host_template driver_template = { | |||
3639 | .module = THIS_MODULE, | 3561 | .module = THIS_MODULE, |
3640 | .name = "dpt_i2o", | 3562 | .name = "dpt_i2o", |
3641 | .proc_name = "dpt_i2o", | 3563 | .proc_name = "dpt_i2o", |
3642 | .proc_info = adpt_proc_info, | 3564 | .show_info = adpt_show_info, |
3643 | .info = adpt_info, | 3565 | .info = adpt_info, |
3644 | .queuecommand = adpt_queue, | 3566 | .queuecommand = adpt_queue, |
3645 | .eh_abort_handler = adpt_abort, | 3567 | .eh_abort_handler = adpt_abort, |