Commit e88b7bb0 authored by Al Viro's avatar Al Viro

cciss: switch to ->show_info()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 25daa96f
...@@ -54,13 +54,11 @@ static CommandList_struct *cmd_special_alloc(ctlr_info_t *h); ...@@ -54,13 +54,11 @@ static CommandList_struct *cmd_special_alloc(ctlr_info_t *h);
static void cmd_free(ctlr_info_t *h, CommandList_struct *c); static void cmd_free(ctlr_info_t *h, CommandList_struct *c);
static void cmd_special_free(ctlr_info_t *h, CommandList_struct *c); static void cmd_special_free(ctlr_info_t *h, CommandList_struct *c);
static int cciss_scsi_proc_info( static int cciss_scsi_write_info(struct Scsi_Host *sh,
struct Scsi_Host *sh,
char *buffer, /* data buffer */ char *buffer, /* data buffer */
char **start, /* where data in buffer starts */ int length); /* length of data in buffer */
off_t offset, /* offset from start of imaginary file */ static int cciss_scsi_show_info(struct seq_file *m,
int length, /* length of data in buffer */ struct Scsi_Host *sh);
int func); /* 0 == read, 1 == write */
static int cciss_scsi_queue_command (struct Scsi_Host *h, static int cciss_scsi_queue_command (struct Scsi_Host *h,
struct scsi_cmnd *cmd); struct scsi_cmnd *cmd);
...@@ -82,7 +80,8 @@ static struct scsi_host_template cciss_driver_template = { ...@@ -82,7 +80,8 @@ static struct scsi_host_template cciss_driver_template = {
.module = THIS_MODULE, .module = THIS_MODULE,
.name = "cciss", .name = "cciss",
.proc_name = "cciss", .proc_name = "cciss",
.proc_info = cciss_scsi_proc_info, .write_info = cciss_scsi_write_info,
.show_info = cciss_scsi_show_info,
.queuecommand = cciss_scsi_queue_command, .queuecommand = cciss_scsi_queue_command,
.this_id = 7, .this_id = 7,
.cmd_per_lun = 1, .cmd_per_lun = 1,
...@@ -1302,26 +1301,30 @@ cciss_scsi_user_command(ctlr_info_t *h, int hostno, char *buffer, int length) ...@@ -1302,26 +1301,30 @@ cciss_scsi_user_command(ctlr_info_t *h, int hostno, char *buffer, int length)
return length; return length;
} }
static int static int
cciss_scsi_proc_info(struct Scsi_Host *sh, cciss_scsi_write_info(struct Scsi_Host *sh,
char *buffer, /* data buffer */ char *buffer, /* data buffer */
char **start, /* where data in buffer starts */ int length) /* length of data in buffer */
off_t offset, /* offset from start of imaginary file */
int length, /* length of data in buffer */
int func) /* 0 == read, 1 == write */
{ {
ctlr_info_t *h = (ctlr_info_t *) sh->hostdata[0];
if (h == NULL) /* This really shouldn't ever happen. */
return -EINVAL;
int buflen, datalen; return cciss_scsi_user_command(h, sh->host_no,
ctlr_info_t *h; buffer, length);
}
static int
cciss_scsi_show_info(struct seq_file *m, struct Scsi_Host *sh)
{
ctlr_info_t *h = (ctlr_info_t *) sh->hostdata[0];
int i; int i;
h = (ctlr_info_t *) sh->hostdata[0];
if (h == NULL) /* This really shouldn't ever happen. */ if (h == NULL) /* This really shouldn't ever happen. */
return -EINVAL; return -EINVAL;
if (func == 0) { /* User is reading from /proc/scsi/ciss*?/?* */ seq_printf(m, "cciss%d: SCSI host: %d\n",
buflen = sprintf(buffer, "cciss%d: SCSI host: %d\n",
h->ctlr, sh->host_no); h->ctlr, sh->host_no);
/* this information is needed by apps to know which cciss /* this information is needed by apps to know which cciss
...@@ -1335,7 +1338,7 @@ cciss_scsi_proc_info(struct Scsi_Host *sh, ...@@ -1335,7 +1338,7 @@ cciss_scsi_proc_info(struct Scsi_Host *sh,
for (i = 0; i < ccissscsi[h->ctlr].ndevices; i++) { for (i = 0; i < ccissscsi[h->ctlr].ndevices; i++) {
struct cciss_scsi_dev_t *sd = struct cciss_scsi_dev_t *sd =
&ccissscsi[h->ctlr].dev[i]; &ccissscsi[h->ctlr].dev[i];
buflen += sprintf(&buffer[buflen], "c%db%dt%dl%d %02d " seq_printf(m, "c%db%dt%dl%d %02d "
"0x%02x%02x%02x%02x%02x%02x%02x%02x\n", "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
sh->host_no, sd->bus, sd->target, sd->lun, sh->host_no, sd->bus, sd->target, sd->lun,
sd->devtype, sd->devtype,
...@@ -1344,16 +1347,7 @@ cciss_scsi_proc_info(struct Scsi_Host *sh, ...@@ -1344,16 +1347,7 @@ cciss_scsi_proc_info(struct Scsi_Host *sh,
sd->scsi3addr[4], sd->scsi3addr[5], sd->scsi3addr[4], sd->scsi3addr[5],
sd->scsi3addr[6], sd->scsi3addr[7]); sd->scsi3addr[6], sd->scsi3addr[7]);
} }
datalen = buflen - offset; return 0;
if (datalen < 0) { /* they're reading past EOF. */
datalen = 0;
*start = buffer+buflen;
} else
*start = buffer + offset;
return(datalen);
} else /* User is writing to /proc/scsi/cciss*?/?* ... */
return cciss_scsi_user_command(h, sh->host_no,
buffer, length);
} }
/* cciss_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci /* cciss_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci
......
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