Commit 887fc88e authored by Al Viro's avatar Al Viro

in2000: switch to ->show_info()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent d773e422
...@@ -2166,31 +2166,17 @@ static int in2000_biosparam(struct scsi_device *sdev, struct block_device *bdev, ...@@ -2166,31 +2166,17 @@ static int in2000_biosparam(struct scsi_device *sdev, struct block_device *bdev,
} }
static int in2000_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off, int len, int in) static int in2000_write_info(struct Scsi_Host *instance, char *buf, int len)
{ {
#ifdef PROC_INTERFACE #ifdef PROC_INTERFACE
char *bp; char *bp;
char tbuf[128];
unsigned long flags;
struct IN2000_hostdata *hd; struct IN2000_hostdata *hd;
Scsi_Cmnd *cmd;
int x, i; int x, i;
static int stop = 0;
hd = (struct IN2000_hostdata *) instance->hostdata; hd = (struct IN2000_hostdata *) instance->hostdata;
/* If 'in' is TRUE we need to _read_ the proc file. We accept the following
* keywords (same format as command-line, but only ONE per read):
* debug
* disconnect
* period
* resync
* proc
*/
if (in) {
buf[len] = '\0'; buf[len] = '\0';
bp = buf; bp = buf;
if (!strncmp(bp, "debug:", 6)) { if (!strncmp(bp, "debug:", 6)) {
...@@ -2219,99 +2205,78 @@ static int in2000_proc_info(struct Scsi_Host *instance, char *buf, char **start, ...@@ -2219,99 +2205,78 @@ static int in2000_proc_info(struct Scsi_Host *instance, char *buf, char **start,
bp += 7; bp += 7;
hd->level2 = simple_strtoul(bp, NULL, 0); hd->level2 = simple_strtoul(bp, NULL, 0);
} }
#endif
return len; return len;
} }
static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
{
#ifdef PROC_INTERFACE
unsigned long flags;
struct IN2000_hostdata *hd;
Scsi_Cmnd *cmd;
int x;
hd = (struct IN2000_hostdata *) instance->hostdata;
spin_lock_irqsave(instance->host_lock, flags); spin_lock_irqsave(instance->host_lock, flags);
bp = buf; if (hd->proc & PR_VERSION)
*bp = '\0'; seq_printf(m, "\nVersion %s - %s.", IN2000_VERSION, IN2000_DATE);
if (hd->proc & PR_VERSION) {
sprintf(tbuf, "\nVersion %s - %s.", IN2000_VERSION, IN2000_DATE);
strcat(bp, tbuf);
}
if (hd->proc & PR_INFO) { if (hd->proc & PR_INFO) {
sprintf(tbuf, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No"); seq_printf(m, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No");
strcat(bp, tbuf); seq_printf(m, "\nsync_xfer[] = ");
strcat(bp, "\nsync_xfer[] = "); for (x = 0; x < 7; x++)
for (x = 0; x < 7; x++) { seq_printf(m, "\t%02x", hd->sync_xfer[x]);
sprintf(tbuf, "\t%02x", hd->sync_xfer[x]); seq_printf(m, "\nsync_stat[] = ");
strcat(bp, tbuf); for (x = 0; x < 7; x++)
} seq_printf(m, "\t%02x", hd->sync_stat[x]);
strcat(bp, "\nsync_stat[] = ");
for (x = 0; x < 7; x++) {
sprintf(tbuf, "\t%02x", hd->sync_stat[x]);
strcat(bp, tbuf);
}
} }
#ifdef PROC_STATISTICS #ifdef PROC_STATISTICS
if (hd->proc & PR_STATISTICS) { if (hd->proc & PR_STATISTICS) {
strcat(bp, "\ncommands issued: "); seq_printf(m, "\ncommands issued: ");
for (x = 0; x < 7; x++) { for (x = 0; x < 7; x++)
sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]); seq_printf(m, "\t%ld", hd->cmd_cnt[x]);
strcat(bp, tbuf); seq_printf(m, "\ndisconnects allowed:");
} for (x = 0; x < 7; x++)
strcat(bp, "\ndisconnects allowed:"); seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]);
for (x = 0; x < 7; x++) { seq_printf(m, "\ndisconnects done: ");
sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]); for (x = 0; x < 7; x++)
strcat(bp, tbuf); seq_printf(m, "\t%ld", hd->disc_done_cnt[x]);
} seq_printf(m, "\ninterrupts: \t%ld", hd->int_cnt);
strcat(bp, "\ndisconnects done: ");
for (x = 0; x < 7; x++) {
sprintf(tbuf, "\t%ld", hd->disc_done_cnt[x]);
strcat(bp, tbuf);
}
sprintf(tbuf, "\ninterrupts: \t%ld", hd->int_cnt);
strcat(bp, tbuf);
} }
#endif #endif
if (hd->proc & PR_CONNECTED) { if (hd->proc & PR_CONNECTED) {
strcat(bp, "\nconnected: "); seq_printf(m, "\nconnected: ");
if (hd->connected) { if (hd->connected) {
cmd = (Scsi_Cmnd *) hd->connected; cmd = (Scsi_Cmnd *) hd->connected;
sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
strcat(bp, tbuf);
} }
} }
if (hd->proc & PR_INPUTQ) { if (hd->proc & PR_INPUTQ) {
strcat(bp, "\ninput_Q: "); seq_printf(m, "\ninput_Q: ");
cmd = (Scsi_Cmnd *) hd->input_Q; cmd = (Scsi_Cmnd *) hd->input_Q;
while (cmd) { while (cmd) {
sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
strcat(bp, tbuf);
cmd = (Scsi_Cmnd *) cmd->host_scribble; cmd = (Scsi_Cmnd *) cmd->host_scribble;
} }
} }
if (hd->proc & PR_DISCQ) { if (hd->proc & PR_DISCQ) {
strcat(bp, "\ndisconnected_Q:"); seq_printf(m, "\ndisconnected_Q:");
cmd = (Scsi_Cmnd *) hd->disconnected_Q; cmd = (Scsi_Cmnd *) hd->disconnected_Q;
while (cmd) { while (cmd) {
sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
strcat(bp, tbuf);
cmd = (Scsi_Cmnd *) cmd->host_scribble; cmd = (Scsi_Cmnd *) cmd->host_scribble;
} }
} }
if (hd->proc & PR_TEST) { if (hd->proc & PR_TEST) {
; /* insert your own custom function here */ ; /* insert your own custom function here */
} }
strcat(bp, "\n"); seq_printf(m, "\n");
spin_unlock_irqrestore(instance->host_lock, flags); spin_unlock_irqrestore(instance->host_lock, flags);
*start = buf;
if (stop) {
stop = 0;
return 0; /* return 0 to signal end-of-file */
}
if (off > 0x40000) /* ALWAYS stop after 256k bytes have been read */
stop = 1;
if (hd->proc & PR_STOP) /* stop every other time */
stop = 1;
return strlen(bp);
#else /* PROC_INTERFACE */
return 0;
#endif /* PROC_INTERFACE */ #endif /* PROC_INTERFACE */
return 0;
} }
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -2319,7 +2284,8 @@ MODULE_LICENSE("GPL"); ...@@ -2319,7 +2284,8 @@ MODULE_LICENSE("GPL");
static struct scsi_host_template driver_template = { static struct scsi_host_template driver_template = {
.proc_name = "in2000", .proc_name = "in2000",
.proc_info = in2000_proc_info, .write_info = in2000_write_info,
.show_info = in2000_show_info,
.name = "Always IN2000", .name = "Always IN2000",
.detect = in2000_detect, .detect = in2000_detect,
.release = in2000_release, .release = in2000_release,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment